test(blob): correct complete() fault contract for track-only vs needs-saving blobs (#1353/#1376) - #1390
Merged
Merged
Conversation
…-saving blobs (#1353/#1376) The blob unit test asserting complete() "tolerates a source-missing blob but still rejects a transient fault" was RED on main. The assertion was a stale leftover from #1353, not a code regression. #1353 made complete() await EVERY pre-commit blob, so any save fault aborted the commit. #1376 then split pre-commit blobs into blobsNeedingSaving (saveInRecord / saveBeforeCommit — still awaited) and blobsToTrackOnly (already-saving, replication-received — deliberately NOT awaited, to avoid a WS deadlock when a back-pressured copy stream can't supply more chunks: harper-pro#414). Track-only durability moved off commit-abort onto the replication resume cursor (hasBlobGap pins lastDurableSequenceId so the blob is re-streamed on reconnect). The old test drove the transient-fault blob through the track-only path, which complete() no longer awaits, so the expected rejection never fired. This is a test-only contract correction (resources/blob.ts is unchanged): - the "transient fault must still abort" assertion now targets a needs-saving (saveBeforeCommit) blob, where abort is still the contract; - a new case asserts a transient fault on a track-only blob does NOT abort; - the source-unavailable→tolerated case is kept (now on the awaited needs-saving path, so it genuinely exercises the isSourceBlobUnavailable tolerance in complete()); - a comment records the #1353→#1376 history so it isn't "fixed" back. Not a v5.1.5 data-loss regression and no 5.1.6 code patch is needed. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
kriszyp
requested review from
Ethan-Arrowood,
cb1kenobi and
kylebernhardy
and removed request for
cb1kenobi
June 19, 2026 05:25
Contributor
|
Reviewed; no blockers found. |
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.
Summary
Fixes the RED unit test on
maininunitTests/resources/blob.test.js: the case assertingstartPreCommitBlobsForRecord().complete()"tolerates a source-missing blob but still rejects a transient fault." This is a stale test assertion, not a code regression —resources/blob.tsis unchanged.Why it was red
complete()await every pre-commit blob, so any save fault aborted the commit. The test was written against that behavior.blobsNeedingSaving(saveInRecord/saveBeforeCommit) — still awaited bycomplete(); a transient fault must still reject (abort + retry), while a replication source-missing blob (sourceBlobUnavailable) is tolerated.blobsToTrackOnly(already-saving, replication-received) — deliberately not awaited, to avoid a WS deadlock when a back-pressured copy stream can't supply more chunks (harper-pro#414). Their durability moved to the replication resume cursor (hasBlobGappinslastDurableSequenceId→ blob re-streamed on reconnect).The old test drove the transient-fault blob through the track-only path, which
complete()no longer awaits, so the expected rejection never fired →Missing expected rejection.What changed (test-only)
saveBeforeCommit) blob, where abort remains the contract.isSourceBlobUnavailabletolerance incomplete()(previously it passed vacuously, since track-only blobs aren't awaited).CONTRACT HISTORYcomment records the fix(blob): tolerate source-unavailable blobs in pre-commit so a missing blob can't wedge replication #1353→fix(blob): don't await already-saving replication blobs in preCommit.complete() #1376 change so the next reader doesn't "fix" it back.Impact
main's unit suite green again — it's currently blocking clean unit signal on every PR, so it should land promptly.Where to look
unitTests/resources/blob.test.js— the single rewrittenit(...)block. No production code touched.Verification
blob.test.js: 28 pass / 1 fail → 29 pass / 0 fail (stable across repeated runs).test:unit:resources: 841 passing, 14 pending, 0 failing.test:unit:main: 2755 passing, 188 pending, 0 failing.Generated by Claude (Opus 4.8).