Files
mokosh/tests/uat/lib/harness-page-driver.ts
Mark 7e0da63ff2 fix(debug): A33.1 SAVE-ack race — gate on race-free fresh-archive signal
Root cause: driveA33's A33.1 hard-gated on the chrome.runtime.sendMessage
SAVE_ARCHIVE callback ack. After the Puppeteer CDP worker.close() SW kill,
the SAVE_ARCHIVE message wakes a fresh SW instance; that instance runs the
multi-step saveArchive() pipeline (offscreen video-keepalive port
re-establishment + REQUEST_BUFFER round-trip + rrweb collection + zip
build). The harness's original sendMessage response port has its own MV3
lifetime — on a 5-min-aged SW the pipeline INTERMITTENTLY outruns it,
surfacing chrome.runtime.lastError "message port closed before a response
was received". The archive is still written correctly every time, which is
why A33.2/A33.3 always passed (Plan 04-05 full-mode UAT: A33.1 FAIL while
A33.2/A33.3 PASS at 1.56 MB). A33.1 was gating a CI assertion on a
best-effort transport ack with inherent MV3 non-determinism.

Fix (harness-side only, Option A — race-free reframe): A33.1 now gates on
the durable race-free signal — a fresh archive on disk — via the canonical
snapshotExistingZips + pollForNewOrUpdatedZip helpers (also used by
driveA12/A13/A27). The sendMessage ack is demoted to a soft non-gating
diagnostic. This is exactly the signal the proven-reliable spike already
uses. A33.2/A33.3 substantive checks are intact and now read the verified
fresh zip. No new symbol; FORBIDDEN_HOOK_STRINGS unchanged at 12. The SW
SAVE_ARCHIVE handler is a correct MV3 async pattern — no production change.

Verified: full-mode A33 (genuine 5-min idle) 3/3 GREEN; skip-mode UAT
35/35 GREEN; tsc + build:test exit 0; vitest 184/184.

Debug session: .planning/debug/a33-save-ack-race.md

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-22 15:33:22 +02:00

122 KiB