Repository navigation
test(response-handles): prove commit-gate rollback, measure large-handle I/O - #4979
Merged
Merged
Conversation
Completes the evidence #4448 asks for that #4964 left open. A publication whose write authority refuses at the Commit gate is refused after the job body has already written the handle row. The written row rolls back, no handle is issued, and the writer stays usable. The guard records the intents it admitted, so the test proves the row write preceded the refused commit rather than passing on an earlier refusal. Large-handle cost tests record payload I/O and writer lock tenure on an 8 MiB handle: inventory and expiry selection read the covering index only, so their work does not follow payload size, and a replay of live content holds the writer for about 1-2% of a fresh publication. No slice read is added. Measured through the SQLite C API on a 4 MiB row, substr costs 953us and length() predicates 1429us against 582us for one full copy: a large TEXT value is an overflow chain, so slicing walks more pages than reading it once. The issue's "where the existing storage API can safely slice it" condition is not met. Refs #4448
|
Contributor
There was a problem hiding this comment.
🔍 Devin Review: 6 flags
Not posted on this PR by your GitHub settings — view them in Devin Review. (Configure)
ScriptedAlchemy
enabled auto-merge
November 27, 2026 01:04
This was referenced Nov 27, 2026
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 nothing: see "Scope against #4448" below.
Issue: #4448
What this adds
#4964 moved response handles into the registered store and deleted the JSON-file machinery, and listed three things it left open. This PR completes the two that are evidence, and records a measurement that settles the third.
1. A real post-write fault test. The exact-SQL write path is
verify(BeginTransaction) → BEGIN IMMEDIATE → job body → verify(Commit) → COMMIT. TheCommitcheck is the last gate, reached after the body has already written the handle row. A guard that admits every intent exceptCommitdrives that fault deterministically, with no racing and no held writer. The test asserts the row rolled back, no handle was issued, and the writer still serves the next publication. The guard records the intents it admitted, and the test asserts the row write preceded the refused commit, so it cannot pass on an earlier refusal.2. Large-handle measurements (
tests/response_handle_store_cost.rs, 8 MiB handles, isolated harness):The inventory and expiry assertions are falsifiable: a payload-reading inventory or sweep would scale with the 8 MiB handle and fail.
3. No slice read, by measurement. The issue says to avoid whole-record loads "where the existing storage API can safely slice it." It cannot. Measured through the SQLite C API on a 4 MiB
TEXTrow:substrpage of 12,952 chars: 953 µslength()predicates, no copy: 1,429 µsA large
TEXTvalue is an overflow chain.substrandlength()walk that chain to find character boundaries, which costs more than one sequential read of the value. Slicing in SQL would make paging slower, so paging keeps the whole-record read and the digest check that guarantees served content is never corrupt.Root cause
Nothing was broken. The store's rollback at the commit gate was already correct; it had no test. The measurements confirm the metadata-only claims that #4964 rested on
EXPLAIN QUERY PLANalone.Verification
//crates/tracedecay-global-db:unit_test(full)bazel build --config=ci --config=clippy //crates/tracedecay-global-db:all//crates/tracedecay-global-db:rustfmt_check_2024tests::response_handle_store_cost::replay_does_not_rewrite_a_live_handleRe-verified after rebasing onto
3620245514.Scope against #4448
handle_not_found, with no alias or migration.Residual risk
ExactSqlWriteAuthorityhook. The engine's one genuinely post-commit failure (watermark publication) belongs to the runtime-submit batch path, which this store does not use, so it is not reachable here and is not covered.