Review — Claude Fable 5.1, for session ce2dd144
Whole branch test/saving-harness-waits (7af5788) against origin/main (fca8714), read in a scratch worktree. Three files change, all test-only: fixtures/engines/saving.mjs, fixtures/engines/saving-webkit.swift, internal/docs/saving_browser_test.go. No app code, no bundle.
Verdict: ready to merge (APPROVE-WITH-NITS). Nothing blocking. Two P2 nits below, neither needs a new round.
What I checked
- The endpoint.
/test/saving-state/is registered only insidenewSavingServer'shttptestwrapper, in a file guarded by//go:build browserand named_test.go, so it has no path into any binary. Confirmed:go build ./cmd/docsandstrings | grep saving-statefinds nothing;grepacross non-test Go finds no reference. It sits before the app handler in the wrapper and is unauthenticated, which is fine for a test server bound to a random loopback port. - No weakening. I compared every assertion. held-link: same four checks (non-nil, held>0, contains, calm) plus the new settled check. large / prose / stripped / closing / back / back-quick: every old check survives verbatim, and each gains "settled must be true". The floor is real:
settleonly evaluatesdoneoncems >= watchMs, andsinceis taken beforepage.evaluateexactly where the oldpausebegan, so the save line is watched for at least the old 3000 ms (1500 ms per text for stripped) before any early exit. closing's!largeHeld && holds(both)reproduces the old 4500 ms's purpose exactly, andduringLarge > 0still has to hold after it. WKWebView back: leaving on "a POST has arrived" rather than at 600 ms leaves with the save on the wire as before (the post is recorded at arrival, before the 1.5 s slow); the away-wait now proves what 2000 ms only assumed. - The trace wrapper is transparent.
fetch.apply(window, arguments)andbeacon.apply(navigator, arguments)passinitthrough untouched, sokeepalive,signal(built bysaveRequestbefore the call; the wrapper adds microseconds before the real fetch starts) and body are what the app made.size()readsbyteLength/size/lengthand consumes nothing;new Headers(init.headers)is a copy. The.then(onF, onR)on the returned promise returns the originalp, and its derived promise never rejects, so no unhandled rejection and no change to when the caller sees the result. Static GETs are passed through without a log line. Nothing in the wrapper could hide the WebKit bug; the mutant run below shows it in the trace. - Fail-first, reproduced. Scratch worktree at 7af5788 with
fixtures/editor-entry.js,fixtures/save-queue.mjsand the bundle from a6e6c63 (editor.19091003f4b6baf4.js, c37b32c… removed), run alone:playwright/webkit,/closed,/large,/prose,wkwebview/held-link,/back,/back-quickfail; every Chromium case andwebkit/stripped,webkit/closingpass. Exactly the claimed set. The explain output does its job: "gave up after 20088 ms",#2 fetch POST … 19 B/refused: TypeError: Load failedevery 250 ms, "What reached the server: no save", and the trace capped at 60 entries with "… 98 more". (Your/tmp/saving-harness-logs/docs-mutant-noclientfix.logat 15:39 predates the 16:05 commit and prints the trace uncapped; the branch head caps it.) - Parity with Slides.
saving.mjsandsaving-webkit.swiftdiffer only in the page suffix, the ready check and the comment references; the Go test only in app wiring, selectors and the slide-HTMLtext(). Still parallel. - Flake. 3 of 3 passes, one at a time, with another agent's suites on the box (load 33 / 22 / 12 at start): 71 s, 72 s, 77 s; 17 sub-cases each; longest settle 3540 ms against 20 s; no
settled:falseanywhere. Logs in/tmp/rev-logs/docs-run-{1,2,3}.log, mutant in/tmp/rev-logs/docs-mutant-noclientfix.log.
gofmt and go vet -tags browser are clean.
Findings
- P2 —
saving.mjsview()throws on a non-OK or failed poll, which aborts the whole harness.settle→view→throw new Error(...)ends every remaining scenario and engine withsaving.mjs: exit status 1and no explain. The Swiftview()returns nil and keeps polling to the ceiling. The test server always answers this endpoint 200, so it would take the server dying to hit it, but when it does, the diagnosis you built would be the thing lost. Suggest catching inviewand treating a failed poll as "not yet", as Swift does. - P2 —
closedasserts the words and calm, notheld > 0. The held-link case proves a save landed while the link loaded;closeddoes not, so a page whose beacon only got through because the close dropped the held link would still pass. In the mutant run the beacon was in fact answered "with the link loading", and the case failed on[retrying]anyway, so this is not hiding anything today;link: true-stylev.held > 0in the settle condition and the Go check would make the case say what it means. Optional.
Nothing else. Good branch: it does what #94 round 3 asked, and the failure story is now readable.