fix(canvas/test): fix ApprovalBanner POST error test isolation #458

Closed
core-fe wants to merge 3 commits from canvas-followup into main

3 Commits

Author SHA1 Message Date
40ecd0cbab Merge remote-tracking branch 'origin/main' into canvas-followup
Some checks failed
Block internal-flavored paths / Block forbidden paths (pull_request) Successful in 17s
Harness Replays / detect-changes (pull_request) Successful in 14s
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 13s
sop-tier-check / tier-check (pull_request) Successful in 16s
E2E Staging Canvas (Playwright) / detect-changes (pull_request) Successful in 42s
E2E API Smoke Test / detect-changes (pull_request) Successful in 47s
CI / Detect changes (pull_request) Successful in 50s
Handlers Postgres Integration / detect-changes (pull_request) Successful in 48s
Runtime PR-Built Compatibility / detect-changes (pull_request) Successful in 44s
E2E API Smoke Test / E2E API Smoke Test (pull_request) Successful in 10s
CI / Platform (Go) (pull_request) Successful in 9s
CI / Shellcheck (E2E scripts) (pull_request) Successful in 7s
CI / Python Lint & Test (pull_request) Successful in 9s
Handlers Postgres Integration / Handlers Postgres Integration (pull_request) Successful in 9s
Harness Replays / Harness Replays (pull_request) Failing after 1m48s
Runtime PR-Built Compatibility / PR-built wheel + import smoke (pull_request) Successful in 12s
E2E Staging Canvas (Playwright) / Canvas tabs E2E (pull_request) Successful in 9m0s
CI / Canvas (Next.js) (pull_request) Failing after 10m53s
CI / Canvas Deploy Reminder (pull_request) Has been skipped
audit-force-merge / audit (pull_request) Has been skipped
2026-05-11 11:25:36 +00:00
e5f6e17c0c Merge remote-tracking branch 'origin/main' into canvas-followup
Some checks failed
Block internal-flavored paths / Block forbidden paths (pull_request) Successful in 15s
Harness Replays / detect-changes (pull_request) Successful in 18s
CI / Detect changes (pull_request) Successful in 46s
E2E API Smoke Test / detect-changes (pull_request) Successful in 49s
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 16s
E2E Staging Canvas (Playwright) / detect-changes (pull_request) Successful in 55s
Handlers Postgres Integration / detect-changes (pull_request) Successful in 57s
sop-tier-check / tier-check (pull_request) Successful in 21s
Runtime PR-Built Compatibility / detect-changes (pull_request) Successful in 58s
Harness Replays / Harness Replays (pull_request) Successful in 7s
CI / Platform (Go) (pull_request) Successful in 7s
CI / Shellcheck (E2E scripts) (pull_request) Successful in 5s
CI / Python Lint & Test (pull_request) Successful in 6s
E2E API Smoke Test / E2E API Smoke Test (pull_request) Successful in 11s
Handlers Postgres Integration / Handlers Postgres Integration (pull_request) Successful in 9s
Runtime PR-Built Compatibility / PR-built wheel + import smoke (pull_request) Successful in 8s
E2E Staging Canvas (Playwright) / Canvas tabs E2E (pull_request) Successful in 7m47s
CI / Canvas (Next.js) (pull_request) Failing after 9m22s
CI / Canvas Deploy Reminder (pull_request) Has been skipped
2026-05-11 11:13:21 +00:00
daecab6d6d fix(canvas/test): fix ApprovalBanner POST error test isolation
Some checks failed
Harness Replays / Harness Replays (pull_request) Has been skipped
audit-force-merge / audit (pull_request) Has been skipped
Block internal-flavored paths / Block forbidden paths (pull_request) Successful in 16s
Harness Replays / detect-changes (pull_request) Failing after 15s
Lint curl status-code capture / Scan workflows for curl status-capture pollution (pull_request) Successful in 15s
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 18s
sop-tier-check / tier-check (pull_request) Successful in 17s
CI / Detect changes (pull_request) Successful in 1m4s
E2E API Smoke Test / detect-changes (pull_request) Successful in 1m6s
E2E Staging Canvas (Playwright) / detect-changes (pull_request) Successful in 1m10s
Handlers Postgres Integration / detect-changes (pull_request) Successful in 1m0s
Runtime PR-Built Compatibility / detect-changes (pull_request) Successful in 55s
CI / Platform (Go) (pull_request) Successful in 12s
CI / Shellcheck (E2E scripts) (pull_request) Successful in 21s
CI / Python Lint & Test (pull_request) Successful in 15s
Handlers Postgres Integration / Handlers Postgres Integration (pull_request) Successful in 9s
E2E API Smoke Test / E2E API Smoke Test (pull_request) Successful in 11s
Runtime PR-Built Compatibility / PR-built wheel + import smoke (pull_request) Successful in 9s
CI / Canvas Deploy Reminder (pull_request) Has been skipped
E2E Staging Canvas (Playwright) / Canvas tabs E2E (pull_request) Failing after 10m40s
CI / Canvas (Next.js) (pull_request) Failing after 11m51s
The "keeps the card visible when the POST fails" test was failing in the
full suite due to cross-test mock pollution from ActivityTab.test.tsx.

Root cause: ActivityTab.test.tsx mocks @/lib/api with vi.fn() mocks
(mockGet, mockPost) that persist across test files. When ApprovalBanner's
decisions beforeEach creates a vi.spyOn on api.post, it wraps ActivityTab's
mockPost. Calling mockRejectedValueOnce() on the spy queues after
ActivityTab's mockResolvedValue({}) implementation, but in certain test
orderings the queue ordering was unreliable.

Fix: use mockPost.mockReset().mockImplementation(() =>
Promise.reject(...)) to atomically clear the beforeEach mock setup and
set a permanent rejection, rather than relying on mockRejectedValueOnce
which queues behind the existing implementation.

Also: store mockGet and mockPost in module-level variables so error
tests can manipulate them without creating duplicate spies.

Co-Authored-By: Molecule AI Core-FE <core-fe@agents.moleculesai.app>
2026-05-11 10:50:16 +00:00