fix(evolution): preserve immutable refresh provenance - #10
Merged
Conversation
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
Reviewer's GuideIntroduce a UTC run_id for each refresh/discovery run, move ledgers/manifests/summaries into immutable per-run directories keyed by run_id, propagate run_id through discovery, refresh, and daily worker flows, and add tests to prevent same-day reruns from overwriting previous candidate provenance. Sequence diagram for run_id propagation across refresh, discovery, and daily workersequenceDiagram
actor Scheduler
participant daily_worker_run_daily as daily_worker.run_daily
participant refresh_run_refresh as refresh.run_refresh
participant discover_run_discovery as discover.run_discovery
Scheduler->>daily_worker_run_daily: run_daily()
daily_worker_run_daily->>refresh_run_refresh: _run(refresh.py args)
activate refresh_run_refresh
refresh_run_refresh->>refresh_run_refresh: new_run_id()
refresh_run_refresh->>refresh_run_refresh: validate_run_id(run_id)
refresh_run_refresh->>discover_run_discovery: run_discovery(run_id=run_id, captured_at=run_date)
activate discover_run_discovery
discover_run_discovery->>discover_run_discovery: validate_run_id(run_id)
discover_run_discovery->>discover_run_discovery: _write_yaml(candidates/runs/run_id/short.yaml)
discover_run_discovery->>discover_run_discovery: _write_yaml(candidates/runs/run_id/manifest.yaml)
discover_run_discovery-->>refresh_run_refresh: discovery result
deactivate discover_run_discovery
refresh_run_refresh->>refresh_run_refresh: _finalize_summary(root, run_id, summary)
refresh_run_refresh->>refresh_run_refresh: _write_summary(candidates/runs/run_id/refresh-summary.yaml)
refresh_run_refresh-->>daily_worker_run_daily: json { run_id, run_date, ... }
deactivate refresh_run_refresh
daily_worker_run_daily->>daily_worker_run_daily: parse run_id from refresh_result
daily_worker_run_daily->>refresh_run_refresh: _run(refresh.py --skip-discovery --run-id=run_id)
activate refresh_run_refresh
refresh_run_refresh->>refresh_run_refresh: validate_run_id(run_id)
refresh_run_refresh->>refresh_run_refresh: _finalize_summary(root, run_id, summary)
refresh_run_refresh-->>daily_worker_run_daily: updated summary
deactivate refresh_run_refresh
daily_worker_run_daily->>daily_worker_run_daily: open candidates/runs/run_id/refresh-summary.yaml
daily_worker_run_daily-->>Scheduler: json { run_id, run_date, branch, status, url }
Flow diagram for immutable per-run candidate artifacts keyed by run_idflowchart LR
root[candidates/runs]
run[run_id directory]
ledger[per-source ledger short.yaml]
manifest[manifest.yaml]
summary[refresh-summary.yaml]
root --> run
run --> ledger
run --> manifest
run --> summary
subgraph discover_run_discovery
D1[write per-source ledger]
D2[write manifest]
end
subgraph refresh_run_refresh
R1[write refresh summary]
end
D1 --> ledger
D2 --> manifest
R1 --> summary
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 2 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="tests/test_evolution.py" line_range="261-270" />
<code_context>
assert page_fm["architectures"] == ["gfx950"]
assert page_fm["scope_status"] == "active"
+ second = run_discovery(
+ root=root,
+ source_ids=["example"],
+ fixture_path=fixture,
+ captured_at="2026-07-22",
+ run_id="20260722T000100Z",
+ dry_run=False,
+ )
+ assert second["included"] == 0
+ first_ledger = yaml.safe_load(ledger.read_text(encoding="utf-8"))
+ second_ledger = yaml.safe_load(
+ (
+ root
+ / "candidates"
+ / "runs"
+ / "20260722T000100Z"
+ / "example.yaml"
+ ).read_text(encoding="utf-8")
+ )
+ assert len(first_ledger["candidates"]) == 1
+ assert second_ledger["candidates"] == []
+
</code_context>
<issue_to_address>
**suggestion (testing):** Strengthen the same-day retry regression by checking per-run provenance fields.
The current assertions confirm candidate counts for each run. To better capture the provenance behavior you’re guarding, also assert key metadata fields in both ledgers (e.g., `run_id`, `run_date`, counts) to show that the first run’s record remains unchanged and is not overwritten by the second run with a different `run_id`. This helps catch regressions where ledgers might unintentionally share or override metadata despite being in separate directories.
</issue_to_address>
### Comment 2
<location path="tests/test_evolution.py" line_range="429-432" />
<code_context>
try:
_finalize_summary(
root,
- "2026-07-22",
+ "20260722T000000Z",
summary,
max_files=0,
</code_context>
<issue_to_address>
**suggestion (testing):** Explicitly assert `run_id` in the finalized summary object, not just the path.
In `test_final_summary_is_inside_the_enforced_budget`, the current assertion only checks that the summary file path contains the `run_id`. Please also assert that `finalized["run_id"] == "20260722T000000Z"` (and optionally that `summary["run_id"]` is unchanged) so the test verifies the in-memory summary retains the provenance identifier through `_finalize_summary` and protects against future regressions.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
run_id(YYYYMMDDTHHMMSSZ)Verification
python3 tests/test_evolution.pypython3 tests/test_validate.pypython3 scripts/validate.pygit diff --checkFound by the installed scheduled Claude double-check on rolling PR #6: repeated same-day runs overwrote the 2026-07-22 ledger/summary, leaving the automatically added PR-8934 page without its original include record and making per-run budgets unauditable.
Summary by Sourcery
Introduce immutable, per-run evolution refresh provenance keyed by a UTC run identifier and thread that identifier through discovery, refresh, daily worker, and summaries.
New Features:
Bug Fixes:
Enhancements:
Tests: