Skip to content

3.x.x: bound refresh snapshot payload reads - #466

Merged
djh58 merged 4 commits into
3.x.xfrom
djh58/prism-b275-delta-read
Sep 21, 2026
Merged

djh58 merged 4 commits into
3.x.xfrom
djh58/prism-b275-delta-read

Conversation

@djh58

@djh58 djh58 commented Sep 18, 2026 •

Copy link
Copy Markdown
Member

Fresh payout revisions, balance changes and reanchors can reuse exclusively owned share payloads, read one bounded page of appended shares, and trim with the existing weight rule. Each acquisition still reads fresh anchor, cutoff, balances and revision and preserves the existing publication and cancellation checks.

The runtime witness now includes the current WAL insertion timeline alongside the live partition incarnation and eligible-row count. Supported asynchronous promotion therefore invalidates retained rows even when physical replication preserves OID, catalog incarnation, count and the newest row. The proof follows the existing single-standby D3 promotion/rejoin and stopped-frontend D5 recovery boundaries; timeline numbers are not globally unique across independent sibling copies.

  • Real PostgreSQL regressions cover suffix and interior replacement, the same frontend pool reconnecting across promotion, verified rewind and base-backup rejoin followed by re-promotion, healthy pool rotation/reconnect, and exact Snapshot/WindowRef equivalence to the full reader.
  • Final-source validation: all 10 focused history tests and 27 existing coordinator regressions pass; all 37 registered gates executed. Workspace all-target Clippy with warnings denied, formatting and source census checks pass.
  • Fresh release binaries at the normal pool size of 16, one frontend, 2,000 sessions and 400k shares: four balanced AB/BA pairs show a 937ms median paired last-client improvement (34.66%). This exceeds the predeclared 100ms/5% gate and A/A noise of 32ms/1.18%. Separate base/candidate medians are 2.704s and 1.771s.
  • All 32,000 received identities across 16 cases reconcile to durable children, with no unmatched rows, delivery errors, supervisor stops or residual schemas. The original 30.11% result belongs to the superseded binary and is not used for this repair.

Refs #275. Every 400k case still misses one second. This does not establish production eligibility rates, 500k or two-frontend performance, real-network results, or a memory soak. Metadata counting remains O(window), and fallback latency has not been separately requalified for the timeline repair.

The qualification report records the matched observations, binary provenance and limits; the acquisition contract explains the existing supported-history boundary. Independent repair-delta verification and exact-head CI/Bugbot are complete. The final review ledger records 5 fixed, 14 rebutted/declined suggestions, and zero open required findings. Merge-ready at the pinned head; reaching one second remains separate #275 work. No merge or deployment has been performed.

Move an exclusively retained suffix into fresh ledger acquisition, validate
single-leaf incarnation and complete eligible membership, and read only a
bounded appended page before trimming. Preserve hashes, authority and
cancellation admission, with conservative full-read fallback.

Add same-anchor PostgreSQL differential and cancellation coverage plus the
400k paired qualification record. Median last-client latency improves
30.11% in the measured one-frontend workload; the one-second goal remains
unmet and partition-crossing fallback overhead remains explicit.

Refs #275

Co-Authored-By: OpenAI Codex <[email protected]>
@blacksmith-sh

This comment has been minimized.

The checkout census enrolls calls named advance because the rollup helper
accepts a pool. Snapshot delta advance instead receives the existing
transaction, so classify this exact call under the borrowed policy without
changing any checkout, timer or scanner rule.

The real-source gate and all 14 guard tests, including negative controls,
pass after reproducing the unclassified-call failure.

Refs #275

Co-Authored-By: OpenAI Codex <[email protected]>
@djh58

djh58 commented Sep 18, 2026

Copy link
Copy Markdown
Member Author

@cursor review

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

@djh58

djh58 commented Sep 18, 2026 •

Copy link
Copy Markdown
Member Author

Review update for 230e53608f4dc5707fb93d9819b333d2da968458: a native PostgreSQL physical-backup/promotion regression confirms that asynchronous history loss followed by sequence reuse can preserve the partition witness and eligible count while replacing retained share payloads. The fresh delta snapshot then differs from a full read at the same anchor; this is a blocking correctness issue in the current head.

A second physical case keeps the entire newest share unchanged while replacing an interior fixture row, so checking only the newest row is insufficient. A conservative session-based prototype passed 11 focused PostgreSQL tests, including full-reader authentication after both physical replacements, but its matched 400k screening pair showed no useful gain: base 2.909416534 seconds versus candidate 2.912040278 seconds. Both cases reconciled all 2,000 durable identities and missed one second; this single screening pair is not the required balanced-pair median qualification.

The rejected prototype has been preserved separately and the checkout restored to the unchanged published head. No repair was committed or pushed, and the required history-fence and documentation findings remain open. A sufficient bounded repair and fresh qualification are still required before this PR can be considered ready.

@djh58

djh58 commented Sep 21, 2026

Copy link
Copy Markdown
Member Author

Repair checkpoint at 326a88c: the insertion-timeline witness and physical PostgreSQL promotion/rejoin regressions are now pushed. The author reports 37 targeted tests plus workspace Clippy passing. Matched pool16, 400k-share/2,000-session qualification has four balanced pairs: baseline median 2.704 s versus candidate 1.771 s, median paired improvement 937 ms / 34.66%, versus 32 ms A/A noise. All 32,000 measured job identities reconcile; every large case still misses the one-second target.

Independent Fable delta verification is now running on this exact head, specifically challenging the history proof against the existing D3/D5 procedures, interior-replacement and re-promotion tests, and benchmark provenance. The prior four review lanes remain attributed to their original head; this is targeted verification of the repair, not a claim they reviewed new code. The two prior required findings remain pending independent disposition, and current-head CI is still running. Not yet merge-ready.

@djh58

djh58 commented Sep 21, 2026

Copy link
Copy Markdown
Member Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 326a88c. Configure here.

@djh58

djh58 commented Sep 21, 2026

Copy link
Copy Markdown
Member Author

Final deep-review closeout — merge-ready

Pinned head: 326a88cc58d6811408c39e5c05901da074bbf071, base d78659de608ad30645ba630f15eb8be998b3e42a (3.x.x). High-stakes: retained share payloads feed payout construction. 5 findings fixed, 14 rebutted/declined suggestions, 0 deferred, 0 open required findings. No merge or deployment performed.

Review coverage and evidence

  • Medium, structural/thermo, Sol adversarial and Fable adversarial lanes completed on prior head 230e536; their findings are carried forward, not represented as four new-head passes.
  • Independent Fable repair-delta verification completed on the pinned head: no refutation found. It rebuilt the old runtime and reproduced both physical-history failures (0/2 pass), then independently passed 10/10 snapshot-delta and 27/27 coordinator tests on the repair with disposable PostgreSQL 16.15.
  • Verification included suffix/interior replacement with unchanged newest row, actual promotion, rewind and base-backup rejoin/re-promotion, healthy pooled reconnect, low-privilege execution, and insertion-timeline versus stale checkpoint behavior. Both required history findings are verified fixed.
  • All 19 CI checks plus Cursor Bugbot succeed on this head; optional autofix is skipped. Exact-head CI. GitHub has no inline review threads. No separate completion evidence exists for Tenki/Codex-on-GitHub, so neither is claimed as a passed independent lane.
  • Fable independently audited source/binary provenance and all 16 benchmark records; it did not rerun the performance benchmark. Base/candidate medians 2.704s/1.771s; paired median gain 937ms/34.66%, versus 32ms A/A noise. All 32,000 job identities reconcile. Every 400k case still misses1s; 3.x.x: Measure job persistence after #273; batch inserts, leave the settlement lock only if needed #275 remains open.

Deduplicated finding dispositions

