Repository navigation
Trace as a graph of tasks; inputs name their keys; copies name their original - #48
Conversation
…drawing A trace is now the tasks an artifact rests on: an edge from a task to one that consumed what it made lists those artifacts with their keys, and each task keeps what it consumed that no task made. Whole-store inputs (`*`) are refused, so the trace no longer reads file times. `trace` prints JSON; the drawing moves to an optional viewer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`writes(new, copy_of=original)` gives the copy the original's records for the keys it kept, read from the original, and credits only keys the original lacks. A new store that arrives carrying records without `copy_of` is refused. The cell magic takes `--copy-of`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7826a93ab8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if not found: | ||
| return [self.leaf(rel, None if key == "*" else key)] | ||
| nodes = [] | ||
| if key == "*" and (bare := uncovered(self.on_disk(rel))): # the whole store includes what no record covers | ||
| label = f"{rel.name}: {len(bare)} key(s) without a record" | ||
| nodes.append(self.node(f"{rel}#no record", label=label, keys=bare, status="no record")) | ||
| for record in found: | ||
| node_id = f"{rel}@{record['at']}" | ||
| task = self.tasks.get(record["task"]) | ||
| if node_id not in self.trace.nodes: | ||
| self.node( | ||
| node_id, | ||
| store=str(rel), | ||
| keys=[], | ||
| written=len(record["keys"]), | ||
| status="traced" if task else f"task not in this checkout: {record['path']} on {record['branch']}", | ||
| task=str(task) if task else None, | ||
| ) | ||
| node = self.trace.nodes[node_id] | ||
| node["keys"] = sorted({*node["keys"], *(record["keys"] if key == "*" else [key])}) | ||
| shown = ", ".join(node["keys"][:3]) + (f" (+{len(node['keys']) - 3})" if len(node["keys"]) > 3 else "") | ||
| node["label"] = f"{rel.name}: {shown}" | ||
| if task: | ||
| self.made_by(node_id, task, record["at"]) | ||
| nodes.append(node_id) | ||
| return nodes | ||
| return None, NO_RECORD |
There was a problem hiding this comment.
Preserve source classification for unrecorded store keys
When an input names a key in a raw-data, resource, or external store without provenance records, this branch always marks it no record, even though the same path without a key is correctly classified as source. Previously, the unrecorded-key fallback used leaf(), which applied the source-path classification too. For example, consuming X from data/ds/raw/counts.zarr now incorrectly reports a provenance gap rather than an external source, affecting both the trace JSON and the trace-lineage report. Apply the source-path classification to unrecorded keys as well.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in b45fa78: a key without a record is classified by its path like a file, so a key of a store under raw/ or resources/ is source; test added.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b45fa78e00
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| maker, status = walk.maker(rel, key) | ||
| walk.trace.target = {"path": str(rel), "key": key, "task": maker and str(maker), "status": status} |
There was a problem hiding this comment.
Reject wildcard keys on the trace target too
When a caller passes "*" as the target key, trace() sends it directly to maker() without the wildcard validation used for declared inputs. Since provenance records contain concrete key names, this returns status: "no record" and an empty task graph even for a fully recorded store. Previously this argument traced the whole store; now it silently produces misleading provenance instead of explaining that explicit keys are required. Validate the target key before resolving its maker.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in edcc49f: trace refuses * as its key and asks for one; test added.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Groundwork for the lineage viewer (#46), which becomes its own package; analysis-workflow keeps tracing, the viewer does the pictures.
Trace. A trace is now the tasks an artifact rests on. An edge runs from a task to one that consumed what it made and lists those artifacts, with the keys that task took; each task keeps what it consumed that no task made, marked
source,no recordortask not in this checkout. Before, nodes were artifacts and every input of a task was linked to every output on the path, and a store's keys were merged across all its consumers, so an edge could not say which keys a task took.Inputs name their keys.
*(a whole store) is refused bytraceand reported bycheck inputs. The trace no longer needs file modification times.Copies.
writes(new, copy_of=original)(%%writes new --copy-of original) gives the copy the original's records for the keys it kept, read from the original, so an object rebuilt or read without its records still gets them. Only keys the original lacks are credited to the task; one the original holds without a record stays without one. A new store that arrives carrying records withoutcopy_ofis refused: before, a copy credited the copying task with any key that had no record in the original.Removed.
graph.pyand--format tree|tasks|dot|pdf:traceprints JSON. Thetrace-lineagereport is text only.Version 0.15.0. Follow-ups: the template's
CONVENTIONS.md(trace commands, copies) and its Graphviz dependency.🤖 Generated with Claude Code