Skip to content

Add candidate, integrate and promote commands for generated cases (operator audits step 5, slice 6) - #4557

Open
evanchooly wants to merge 1 commit into
audits-publisherfrom
audits-candidates
Open

evanchooly wants to merge 1 commit into
audits-publisherfrom
audits-candidates

Conversation

@evanchooly

Copy link
Copy Markdown
Member

Step 5, slice 6 of the operator audits (design). Stacked on #4556.

Problem

Regenerated files have reached the tree through ad hoc steps: convert, rescenario and hand-run regeneration scripts. Nothing checked that a regeneration still passes before it lands, or that the checkout it lands in is the one it was generated from. The design calls for one guarded path instead:

  • generate a candidate without touching the checkout;
  • integrate it in an isolated worktree under both mappers;
  • promote it only into a checkout that still matches its base, atomically.

Changes

  • candidate regenerates every ledger scenario and the manifest into an output directory, never the checkout. candidate.json records:

    • the base revision and the manifest's digest;
    • the generator and schema versions;
    • the SHA-256 of every file it writes, deletes (generated by the current manifest and no longer) or protects.
  • integrate stages the candidate in a temporary worktree at its base, builds core, and runs the tests owning its cases under Critter, then reflection. It writes an attestation bound to the candidate's digest and always removes the worktree.

  • promote applies an attested candidate. It refuses:

    • a checkout that moved on: its revision, its manifest digest, or a protected file, including uncommitted edits;
    • a failed attestation, or one for another candidate;
    • a stale file edited since it was recorded;
    • a file the manifest doesn't own at a path the candidate writes, which is a conflict rather than something to overwrite.

    Everything is applied together, and every original is restored on any failure.

  • Tests: CandidatesTest has 5 cases covering determinism, agreement with the committed tree, promotion, each refusal, rollback, and integration with a fake runner.

End-to-end run

I ran all three commands on this branch's checkout. The candidate matched the committed tree, integration passed 442 tests under each mapper in a temporary worktree, and promotion applied with no change to any tracked file. That run found a bug the unit tests missed: the attestation's computed passed property was written to JSON and couldn't be read back. It's now a function, and the test round-trips an attestation.

Review note

The independent local reviewer is at its weekly limit until Nov 26, and Codex and Copilot are out of quota, so I reviewed this myself.

A candidate regenerates the operator-case namespace outside the checkout
and records its base and every file's hash. Integration runs the owning
tests in a temporary worktree under both mappers and writes an
attestation; promotion applies an attested candidate only to a checkout
that still matches its base, atomically.

This branch has not been deployed

No deployments
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