Primary finding
Tests share a single middleware response across all `it` blocks, weakening isolation and hiding per-request bugs
lowtest-gaphigh
- apps/web/middleware.test.ts:20-22
`middleware(makeReq())` is invoked once at describe-body evaluation time and the same `res` object is reused across every `it`. If a future change makes header behavior request-dependent (e.g., path-based CSP relaxation), tests will keep passing because they never re-invoke the middleware per case. It also means a test that mutated `res.headers` would leak into others. Low severity today since headers are static, but it's a latent maintainability issue and a pattern that violates test isolation.
Recommendation
Move `const res = middleware(makeReq())` into a `beforeEach` or invoke per test, so future request-dependent logic is exercised correctly.