harness+contracts: pin the oracle's claims, derive the proof-type registry - #91
Conversation
…istry Test harness (internal/testutil): - The convergence oracle runs both symmetric-difference directions and both row counts inside one read-only REPEATABLE READ transaction, so a divergence report describes a single instant instead of three snapshots. Converged is now the absence of differences; the counts are diagnostic. - EXCEPT replaces EXCEPT ALL: the primary key is always projected, so rows are distinct and duplicate semantics never applied. Ignoring the primary key is refused with an explicit error. - The integration test seeds cross-category column types (numeric vs integer, text vs varchar) so the ::text cast is exercised: dropping the cast fails the test. A 25-row divergence pins DifferenceLimit to the literal ids 1..20 in each direction. - AssertConverged takes its context from t.Context() like the rest of the harness. - LoadSpec is validated up front (workers, rate, mix weights, fractions) and StartLoad fails the test on an invalid spec instead of silently running nothing. Stop always returns the summary and joins the worker error with the deadline error. Expected serialization races are counted in Summary.Races and the load test asserts they stay below the commit count, so the FOR UPDATE choice is observable rather than asserted. Unit tests cover validation, the deadline path, and the clean-finish path. Contracts: - The proof-type registry check moves out of pkg/preflight into a repository-wide test (internal/safety) that derives the set of proof types from the code by shape: exported struct, all fields unexported, doc opens "<Name> proves". SAFETY.md, the review checklist, and the TCB model must each name every derived type; sentinels guard against a vacuous walk. The derived set surfaced preflight.PrivilegedRole, which no registry listed; all three now do. - copier.Chunk and copier.Watermark hold their bounds in unexported fields behind accessors, so a chunk cannot be reshaped after the chunker mints it. - checkpoint.Phase is documented as an opaque label that is never compared for order, and gains Terminal(). - preflight.OwnerRole's doc states what it proves: the SET ROLE target for owner-correct shadow objects, verified as SET-usable membership. - docs/testing.md describes the single-snapshot oracle and the primary-key rule.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
🤖 Review 1/2 — the convergence oracle ( Taking a post-merge review and turning the three findings that change what the harness proves into a PR is the right call, and the single-snapshot fix is the right shape: one read-only Baseline:
|
|
🤖 Review 2/2 — the derived registry, the load generator, and the contracts Deriving the proof-type set from code and moving the guard to The change that breaks the safety property is the change that hides the type from the guard (med)
So the guard covers "someone adds a proof type and forgets a registry" and misses "someone stops a type from being a proof type." The second is the one that costs something. The cheap closure is the reverse direction: assert that every proof type each registry names is in the derived set. Running that reverse check found a phantom immediately:
Two smaller notes on the same test:
The registry guard is still switched off for the PRs that only touch prose (med)
The move to Related, since both are open: #88 also rewrites the
|
aparajon
left a comment
There was a problem hiding this comment.
🤖 Approving. Deriving the proof-type set from code and wrapping the oracle in a single read-only REPEATABLE READ snapshot are both the right shape, and the guard earned its place by finding PrivilegedRole missing from all three registries on its first run. Findings are in the two review comments; the one blocking item is the Converged() premise — a 3-row source against a 2-row shadow now reports converged, because the distinctness the doc relies on is introspected on the shadow only. A few lines either way.
This stamp was left by Claude Code (claude-opus-5).
…ays, pin the race counter - statement.Statement and statement.DesiredSchema now carry the "<Name> proves" doc shape SAFETY.md prescribes, so the derived proof-type walk finds them; SAFETY.md, the review checklist, and the TCB model each name both. The review checklist's list is package-qualified throughout and names the type that exists. - The registry test also walks the reverse direction: every code-font `pkg.Name` in a registry whose package lives under pkg/ must be an identifier that package exports, so a list entry that outlives its type fails the test. A unit test pins the mention shapes that must and must not resolve. - A delete-only load run on a two-row table commits exactly twice and then counts every later tick as a vanished-row race; the test fails when the counter stops incrementing. - The convergence oracle test adds a shadow-only row and deletes a source row, asserting each skew surfaces as a one-directional key set with the counts it implies.
|
🤖 Review response — created by Kiran's code review agent (Amp, Claude Opus 4.6) — pull/91, follow-up commit Review addressed:
|
Follow-up to #87: the convergence oracle reads one snapshot, the load generator validates its spec and reports its races, and the proof-type registry is derived from the code instead of maintained by hand.
Why
The review of #87 landed after the merge. Three of its findings change what the harness proves rather than how it reads: the oracle ran its two symmetric differences and two counts in separate statements, so a divergence report could describe three different instants;
StartLoadaccepted a spec with zero workers or weights summing past one and ran nothing while the test went green; and the proof-type registry inpkg/preflightwas a hand-typed list, so a new proof type that nobody added to it (which is howPrivilegedRolewas missing from SAFETY.md) passed every check.What
internal/testutilconvergence oracle: bothEXCEPTdirections and both counts run inside one read-onlyREPEATABLE READtransaction.EXCEPTreplacesEXCEPT ALLbecause the primary key is always projected, so rows are distinct; ignoring the primary key is refused. Converged is the absence of differences; counts are diagnostic. The integration test seeds cross-category column types so dropping the::textcast fails, and a 25-row divergence pinsDifferenceLimitto the literal ids in each direction.AssertConvergedtakest.Context().internal/testutilload generator:LoadSpecis validated up front andStartLoadfails the test on an invalid spec.Stopalways returns the summary and joins the worker error with the deadline error. Expected serialization races are counted inSummary.Races, and the load test asserts they stay below the commit count so theFOR UPDATEchoice is observable.internal/safety: a repository-wide test derives the proof-type set by shape (exported struct, all fields unexported, doc opens "<Name>proves") and requires SAFETY.md, the review checklist and the TCB model to each name every derived type, with sentinels guarding against a vacuous walk.preflight.PrivilegedRoleis now listed in all three.copier.Chunkandcopier.Watermarkhold their bounds in unexported fields behind accessors so a chunk cannot be reshaped after the chunker mints it;checkpoint.Phaseis documented as an opaque label and gainsTerminal();preflight.OwnerRolestates what it proves.docs/testing.mddescribes the single-snapshot oracle and the primary-key rule.Before / after