Skip to content

rest: witness cacheControlWriter rollback reopen and stamped guard (#178)#188

Merged
SyniRon merged 1 commit into
developfrom
agent/issue-178
Jun 8, 2026
Merged

rest: witness cacheControlWriter rollback reopen and stamped guard (#178)#188
SyniRon merged 1 commit into
developfrom
agent/issue-178

Conversation

@SyniRon

@SyniRon SyniRon commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator

Closes #178.

What

Two test-only pins (+44 lines, rest/cachecontrol_internal_test.go) witnessing the two unwitnessed lines of cacheControlWriter.FlushError's rollback block — both mutants previously survived the full module suite (confirmed red-bar premise on this base before pinning):

  1. Reopen pin — refused flush (errors.Ishttp.ErrNotSupported), handler shrugs and writes its 200 body anyway: the response must carry the Cache-Control stamp, because the rollback reopened the commit latch. Asserts the commit-time snapshot (rr.Result().Header). Kills the w.committed = false deletion mutant.
  2. Guard pinWriteHeader(200) then refused flush: the refusal must not delete the stamp the commit already took. Asserts the live header map (required, not stylistic — a Result() assertion would let the mutant survive). Kills the stamped && deletion mutant.

Reuses noFlushWriter from #174's fake family — no sibling helper.

Validation

  • Red-bar premise: both deletions confirmed green on base before pinning.
  • Post-pin kill matrix: each mutant killed by exactly its one pin, zero collateral failures across the full module (worker + independent reviewer, separately reproduced).
  • Non-vacuity proven both directions: removing the shrugging Write fails the reopen pin; removing cacheControlWriter from the chain fails the assertion.
  • Gate: gofmt, build, vet, full module suite, -race ./rest/ — all green.

🤖 Generated with Claude Code

)

Two test-only pins on the unwitnessed lines of FlushError's rollback
block (rest/cachecontrol.go unchanged), killing the two mutants the
wave-3 kill-matrix found surviving:

- Reopen pin: a refused flush (ErrNotSupported, nothing sent) followed
  by a shrugging 200 Write must re-stamp Cache-Control — committed=false
  reopens the commit latch so the freshness signal reaches the wire.
- Guard pin: a refused flush AFTER a real WriteHeader(200) must not
  delete the stamp the commit already took — the stamped && guard keeps
  the rollback scoped to what THIS flush latched.

Both ride noFlushWriter from the #174 error-path fake family and assert
the refusal class via errors.Is(err, http.ErrNotSupported).
@SyniRon SyniRon merged commit 9425265 into develop Jun 8, 2026
3 checks passed
@SyniRon SyniRon deleted the agent/issue-178 branch June 8, 2026 01:43
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.

rest: cacheControlWriter rollback — committed=false reopen and the stamped guard are unwitnessed

1 participant