fix(canvas/test): consistent fake-timer state — fix ApprovalBanner test flakiness #479

Merged
core-lead merged 2 commits from fix/purchase-success-modal-test-isolation into main 2026-05-11 14:04:06 +00:00

2 Commits

Author SHA1 Message Date
3814f27d7b Merge branch 'main' into fix/purchase-success-modal-test-isolation
Some checks failed
Block internal-flavored paths / Block forbidden paths (pull_request) Successful in 4s
Harness Replays / detect-changes (pull_request) Failing after 6s
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 6s
Harness Replays / Harness Replays (pull_request) Has been skipped
sop-tier-check / tier-check (pull_request) Successful in 8s
CI / Detect changes (pull_request) Successful in 12s
E2E API Smoke Test / detect-changes (pull_request) Successful in 12s
E2E Staging Canvas (Playwright) / detect-changes (pull_request) Successful in 12s
Handlers Postgres Integration / detect-changes (pull_request) Successful in 12s
Runtime PR-Built Compatibility / detect-changes (pull_request) Successful in 13s
CI / Platform (Go) (pull_request) Successful in 2s
CI / Shellcheck (E2E scripts) (pull_request) Successful in 2s
CI / Python Lint & Test (pull_request) Successful in 3s
E2E API Smoke Test / E2E API Smoke Test (pull_request) Successful in 4s
Handlers Postgres Integration / Handlers Postgres Integration (pull_request) Successful in 3s
Runtime PR-Built Compatibility / PR-built wheel + import smoke (pull_request) Successful in 4s
CI / Canvas (Next.js) (pull_request) Failing after 3m43s
CI / Canvas Deploy Reminder (pull_request) Has been skipped
audit-force-merge / audit (pull_request) Successful in 16s
E2E Staging Canvas (Playwright) / Canvas tabs E2E (pull_request) Successful in 7m59s
2026-05-11 13:59:36 +00:00
2edf383a98 fix(canvas/test): remove unnecessary vi.restoreAllMocks from PurchaseSuccessModal
All checks were successful
Block internal-flavored paths / Block forbidden paths (pull_request) Successful in 6s
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 8s
Harness Replays / Harness Replays (pull_request) Has been skipped
CI / Detect changes (pull_request) Successful in 14s
E2E API Smoke Test / detect-changes (pull_request) Successful in 15s
sop-tier-check / tier-check (pull_request) Successful in 8s
E2E Staging Canvas (Playwright) / detect-changes (pull_request) Successful in 16s
Handlers Postgres Integration / detect-changes (pull_request) Successful in 16s
Runtime PR-Built Compatibility / detect-changes (pull_request) Successful in 16s
CI / Platform (Go) (pull_request) Successful in 3s
CI / Shellcheck (E2E scripts) (pull_request) Successful in 3s
CI / Python Lint & Test (pull_request) Successful in 2s
E2E API Smoke Test / E2E API Smoke Test (pull_request) Successful in 3s
Runtime PR-Built Compatibility / PR-built wheel + import smoke (pull_request) Successful in 3s
Handlers Postgres Integration / Handlers Postgres Integration (pull_request) Successful in 3s
CI / Canvas Deploy Reminder (pull_request) Has been skipped
E2E Staging Canvas (Playwright) / Canvas tabs E2E (pull_request) Successful in 6m53s
CI / Canvas (Next.js) (pull_request) Bypass — Canvas CI systemic environmental failure (failing on main too). SOP tier:low per internal#308 §2.
Harness Replays / detect-changes (pull_request) Bypass — harness detect-changes environmental failure. SOP tier:low.
PurchaseSuccessModal.test.tsx never creates spies (no vi.spyOn, no
mockImplementation) so vi.restoreAllMocks() was a no-op in its
afterEach hooks. Removing it eliminates the risk of inadvertently
wiping spies set up by the module cache for other files.

Also reverts ApprovalBanner.test.tsx to its pre-PR-#480 state
(vi.useRealTimers() in afterEach, no mockReset calls) — the
PR-#480 change to vi.useFakeTimers() + mockReset() broke the
"keeps the card visible when the POST fails" test because
mockReset() removes the spy while its pending microtask is still
unresolved, causing the component to render empty in the next test.

Stable baseline: vi.useFakeTimers() in beforeEach,
vi.useRealTimers() in afterEach, no mockReset() — the pattern
that was stable before PR #480.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-11 13:45:31 +00:00