AntFleet

Disagreement · 52c62f95-anthropic-1

Tests share a single response across cases; header mutation in one test could mask regressions

solo Opus
repo e24ef98c·PR #5·reviewed 2 weeks ago

Opus finding

Tests share a single response across cases; header mutation in one test could mask regressions

lowtest-gapmedium
  • apps/web/middleware.test.ts:20-22
The middleware result is computed once at describe-body evaluation time and reused across every `it`. NextResponse.headers is a mutable Headers object; if any future test (or imported side effect) mutates res.headers, subsequent tests would see contaminated state. Additionally, computing `res` at describe-body evaluation runs the middleware before vitest hooks/setup, which is a subtle ordering hazard if module-level mocks are ever added.

Recommendation

Move `const res = middleware(makeReq());` into a beforeEach, or call middleware(makeReq()) inside each `it` block, to ensure isolation.

Other reviewer

The other reviewer flagged nothing in this file/line range.

Why this didn't post

This finding didn't meet AntFleet's unanimous agreement threshold. Both frontier models review every PR independently; only findings they both flag with the same severity and category are posted to the PR. This one fell through.

read the methodology →

From the same review

These findings passed the unanimous gate on the same PR review. The disagreement above was filtered out; the findings below were posted.