Summary
Engineering-only, not user-facing
0Questions
0Links
0Comments
0PRs
Spec body
# Grade-essay-ai test mock caching Pre-existing `bun:test` mock caching issue affecting `services/web-app/app/routes/api.domain.grade-essay-ai/route.test.ts`. The suite passes when run in isolation but fails when co-run with other suites in the same `bun test` invocation. ## Reproduction 1. From `yawp-2.0` root: `bun test services/web-app/app/routes/api.domain.grade-essay-ai/route.test.ts` — passes. 2. From `yawp-2.0` root: `bun test` (full suite) — the grade-essay-ai tests fail with mock-related assertion errors. ## Expected Tests pass in both invocations. ## Actual Mocks set up in earlier-running suites bleed into the grade-essay-ai suite, causing assertions about mock call counts and arguments to fail. ## Impact Engineering-only, not user-facing. The tested behavior (`grade-essay-ai` route) works in production. The bug is in the test harness, not the product. CI is currently configured to either run the suite isolated or accept the flake — confirm with engineering. Either way, this should be fixed so the full `bun test` invocation is trustworthy. ## Affected versions Pre-existing. Predates the Phase 1 editor refactor and the assignments-unification work — has been there for a while. ## Suspected cause `bun:test` module mocks are shared across suite boundaries within a single test process. Earlier suites mock dependencies that grade-essay-ai also uses, and the mocks aren't reset or scoped to the suite that set them. Likely fix is either explicit `mock.restore()` in afterEach, scoping mocks to `describe` blocks, or using bun's spy/stub primitives that reset automatically. ## Workaround Run `services/web-app/app/routes/api.domain.grade-essay-ai/route.test.ts` in isolation when changes touch that area. Live with full-suite flakiness otherwise.
Repo sync
No repo sync metadata recorded yet.