Skip to content

credit: records for keys a store held before records were kept - #30

Merged
Marius1311 merged 3 commits into
mainfrom
credit-existing-keys
Nov 18, 2026
Merged

Marius1311 merged 3 commits into
mainfrom
credit-existing-keys

Conversation

@Marius1311

@Marius1311 Marius1311 commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

A repo that adopts these conventions has stores written before records were kept. A writes block records only keys that appear while it is open, so those keys stayed without a record and every trace through such a store ended at "no record".

What it adds. credit(store, keys, task=<its directory>, at=<when>) writes the record a block would have written, for keys that are in the store and that no record covers. Dry run by default, like commit_adata. The record has the usual fields, with branch empty, and one more, recorded (when it was added), so a reconstructed record is recognizable. at is the time the task wrote the keys: a trace of a whole store follows only records older than what was made from it, so a record dated at adoption would be skipped.

What it refuses. A key that is absent or already covered, a task without an id, a time in the future, a time another record of the store already has (a trace tells a store's records apart by their time), anything that is not an AnnData or SpatialData store, and an AnnData store with consolidated metadata.

Adopting (references/repos.md): one step more, for the stores a repo already holds.

+165 −6 lines; version 0.11.0.

Tests: 180 pass, 1 skipped. New: a store written outside a block is credited to two tasks and a later block records only what it adds; each refusal; a SpatialData layout; a credited key traces to its task's inputs, and a whole-store input follows the credited record by its time. Rehearsed on copies of five real stores (two SpatialData, three AnnData; 347 keys): every key covered, no data file changed, and traces run from a derived file back to the raw data.

🤖 Generated with Claude Code

…ease 0.11.0

A `writes` block records only what appears while it is open, so a repo that adopts the conventions could not
make its existing stores traceable. `credit(store, keys, task=, at=)` adds the record such a block would have
written, for keys no record covers, with the time the task wrote them; dry run by default. The adoption steps
say how existing tasks and stores are brought in.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 18, 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-18T14:10:08.668917Z 8ae4755 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: ec73453be3

ℹ️ 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/provenance.py Outdated
Comment on lines +301 to +302
if any((r["task"], r["at"]) == (record["task"], record["at"]) for r in found):
raise ValueError(f"{path} already holds a record of {record['path']} at {record['at']}.")

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 Keep credited records distinct when tasks share a timestamp

When two different tasks are credited with the same at in one store—for example, when historical write times are known only to the day—this check accepts both records, but trace.py identifies their nodes solely as f"{rel}@{record['at']}". A whole-store trace therefore merges their keys under the first task, and _expanded prevents the second task's inputs from being followed, silently producing incorrect lineage. Either include the task identity in trace node IDs or reject duplicate timestamps across tasks before writing the credit.

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 94e8c3e: credit now refuses a time that another record of the store already has, whichever task it belongs to, so the times a trace tells records apart by stay unique. The PR body's "second record of the same task at the same time" is that rule now.

A trace tells a store's records apart by their time, so two tasks credited at the same time would merge.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

@Marius1311 Marius1311 left a comment

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.

Make sure you don't hard code specifics of the current conversion into the plugin. It needs to be fully generic.

Task directories and shared stores that predate the conventions are then made traceable. This edits earlier task
directories and writes to shared storage, so the human approves it first and the PR notes it as an exception:

1. Each task README gets the template's header lines: `**Author:**`, and `**Id:**` with a new

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.

Wait, are you hard-coding a conversion here that depends on two states of the plugin, both of which are specific to the current migtation, and have no general relevance? Don't encode anything here which isn't generic.

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.

Yes, it was: the Author and Id lines only matter to a repo that adopted an earlier version of the plugin, and the consolidated-store rewrite is already what credit's refusal says. Removed in 8ae4755. What stays is one generic step: stores a repo already holds have no records, and credit adds them where the code shows who wrote what.

…specific steps removed

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@Marius1311
Marius1311 merged commit bdfb12c into main Nov 18, 2026
3 checks passed
@Marius1311
Marius1311 deleted the credit-existing-keys branch November 18, 2026 14:12
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