Repository navigation
fix(build): Gate the cold build on a frozen wanted-source receipt - #5379
Conversation
polylogue-co2iz AC3 requires the final rebuild preflight to accept only a complete, valid receipt and never silently fresh-walk ambient source roots. `require_rebuild_preflight` has owned that check since #5304, but its only production caller was the operator CLI (cli/commands/maintenance/_wanted_sources.py). `ColdBuildGeneration.begin` -- the actual final-build driver -- called only `require_candidate_capacity`, so a cold build could start with no frozen denominator at all. Authorization now runs before allocation and before the capacity walk, because its refusal means "this build must not happen" rather than "not here, not now". Like the capacity preflight it is not conditioned on operator intent: the build engages automatically whenever the active generation is empty, which is exactly the unattended whole-archive case that must not run unauthorized. It is conditioned on a denominator existing at all, which is a different question. `build_wanted_source_receipt` itself refuses an empty denominator, so requiring a receipt where no source is declared would make every live-capture-only archive permanently unbuildable. That bootstrap path emits `daemon.cold_build.wanted_sources_undeclared` and is pinned by a test, so it is declared rather than silent. Once a receipt *is* published it validates unconditionally, even if the roots were later undeclared: a frozen denominator the current configuration no longer matches is a typed refusal, never a downgrade. `wanted_source_receipt_is_published` exists to separate "there is no receipt" from "the receipt is tampered", which `load_wanted_source_receipt` reports through one exception type. The refusal names both the defect and the single command that produces a receipt. No branch falls back to walking source roots fresh. Verification (exit codes read directly, not through a filter): devtools test tests/unit/sources/test_cold_build_generation.py \ tests/unit/maintenance/test_source_manifest_continuity.py -> PASSED exit=0, receipt .cache/verify/runs/20260922T010507Z-focused-test-224388-d3e0f78c/run.json devtools gate schema-closure -> ok, 557 members, none added or removed Schema identity: cold_build.py and source_manifest_continuity.py are both closure IN, so the derived index identity moves d5e285b3.. -> 7cb86235..; ops is unchanged at 86866235... Closure *membership* is unchanged, so no baseline update is required. This must land before a fresh rebuild starts, never during one. Residual, not addressed here: the live host currently declares no source roots (`resolve_runtime_config().source_paths.explicit == ()`), so on that archive this guard takes the declared bootstrap path. Declaring the roots and freezing the receipt against the fresh root is an operator action, and co2iz stays open for it. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01ToWqpkXotr573DiQex5vcy
|
Warning Review limit reachedNext included review available in 26 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (3)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codex Review SummaryThis 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: d52028a6f2
ℹ️ 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".
Summary
polylogue-co2izAC3 requires the final rebuild preflight to accept only a complete, valid receipt and never silently fresh-walk ambient source roots. The check existed; the build driver never called it.Problem (evidence at
158d1363e)require_rebuild_preflight(maintenance/source_manifest_continuity.py:664, real entrypreflight_rebuildat:641) has owned this since #5304. Its complete production caller set was one CLI command —cli/commands/maintenance/_wanted_sources.py:103,138.ColdBuildGeneration.begin— the actual final-build driver — called onlyrequire_candidate_capacity(sources/live/cold_build.py:120). So a cold build could start with no frozen denominator at all, and the rebuild's conservation proof would have nothing fixed to reconcile against.Solution
Authorization runs before allocation and before the capacity walk, because its refusal means "this build must not happen" rather than "not here, not now".
Like the capacity preflight, it is not conditioned on operator intent — the docstring at
cold_build.py:97-102already settles that: the build engages automatically whenever the active generation is empty, which is exactly the unattended whole-archive case that must not run unauthorized.It is conditioned on a denominator existing at all, which is a different question.
build_wanted_source_receiptitself refuses an empty denominator, so requiring a receipt where no source is declared would make every live-capture-only archive permanently unbuildable. That bootstrap path emitsdaemon.cold_build.wanted_sources_undeclaredand is pinned by a test — declared, not silent. Once a receipt is published it validates unconditionally even if the roots were later undeclared: a frozen denominator the current configuration no longer matches is a typed refusal, never a downgrade.wanted_source_receipt_is_publishedexists to separate "there is no receipt" from "the receipt is tampered", whichload_wanted_source_receiptreports through one exception type. No branch falls back to walking source roots fresh.Verification
Exit codes read directly, not through a filter.
Four tests: refuse-unfrozen, refuse-tampered, authorize-valid, and the undeclared bootstrap path — the last pinning the opposite direction so "refuse everything" fails.
Schema identity
cold_build.pyandsource_manifest_continuity.pyare both closure IN, so the derived index identity movesd5e285b3… → 7cb86235…; ops is unchanged at86866235…. Closure membership is unchanged (557 both sides), so no baseline update is required. This must land before a fresh rebuild starts, never during one.Residual
The live host currently declares no source roots (
resolve_runtime_config().source_paths.explicit == ()), so on that archive this guard takes the declared bootstrap path. Declaring the roots and freezing the receipt against the fresh root is an operator action, andco2izstays open for it — this PR closes AC3's code half only.🤖 Generated with Claude Code
https://claude.ai/code/session_01ToWqpkXotr573DiQex5vcy