test(frontend): stop two Dashboard tests flaking under CI load (#645) #652

Merged
claude-bot merged 1 commit from fix/645-dashboard-flakes into main 2026-09-14 07:10:20 +00:00
Collaborator

Test-only. Fixes the two failures that turned Renovate #639 (a Python dependency bump) red in run 1087, plus a third problem found while verifying.

  1. makes the next-session countdown a link to that session. The countdown renders only after two chained async loads: campaigns, then each card's next session. The default 1 s findBy wait isn't always enough on a loaded shared runner, so it now has { timeout: 5000 }. That's a ceiling, not a delay; a fast run is unaffected.
  2. serves next-session from the client cache on a remount within the TTL. It asserted fetchNextSession was called exactly 4 times, but how often a card's effect runs depends on React's scheduling, and CI saw 5. It's now >= 4. The real claim, global.fetch staying at 2 because the cache served the remount, is unchanged.
  3. The same test crashed when run on its own (listCampaignTrash() … reading 'then'). #644 added a listCampaignTrash() call to the Dashboard, and this suite's beforeEach never mocked it. The test passed only because an earlier test in the file left the mock set. It's now set in the beforeEach.

Verification

  • Dashboard.test.jsx: 21 passed. The dedup test also passes when run alone.
  • Mutation check: with the client GET cache disabled (cacheable = false in api/client.js), the dedup test, run alone, fails on the fetch count: expected "spy" to be called 2 times, but got 4 times at :318. So the relaxed call count didn't make the test vacuous.
  • eslint clean.

Once this merges, Renovate #639 needs a fresh run (tick its rebase box).

Closes #645

🤖 Generated with Claude Code

Test-only. Fixes the two failures that turned Renovate #639 (a Python dependency bump) red in run 1087, plus a third problem found while verifying. 1. **`makes the next-session countdown a link to that session`.** The countdown renders only after two chained async loads: campaigns, then each card's next session. The default 1 s `findBy` wait isn't always enough on a loaded shared runner, so it now has `{ timeout: 5000 }`. That's a ceiling, not a delay; a fast run is unaffected. 2. **`serves next-session from the client cache on a remount within the TTL`.** It asserted `fetchNextSession` was called **exactly** 4 times, but how often a card's effect runs depends on React's scheduling, and CI saw 5. It's now `>= 4`. The real claim, `global.fetch` staying at 2 because the cache served the remount, is unchanged. 3. **The same test crashed when run on its own** (`listCampaignTrash() … reading 'then'`). #644 added a `listCampaignTrash()` call to the Dashboard, and this suite's `beforeEach` never mocked it. The test passed only because an earlier test in the file left the mock set. It's now set in the `beforeEach`. ## Verification - `Dashboard.test.jsx`: 21 passed. The dedup test also passes when run alone. - **Mutation check:** with the client GET cache disabled (`cacheable = false` in `api/client.js`), the dedup test, run alone, fails on the fetch count: `expected "spy" to be called 2 times, but got 4 times` at `:318`. So the relaxed call count didn't make the test vacuous. - eslint clean. Once this merges, Renovate #639 needs a fresh run (tick its rebase box). Closes #645 🤖 Generated with [Claude Code](https://claude.com/claude-code)
test(frontend): stop two Dashboard tests flaking under CI load (#645)
All checks were successful
CI / Summarisation accuracy eval harness (stub provider) (pull_request) Successful in 54s
CI / Backend lint (ruff) (pull_request) Successful in 31s
CI / Bot/backend version sync (pull_request) Successful in 27s
CI / Bot tests and audit (pull_request) Successful in 1m58s
CI / Frontend tests, audit, and build (pull_request) Successful in 4m11s
CI / Docker image build (pull_request) Successful in 5m18s
CI / Backend migration, tests, and audit (pull_request) Successful in 15m1s
CI / Synthetic session harness (no GPU, no LLM) (pull_request) Successful in 16m4s
584a74b1cd
- The next-session countdown appears only after two chained loads; give
  its findByRole a 5s ceiling instead of the default 1s, which a loaded
  shared runner does not always meet.
- The cache-dedup test asserted fetchNextSession ran exactly 4 times, a
  count React's effect scheduling owns. Relax it to >= 4; the global.fetch
  count staying at 2 is the claim, and it is unchanged.
- The same test never mocked listCampaignTrash (called since #644), so it
  passed only when an earlier test left that mock set, and crashed when
  run on its own. Set it in the suite's beforeEach.

Mutation check: with the client GET cache disabled, the dedup test fails
on the fetch count (expected 2, got 4) when run alone.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
claude-bot deleted branch fix/645-dashboard-flakes 2026-09-14 07:10:20 +00:00
Sign in to join this conversation.
No description provided.