Finding Disposition Evidence / reason
ci-35391120021-pool-acquire Fixed Corrected source census; borrowed advance is not a pool checkout (230e536).
preliminary-F1-trigger-bypass Fixed Documented immutable-history and stopped/restarted-frontend repair boundary (782caf2).
preliminary-F2-count-cost Rebutted / declined End-to-end qualification already included every witness statement and documents O(window) metadata scans; the two-leaf control discloses +1.41% latency. Per-statement attribution is explicitly unmeasured, not represented as production acceptance. No demonstrated correctness defect or hidden exclusion remains.
preliminary-F3-generic-plan Rebutted / declined PostgreSQL 16 forced-generic-plan control: NULL expected-count skips the aggregate; counted witness aggregate executes once.
preliminary-F4-cadence Rebutted / declined Published docs explicitly limit delta to4096 slots and one live leaf, and disclose that production eligibility is unmeasured. The screen claims only measured matched fixtures.
preliminary-F5-polish Rebutted / declined No await occurs during the brief ownership transfer; production never clones SnapshotCapture. Additional telemetry is optional and explicitly outside user scope.
history-replacement Fixed Added insertion-timeline witness (49692c2); independent old-fail/new-pass physical promotion, interior replacement and rejoin tests.
thermo-R2-history-documentation Fixed History proof now states existing D3/D5 boundaries and timeline limitations (49692c2).
thermo-S1 Rebutted / declined Optional refactor; keep existing full-reader control flow stable while repairing the verified history fence.
thermo-S2 Rebutted / declined Pre-existing structural debt; broad file decomposition is not required to correct the bounded acquisition proof.
thermo-S3 Fixed Named private LeafWitness fields landed with the repair (49692c2).
thermo-S4 Rebutted / declined Optional plumbing change without a demonstrated correctness defect; avoid unrelated review churn.
thermo-S5 Rebutted / declined Production moves SnapshotCapture and never clones it; no reachable large-copy bug was identified.
thermo-S6 Rebutted / declined Production eligibility is expressly unmeasured and documented; new metrics were explicitly excluded by the user and optional observability is not a merge-blocking correctness defect.
thermo-S7 Rebutted / declined Predicates match exactly; changing audit helper interface is outside assigned scope and unnecessary for the verified defect.
thermo-S8 Rebutted / declined Conservative guard on an invalid retained input cannot exclude valid persisted rows and has no demonstrated adverse behavior.
thermo-S9 Rebutted / declined Optional planner optimization has no reproduced defect. Delta uses both sequence bounds and at most4096 slots; current metadata scan cost is explicitly included in end-to-end measurements. No production multi-partition plan or eligibility claim is made.
fable-delta-doc-promote Rebutted / declined Existing linked D3 procedure already mandates pg_promote; clarify in final ledger that removing standby.signal is unsupported, rather than require a new source commit.
fable-delta-cargo-fresh Rebutted / declined Cargo fresh=false means compiled, fresh=true means reused. Exact binaries/source hashes and measurements are verified. Clarified in public closeout without another commit.

Limits retained, not silently waived

The supported D3 procedure is one eligible standby, positive old-writer fencing, pg_promote, and verified rewind/base backup before rejoin. Independent sibling promotions can have equal timeline IDs; deleting standby.signal is not the documented promotion procedure and can preserve the old timeline. The reviewer reproduced both as outside the existing contract, not as new exceptions introduced by this PR. D5 isolated restoration already stops frontends. No topology, restart, privilege, persisted format, deadline, payout or authority policy was changed to pass review.

The pre-existing as-is reuse predicate remains unchanged; this repair covers the new delta acquisition proof, not a claim to eliminate every baseline reuse limitation. Metadata counting remains O(window). Production hit rate,500k/two-frontend/network performance, memory soak and separately requalified fallback latency are not established here. The two minor final-review suggestions are clarified above: promotion must end recovery per D3; Cargo fresh:false means actually compiled, whereas fresh:true means reused.

This supersedes the earlier “pending verification” checkpoint. No additional required source commit or review lane is outstanding for this pinned head; the next optimization is separate.

