Skip to content

rest: flush-chain integrity — composition test, FlushError convention guard, error-path fakes #174

Description

@SyniRon

Surfaced by the wave-1 review (#167, PR #171).

#167's acceptance criterion "flush succeeds from a handler" currently holds by composition of per-layer pins (sentry, metrics, cachecontrol, gzip each pinned individually); nothing pins the composed property. A wrapper inserted into rest.New tomorrow without FlushError/Flusher/Unwrap breaks handler flushes in production with every existing test green.

  1. One internal test assembling the New-shaped stack (sentry → metrics → auth → sentryLabel → gzip → cacheControl → flushing probe handler) over a real server: flush succeeds, prefix streams.
  2. Mechanical convention test (cf. types/: mechanical tag-lint test enforcing wire conventions #148/types: mechanical tag-lint test enforcing wire conventions (#148) #162 tag-lint): every ResponseWriter wrapper in the rest package implements FlushError() error or doesn't intercept flush at all — never bare Flush(), whose errors the controller's Flusher branch silently swallows.
  3. Error-path fakes: a delegate whose FlushError returns a genuine I/O error (propagated verbatim through gzip's FlushError), and a write-failing base under gz.Flush() itself (early return, sticky gzip.Writer error, Close-path log backstop).
  4. Comment fix: rest/metrics_internal_test.go:15-17 "(the recorder implements Flusher directly and would mask the gap)" — same false rationale family corrected in gzip_test.go on rest: gzipResponseWriter supports no flush and no Unwrap — ResponseController dead-ends on the gzip chain #167's branch; verified false here too (the walk dead-ends at statusWriter before any recorder is reached).

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

Labels

7cavchoreRoutine maintenance, cleanup, or tech-debt removalready-for-agentFully specified, ready for an AFK agent to implement

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions