From 3d038e11cbdbe64219ef1fcb3724ed8a8fb2ebcc Mon Sep 17 00:00:00 2001 From: root Date: Wed, 9 Sep 2026 06:56:03 +0200 Subject: [PATCH] Verify that typed text actually arrived typeText fired Input.insertText per character and never looked back, so a partially typed value was indistinguishable from a wrong one: a run committed x=3 for "300" and the failing check blamed the value rather than the three lost characters. Trying to reproduce that failed over 21 rounds across four variants (no pause, 400ms between characters, with the preceding scrub, and both commit paths), and the code rules out the obvious suspects: typing lands in a hidden input, each character is only a preview, objectSignature omits position so no rebuild is triggered, and NumberField.setNumber guards write-back with isEditing. Cause unknown, so this makes the symptom name itself instead of hardening against a mechanism that may not exist. Typing stays per character - that exercises the live-preview and search-filter paths - but now asserts the text is in the focused input, reporting focus and actual contents when it is not. Co-Authored-By: Claude Opus 5 --- tools/lib/harness.mjs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tools/lib/harness.mjs b/tools/lib/harness.mjs index 81086f5d..1cc45e9a 100644 --- a/tools/lib/harness.mjs +++ b/tools/lib/harness.mjs @@ -192,8 +192,20 @@ function makeTools({ cdp, projectId, baseUrl, consoleLog, check, shotPrefix }) { await sleep(ms); await keyEvent('keyUp', name); }; + /** + * Typed per character to exercise the per-keystroke paths (live preview, search filters), then + * verified: a partial type is otherwise indistinguishable from a wrong value – a run once + * committed x=3 for "300" and the check blamed the value, not the lost characters. + */ const typeText = async (text) => { for (const ch of text) await cdp.send('Input.insertText', { text: ch }); + const typed = await json( + '({ tag: document.activeElement?.tagName, value: document.activeElement?.value })', + ); + if (typed.tag !== 'INPUT' || !String(typed.value ?? '').includes(text)) + throw new Error( + `typing "${text}" did not arrive: focus is ${typed.tag}, it holds ${JSON.stringify(typed.value)}`, + ); }; const undo = async () => { await press('z', { ctrl: true });