Repository navigation
3.x.x: complete pool checkout timing and guard its coverage - #457
Conversation
Time partition maintenance and fallback checkouts plus candidate heartbeat reads at the existing checkout boundary. Add a reviewed source census, CI guard, negative controls and focused PostgreSQL coverage while preserving wrappers and deadlines. Refs #352
Use the existing FixtureDatabase helper so concurrent API fixtures do not contend on database-scoped migration keys. Preserve API assertions and timeout budgets, keep cleanup on failure or cancellation, and abort the mock RPC task when its fixture is dropped. Add a regression that holds one fixture migration lock while opening another, and register its required integration execution.
Include rollup and share-partition acquisitions in metric and alert coverage, replace stale partial-coverage claims with the source census and explicit exclusions, and regenerate the inventory, migration table and alert patch. Alert expressions, thresholds and deployment gates are unchanged.
Final review closeout — e4ba3c4Merge recommendation: ready for This used the approved proportional review path for instrumentation: one independent Opus correctness/coverage review at Findings and dispositions
The independent reviewer found no required runtime correctness, authority or availability defect, independently checked all production modules against the census, compiled all targets, and passed the 14 scanner tests. It did not run the PostgreSQL tests and does not claim to have done so. The final coordinator delta check confirmed use of the existing cleanup helper, preservation of the original test errors and timeouts, the new isolation regression/gate registration, and documentation-only semantic changes. Zero required findings remain. This supplies #352's closing coverage/guard evidence; issue closure should follow the merge, not precede it. No claim is made that excluded pools are timed. |
The census guard added by #457 requires every fresh pool checkout in the production module graph to carry an exact classification. The signing-transition transaction begins through Ledger::begin like policy-transition does, so it takes the same delegated ledger policy. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Resolves server.rs: the Stratum binds stay above Coordinator::new (#460) and the partition-lead precondition keeps #457's ensure_with_metrics call. Co-Authored-By: Claude Fable 5.1 <[email protected]>
…otation (#461 S-B) (#464) * Add migration 019, the signing-key rotation journal Signing-key rotation resets the pinned cluster fingerprint, and today the rehearsal does that by hand with nothing recording it. Migration 019 adds qbit_prism_signing_transitions: an immutable journal (trigger like 014's) that keeps the retired fingerprint, the retired policy document with both old public keys, every instance row with its measured heartbeat age and the freshness window applied, and the unchanged payout revision. It is additive and declares no capability: a binary that does not know the table never reads or writes it, so a 2.x.x or 3.x.x frontend that predates it keeps working. The rest is the mechanical registration a new migration needs: REQUIRED_SCHEMA_VERSIONS, NATIVE_MIGRATIONS and the migrate_schema apply block in migration.rs (mirroring 014: plain, no shutdown proof); the verbatim version lists and messages the tests assert in offer_lifecycle, ledger_2x, index_trim and session_sequence; the pre-006 historical fixture in ledger_2x, which undoes 019 together with 014; the required_versions array in the recovery evidence script; and the migration note in the migration guide. No behaviour beyond knowing 019. Co-Authored-By: Claude Fable 5.1 <[email protected]> * Add the signing-transition command D4 accepted signing keys on every frontend on condition that a rotation is rehearsed before cutover. Ledger::configure already treats a NULL cluster fingerprint as a rotation and refuses to pin over unfinished candidates signed with other keys, but nothing sets the fingerprint to NULL except an operator's hand-written UPDATE, with no guard and no record. `qbit-prism-server signing-transition --confirm` is that reset. Everything is decided and written in one transaction that holds the settlement and order advisory locks, the instance registration lock and the cluster row FOR UPDATE, the same row lock configure takes and every candidate writer reads FOR SHARE, so a concurrent startup or write serialises behind it and then sees the reset. It refuses a halted cluster (fatal-state clear compares the pinned fingerprint, so the halt must be cleared first), a pinned fingerprint that is not the invoking configuration's (the journal must record the keys being retired), any frontend whose row is not `stopped` unless its heartbeat is older, by the database clock, than the freshness window self-check derives from PRISM_HEALTH_REFRESH_SECONDS (a killed frontend never writes `stopped`; an unreadable status or a future-dated heartbeat is unknown and counts as live), and any unfinished block candidate whatever keys it carries, which is stricter than configure's other-keys test. A fingerprint that is already NULL is reported with the last journal row and nothing is written, so a lost commit response is resolved by running again. One 120-second deadline covers the node calls, the lock waits and the transaction; the reset statement runs before the journal insert so any failure rolls both back. Without --confirm the command prints what it would check and do, reads neither its configuration nor the database, and exits non-zero. The invoking configuration is resolved exactly as startup and policy-transition resolve it, by calling policy_transition's resolved_policy; that function's visibility changes from private to pub(super) and nothing else in policy_transition.rs changes, so policy-transition keeps refusing key changes. Multi-epoch verification stays deferred: the journal's previous_policy is its anchor. Co-Authored-By: Claude Fable 5.1 <[email protected]> * Test the signing-key rotation reset Gated tests for signing-transition against a disposable PostgreSQL, each fixture in its own database because the command holds the database-scoped settlement and order advisory locks. The killed frontend is a real health heartbeat never followed by `stopped`, aged by one UPDATE of heartbeat_at rather than a sleep. Refusals: a fresh `starting` or `running` heartbeat, an unreadable status, a future-dated heartbeat, both frontends named when both are live; a killed frontend refuses at ages 0 and 14 seconds and, with PRISM_HEALTH_REFRESH_SECONDS=20, still at 16, then proceeds at 16 under the default window, through the CLI and its real environment reader; a `pending` candidate, and `offer_reserved`, `offered` and `reconciliation` rows whose keys equal the invoking configuration's, which configure itself accepts; a halted cluster; the new-key environment. Effects: the journal row with the old fingerprint, both old public keys, the instance rows with their measured ages and the unchanged payout revision; the first new-key configure pins; old-key configure and old-environment reruns are then refused; the journal is immutable; an old-key start after the reset re-pins and the reset can be repeated. Concurrency: the command waits on a holder of the cluster row and judges what that holder committed; held at its journal write after every check has passed, neither a heartbeat nor a configure can land before its commit; an injected journal failure after the reset statement rolls the fingerprint back and releases the locks. Without --confirm nothing is read or changed, even with an empty environment. Under the three review mutants each fails as intended: a commit between the checks and the reset fails the held-at-journal test; a status-only liveness rule fails the killed-frontend test; ignoring offered rows fails the same-keys test. The successful CLI run prints its wall clock under --nocapture for the rotation rehearsal to compare against. Co-Authored-By: Claude Fable 5.1 <[email protected]> * Document signing-key rotation The ledger operations guide said signing-key rotation was deferred. It now has a command, so the guide gets a "Signing-key rotation" section: what signing-transition checks and writes and under which locks, the step-by-step procedure with the old-key environment, the freshness rule a killed frontend is judged by, that the first configure after the reset pins whatever keys it brings (an old-key start undoes the rotation safely and the command can be rerun), that pre-rotation bundles verify only with the old public keys the journal keeps, and that backfill-ctv and import-audits must not run with the new key against them. Multi-epoch verification remains deferred and is said so. It also records the one exposure the command shares with the by-hand reset: the fatal-state writers are not fenced on the fingerprint, so a partitioned-but-alive old frontend, indistinguishable from a killed one once its heartbeat is stale, could halt the cluster while the fingerprint is unset, when neither fatal-state clear nor any startup can proceed. The recovery (restore previous_fingerprint from the journal row, clear with the old keys, rerun) is written down, and the command's halted refusal points at it. Co-Authored-By: Claude Fable 5.1 <[email protected]> * Say what bounds a signing-transition lock wait The deadline comment and the operations guide said one 120-second deadline covers every lock wait. It does not: the operator connection sets lock_timeout from PRISM_DATABASE_LOCK_TIMEOUT_MS (5 seconds by default) and a 15-second statement timeout, so a contended cluster row, instance table or advisory lock ends the command after about five seconds with "canceling statement due to lock timeout". That is safe, it is before COMMIT and rolls back, but the guidance was wrong. Both now say that 120 seconds is the ceiling for the whole command, what bounds a single wait and a single statement, and that a lock timeout means something still holds the row or the locks, which is what a running frontend or tool does: confirm everything is stopped and rerun rather than raising the timeout blindly. The command attaches the same advice to a lock_not_available failure; nothing else about its behaviour changes. A test holds the cluster row, runs the CLI with a 200 ms lock timeout, and checks the message, that nothing changed, and that the same command then succeeds. The guide's rerun sentence also states its assumption: reporting the journal row after an ambiguous commit relies on nothing having pinned a fingerprint in between, which is why restarts stay disabled until the new-key frontends start; if an old-key process did start, the rerun refuses while it is live and otherwise resets a second time. Co-Authored-By: Claude Fable 5.1 <[email protected]> * Classify the signing-transition checkout in the pool-acquire inventory The census guard added by #457 requires every fresh pool checkout in the production module graph to carry an exact classification. The signing-transition transaction begins through Ledger::begin like policy-transition does, so it takes the same delegated ledger policy. Co-Authored-By: Claude Fable 5.1 <[email protected]> --------- Co-authored-by: Claude Fable 5.1 <[email protected]>
Summary
Completes run-role database checkout timing and adds a checked source inventory so new untimed acquisition sites cannot silently appear.
Refs #352. This is the consolidated final coverage candidate; close the issue only after review and CI establish its closing criteria.
Validation
Author's local qualification on disposable PostgreSQL 16:
Commands:
Database tests ran with integration required and an execution manifest, not as environment-skipped passes. Raw build/test artifacts are not committed.
Review and scope
Independent focused review and hosted CI are pending; this description does not claim merge readiness. Review targets are timeout/cancellation equivalence, checkout-only measurement, and whether the census detects real unclassified production sites without hiding them as test code.
No payout-rule, mining-algorithm, schema, VERSION, CHANGELOG or CI workflow changes. Target:
3.x.x.Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.