Skip to content

Trace as a graph of tasks; inputs name their keys; copies name their original - #48

Merged
Marius1311 merged 4 commits into
mainfrom
trace-task-graph
Nov 30, 2026
Merged

Marius1311 merged 4 commits into
mainfrom
trace-task-graph

Conversation

@Marius1311

Copy link
Copy Markdown
Member

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 record or task 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 by trace and reported by check 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 without copy_of is refused: before, a copy credited the copying task with any key that had no record in the original.

Removed. graph.py and --format tree|tasks|dot|pdf: trace prints JSON. The trace-lineage report 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

Marius1311 and others added 2 commits November 30, 2026 13:06
…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>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-30T12:24:04.702543Z b45fa78 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread src/analysis_workflow/trace.py Outdated
Comment on lines +154 to +155
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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +244 to +245
maker, status = walk.maker(rel, key)
walk.trace.target = {"path": str(rel), "key": key, "task": maker and str(maker), "status": status}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in edcc49f: trace refuses * as its key and asks for one; test added.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Marius1311
Marius1311 merged commit e9dcd8b into main Nov 30, 2026
3 checks passed
@Marius1311
Marius1311 deleted the trace-task-graph branch November 30, 2026 13:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant