Repository navigation
3.x.x: Close the four needs-triage rows of the deleted-test map with native tests (#460) - #465
Merged
Merged
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
kiwidream
force-pushed
the
map-gaps-460-evidence
branch
from
September 22, 2026 19:34
a97f779 to
8c57849
Compare
The payout window's difficulty multiplier has one value, qbit_prism::PRISM_WINDOW_MULTIPLIER, but several spellings: the dashboard query files and the shipped schema bake it in as a SQL literal, the archive horizon spells it in inline SQL, and two read models render it into JSON. Nothing tied those copies together, so raising the multiplier could leave a dashboard or the audit window view scaling by the old value. The new test enumerates the literals across the server's Rust and SQL sources and the shipped schema, asserts each equals the constant — listing every disagreeing site in one failure rather than stopping at the first — and asserts the discovered site set is exactly the expected one, so a new spelling, or a site the scanner stops recognising, fails with a message telling the author to derive it from the constant or extend the list. A scanner that matches nothing fails too. The frozen 2.x schema fixture and the rollback scripts are outside the scanned roots. Closes one needs-triage row of docs/prism-deleted-test-map.md (#460). Co-Authored-By: Claude Opus 5 <[email protected]>
Landing an offered block whose as-issued prior balances are no longer the canonical ones is allowed — the node has or may have the block — but it is reported. The refusal, the marker and the additive balances were covered; the warning itself was not, so it could have been dropped silently. The new test moves the canonical balances the way production moves them: a second block of the same window lands, is confirmed, and its carry rows accrue a below-floor account, so `SUM(gross - onchain)` shifts. Landing the held claim on those moved balances must raise exactly one WARN naming the block, its lifecycle state and both digests, and the same test holds the landing to the rest of its contract — the provenance marker records the audit that was issued, the carry rows keep the as-issued priors rather than the moved ones, and the integrity validator stays clean — so the test cannot pass on the warning alone. A control with no mover asserts the marker is written anyway and no alert is raised. The subscriber is attached to the landing future alone, never installed globally, because this binary runs many tests. Closes one needs-triage row of docs/prism-deleted-test-map.md (#460). Co-Authored-By: Claude Opus 5 <[email protected]>
`materialize_audit_row` hands its permit to the blocking job rather than holding it in the caller's future, because Tokio keeps running a queued job after the future that awaited it is dropped. Nothing proved that. Three gated tests drive the function directly, each on a runtime with a single blocking thread the test parks, so ordering is a fact and no assertion reads a clock: - a caller dropped after its job is queued does not release the permit; it comes back only once the released thread has run the job; - a second caller waiting on the same one-permit semaphore reaches no statement of its own until that job ends, and both rows then hydrate to the signed body and its declared canonical digest; - EP-ERRORS: a digest mismatch inside the job returns the permit when the job ends and not before, while a missing snapshot row and a cancellation on the first statement return it with the future. Row 216 of the deleted-test map moves from `needs triage` to `partial`: the permit bound is the property now covered, and the bounded audit-body read the retired Python streaming view asserted is not, since `materialize_audit_row` still hydrates the whole share array. Co-Authored-By: Claude Opus 5 <[email protected]>
Integration edits on top of the #460 R1, R2 and R3 tests: the multiplier scanner also walks crates/qbit-prism-server/migrations/, so a migration that redefines the window view cannot add a copy unnoticed; row 216 states what the permit tests do not observe (the job holding its permit for its whole duration); the summary counts and the "Needs triage" section follow the rows that left it. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Move the primary Stratum bind, its "PRISM listening" line and the high difficulty bind above Coordinator::new. Coordinator startup registers the instance with a `starting` row and nothing retracts it when run returns an error, so a restart that lost the bind race to its predecessor left a row behind that `fatal-state clear` refuses on. Every fallible step before Coordinator::new now touches only configuration and sockets. The log line's instance and worker fields come from the Config before it moves into the coordinator; their values are unchanged. The audit HTTP listener still binds after Coordinator::new because it serves the coordinator's ledger through ApiState. Co-Authored-By: Claude Opus 5 <[email protected]>
Add a gated target that runs the real server binary against a fake node and a database of its own, and proves what the bind order buys. A restart whose primary or high difficulty port is still held by its predecessor exits with the bind error and code 1, and qbit_prism_instances stays empty, so nothing is left for `fatal-state clear` to refuse; the next start on a free port serves and stops cleanly. While the node holds the chain check inside Coordinator::new, the announced primary address already accepts a connection and the instance is still unregistered. The high difficulty listener is bound when, and only when, its port is configured. Not covered, and named in the map row: bind retry against a draining predecessor, retry abort on shutdown and zero-retry fail-fast, which native `run` has no subject for, and port release on a shutdown during the node readiness wait, which needs a signal handler that does not exist yet. Co-Authored-By: Claude Opus 5 <[email protected]>
… drop the duplicated partition attach
…ow instead of the closed #267
kiwidream
force-pushed
the
map-gaps-460-evidence
branch
from
September 22, 2026 20:20
8c57849 to
01db13f
Compare
35 of 36 tasks
…dent_2_ack_latency)
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.
Closes #460 (merge keywords do not fire on
3.x.x; close by hand once merged).Four
needs triagerows ofdocs/prism-deleted-test-map.mdhad no issue and no native test. This adds the tests, corrects the rows, and makes one production change the R4 tests exist to pin.R1 — window multiplier (row 64 → full)
tests/window_multiplier_invariant.rs::every_window_multiplier_literal_matches_the_constantenumerates every literal spelling ofPRISM_WINDOW_MULTIPLIERundercrates/qbit-prism-server/src/**,migrations/andcrates/qbit-prism/sql/*.sql— 12 sites in 7 files, including inline SQL inledger/archive.rsand the read models inapi/public.rs/api/read_models.rsthat the issue did not list — pins each to the constant, reports every disagreeing site at once, and fails when the site set changes. A bound parameter derived from the constant would retire the SQL literals; that is a note for Workstream B, not this PR.R2 — prior-balance divergence at landing (row 65 → partial)
The row was stale twice: the landing compares a 32-byte digest, not rows, and the changed-amount case was already covered by
offer_lifecycle.rs::pending_divergent_landing_refuses_while_the_post_offer_landing_succeedsandcoordinator/window_switch_tests.rs::a_parent_landing_late_diverges_the_child_which_lands_as_issued_with_additive_balances. What nothing asserted was theALERTwarning.offer_lifecycle.rs::a_divergent_offered_landing_warns_with_both_digests_and_keeps_its_as_issued_accountsmoves the balances the way production does — a second candidate lands and is confirmed between the victim's issue and landing — then asserts the one WARN with its four fields and the provenance marker, the as-issued carry priors and a clean integrity report in the same test;::an_undisturbed_offered_landing_is_marked_without_a_divergence_alertis the control. The bech32 relabel half has no native subject.R3 — audit reconstruction permit (row 216 → partial)
tests/audit_reconstruction_permit.rsdrivesmaterialize_audit_rowwith permits from a one-permit semaphore on a runtime whose single blocking thread the test parks, so ordering is a fact rather than a timing: a dropped caller does not release the permit its queued job holds; a second reconstruction waits and both rows hydrate; failure inside the job, failure before it and cancellation each release exactly once. No memory or duration assertion. Not covered: the bounded audit-body read itself (#267, post-GA) and that the job holds the permit for its whole duration.R4 — Stratum bind order on restart (row 239 → partial)
Production change (
Bind Stratum listeners before coordinator startup, decision recorded on #460): both Stratum binds move aboveCoordinator::new.Coordinator::newwrites thestartinginstance row and nothing retracts it on a later bind error, whilefatal-state clearrefuses on any row that is notdrained/stoppedwith no staleness allowance — so a restart that lost the bind race left a row an operator had to delete by hand.tests/stratum_restart_bind.rs(real binary, fake node in the parent, database per fixture) asserts: a held primary or high-difficulty port fails startup with the bind error and no instance row, and the next start on a free port serves; listeners accept a connection while the node still holdsgetblockchaininfo; the high-difficulty listener is present or absent perPRISM_STRATUM_HIGHDIFF_PORT. Not covered, follow-ups with no issue yet: the 2.x.x bind retry (nativerunbinds once) and port release on SIGTERM during the readiness wait (no signal handler exists until every task is spawned).Map bookkeeping
Rows 64, 65, 216, 239 rewritten; their lines dropped from
## Needs triage; summary counts5/69/5/7/56 → 6/72/5/3/56. #455 rewrites the rest of the file — whichever lands second rebases.Verification
cargo fmt --all --check,cargo clippy --locked --workspace --all-targets -- -D warnings,check_gate_env_reads.py,check_prism_settings.py,check_toolchain_pin.py;test/prism-gated-tests.txtsorted with all 11 new ids, eachexecutedin the gate manifest. Suites on the integrated tree:window_multiplier_invariant1/1,offer_lifecycle21/21,audit_reconstruction_permit3/3,stratum_restart_bind5/5 (also 5 sequential + 3 concurrent runs, no port collisions),candidate_storm_restart2/2,self_check_cli5/5. Mutation checks, each restored: a* 9indashboard_reward_leaderboard.sqland inarchive.rs(named in one failure); the pending fence removed; the provenance marker written as NULL (fails on the marker assertion, not only the warning); the permit dropped with the caller; the bind order reverted (fails on the leftoverstartingrow); the high-difficulty bind skipped.🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.