saving.mjs: a state poll that fails is "not yet", not the end of the run
A throw from view() ended every remaining scenario with nothing explained, the one time the explanation is wanted. It now returns null and settle keeps polling to its ceiling, as the WKWebView harness already did (Claude Fable on Docs #98).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 file changed,
+11
−4
fixtures/engines/saving.mjs+11 −4
CI passed — run details
diff --git a/fixtures/engines/saving.mjs b/fixtures/engines/saving.mjs| index e8800da..cb66684 100644 |
| --- a/fixtures/engines/saving.mjs |
| +++ b/fixtures/engines/saving.mjs |
| @@ -39,10 +39,16 @@ const CEILING_MS = 20000 |
| // view is the test server's side of a document: its text, and every save |
| // that reached it. Asked from here, not from the page, which is the one |
| // whose requests are being refused. |
| +// A poll that fails is "not yet", as in the WKWebView harness: throwing |
| +// here would end every scenario left, with nothing explained, at the one |
| +// time the explanation is wanted (Claude Fable on Docs #98). |
| const view = async (sqid) => { |
| - const r = await fetch(config.origin + config.state + sqid) |
| - if (!r.ok) throw new Error(`${config.state}${sqid}: ${r.status}`) |
| - return r.json() |
| + try { |
| + const r = await fetch(config.origin + config.state + sqid) |
| + return r.ok ? await r.json() : null |
| + } catch { |
| + return null |
| + } |
| } |
| const holds = (text, want) => want.split(/\s+/).every((w) => text.includes(w)) |
| @@ -60,7 +66,8 @@ const retried = (trace) => { |
| async function settle (sqid, since, watchMs, done) { |
| for (;;) { |
| const ms = Date.now() - since |
| - if (ms >= watchMs && done(await view(sqid))) { |
| + const v = ms >= watchMs ? await view(sqid) : null |
| + if (v && done(v)) { |
| // The page's console lines from just before are still on their way. |
| await pause(250) |
| return { settled: true, ms } |