Repository navigation
credit: records for keys a store held before records were kept - #30
Conversation
…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>
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: 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".
| 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']}.") |
There was a problem hiding this comment.
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 👍 / 👎.
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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>
A repo that adopts these conventions has stores written before records were kept. A
writesblock 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, likecommit_adata. The record has the usual fields, withbranchempty, and one more,recorded(when it was added), so a reconstructed record is recognizable.atis 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