@djh58
djh58 merged commit e55c6f1 into 3.x.x Sep 21, 2026
21 checks passed
kiwidream added a commit that referenced this pull request Oct 1, 2026
…offer, and stop issuing that work after an async promotion (#619)

Rebased onto 3.x.x 3f1fba6 (#642, #644) as one commit. It squashes the
series that was PR #645's head 60efddd:

- 263e4cd reproduce blocks on gap-issued work after an async promotion
  without qbitd, and weigh the options
- 37b1af7 require the mode 2 reproduction's new session to be issued
  readable work, not just any refusal
- 2fa8c80 refuse a block on work from a lost replication gap before its
  offer, and stop issuing that work after an async promotion
- 850547e document the refusal: the accepted D3 loss, the runbook for an
  already-offered block, and the decided design
- 7d229ac assert each test's outcome before its metric checks
- e7468f4 record the before/after runs in the design note
- c0a8018 tag work with the scan's timeline, name window_not_held in
  deferrals, count late refusals once, and pin the probe-error,
  out-of-order and clock cases
- 60efddd state the clock precondition and correct the runbook

Before a candidate is enqueued, the enqueue transaction checks that the
writer still holds the candidate's PPLNS window: the window's last share
row must exist and must be the window's own row. If it does not, the
block is refused as stale-job (window_not_held) and is never offered.
Prepared work is tagged with the writer timeline (#466's expression,
read in the scan transaction), so a promotion retires it, and issuance
authority refuses a window the promoted writer no longer holds. The
repair path and save_compact_prepared now require the endpoint to be
the window's own row, not just any row with that share_seq. Every
b619 reproduction now passes and is gated.

The only conflict was the cardinality pins: they become 77 families,
305 startup series and 956 populated series. These are 3.x.x's new
families and series plus this series' own.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
kiwidream added a commit that referenced this pull request Oct 1, 2026
…offer, and stop issuing that work after an async promotion (#619) (#645)

* 3.x.x: refuse a block on work from a lost replication gap before its offer, and stop issuing that work after an async promotion (#619)

Rebased onto 3.x.x 3f1fba6 (#642, #644) as one commit. It squashes the
series that was PR #645's head 60efddd:

- 263e4cd reproduce blocks on gap-issued work after an async promotion
  without qbitd, and weigh the options
- 37b1af7 require the mode 2 reproduction's new session to be issued
  readable work, not just any refusal
- 2fa8c80 refuse a block on work from a lost replication gap before its
  offer, and stop issuing that work after an async promotion
- 850547e document the refusal: the accepted D3 loss, the runbook for an
  already-offered block, and the decided design
- 7d229ac assert each test's outcome before its metric checks
- e7468f4 record the before/after runs in the design note
- c0a8018 tag work with the scan's timeline, name window_not_held in
  deferrals, count late refusals once, and pin the probe-error,
  out-of-order and clock cases
- 60efddd state the clock precondition and correct the runbook

Before a candidate is enqueued, the enqueue transaction checks that the
writer still holds the candidate's PPLNS window: the window's last share
row must exist and must be the window's own row. If it does not, the
block is refused as stale-job (window_not_held) and is never offered.
Prepared work is tagged with the writer timeline (#466's expression,
read in the scan transaction), so a promotion retires it, and issuance
authority refuses a window the promoted writer no longer holds. The
repair path and save_compact_prepared now require the endpoint to be
the window's own row, not just any row with that share_seq. Every
b619 reproduction now passes and is gated.

The only conflict was the cardinality pins: they become 77 families,
305 startup series and 956 populated series. These are 3.x.x's new
families and series plus this series' own.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* 3.x.x: classify #619's two pool checkouts, and pin the refusal at enqueue of a window that reaches past its anchor (#619)

CI on 384eb2a failed two checks for this PR's own reasons.

- The pool-acquire guard needs every checkout classified. Two new
  sites are classified "ledger" (delegated), like the existing
  Ledger::acquire sites: the landing's window probe in
  coordinator.rs::rebuild_claim_parts, and WorkLedger::window_held.
- audit_body_normalization's durable-range test built a window that
  ends with a share accepted after the anchor. It expected the landing's
  proof to refuse that window. The enqueue's #619 check now refuses it
  first, because the last row is not held at the anchor. The case now
  asserts that refusal: it is typed WindowNotHeld for the block and its
  last share_seq, nothing is pending, and no block or audit row is
  written. The other three cases still reach the landing's proof. Share
  history is immutable, so a candidate enqueued before this check
  existed cannot be built to reach the proof's final count.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* 3.x.x: list #619's two gated lib tests in the expected gate list (#619)

The gate proof on 5c261ad found two gated tests that ran but are not
in test/prism-gated-tests.txt. Both are lib tests from the #619 review
round:

- coordinator::miner_submit::acquire_tests::
  a_failed_window_probe_is_unknown_never_stale_and_enqueues_nothing
- ledger::window::payout_state::tests::
  a_snapshot_reads_its_writer_timeline_in_the_transaction_that_reads_its_rows

The list now holds 804 tests, the same number the proof saw run.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
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