rest: pin cacheControlWriter.FlushError errors.Is discriminator (#172)#182
Merged
Conversation
Mutation-surfaced gap (wave-1 review of #164/PR #169, sibling of the #163 rollback pin): broadening the rollback discriminator from errors.Is(err, http.ErrNotSupported) to err != nil passed the entire suite. The dangerous direction is a stamp rollback after a flush whose commit really happened — a genuine I/O error returns only after net/http has snapshotted the headers onto the wire, so the stamp and the latch must KEEP. Mirrors TestSentry_PanicAfterGenuineFlushErrorKeepsRepanicSemantics: reuse flushErrorWriter (sentry_test.go, same package — reciprocal to sentry_test.go's use of noFlushWriter) as the delegate, drive a plain and a wrapped non-refusal flush error through the chain, assert the stamp keeps on the live map and a trailing 404 cannot reopen the latched commit decision. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Comment-only. The file-header doctrine said stamp-presence reads rr.Result().Header; the #172 battery necessarily violates it — flushErrorWriter intercepts the flush before any WriteHeader reaches the recorder, so no snapshot exists and rr.Result() memoization would blind the post-404 cannot-reopen check. Document the exception at both the doctrine and the assertion. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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 #172.
Test-only pin closing a surviving mutant in
cacheControlWriter.FlushError: the stamp-rollback discriminatorerrors.Is(err, http.ErrNotSupported)had no test witnessing the genuine-error direction — broadening it toerr != nilpassed the whole suite. Two new subtests assert a genuine (plain and wrapped) flush error KEEPS the Cache-Control stamp and the commit latch holds against a later WriteHeader. Mirrors the #164 sentry pin, reuses itsflushErrorWriterfake.Second commit annotates the live-map observation exception (a delegate-intercepted flush reaches no recorder WriteHeader, so the live map is the only valid pre-404 read —
rr.Result()would memoize and blind the latch check).Reviewed (code/test/comment agents) + mutation-verified: the
err != nilbroadening dies at both assertion sites. Gate green (build/vet/test/-race).Follow-up #178 filed for two adjacent unwitnessed mutants in the same rollback block.
🤖 Generated with Claude Code