From c5a58270cf56106751aff3a597158132bfbea3ea Mon Sep 17 00:00:00 2001 From: Justin Parker Date: Sun, 8 Nov 2026 19:07:33 -0800 Subject: [PATCH] Bring the loop notes back under budget and test the strength grid's radios AI Assisted --- scripts/test-web-console-page-loop.mjs | 30 ++++++++++++++++---------- src/web-console/notes/loop.md | 22 ++++++++----------- 2 files changed, 28 insertions(+), 24 deletions(-) diff --git a/scripts/test-web-console-page-loop.mjs b/scripts/test-web-console-page-loop.mjs index 6497372..f020f5e 100644 --- a/scripts/test-web-console-page-loop.mjs +++ b/scripts/test-web-console-page-loop.mjs @@ -447,9 +447,17 @@ async function openStrengthSetup(t, launch = LAUNCH) { const strengthRows = (s) => s.page.locator(".loop-strength-row").evaluateAll((rows) => - rows.map((r) => ({ phase: r.querySelector(".loop-strength-phase").textContent, pick: r.querySelector("select").value, model: r.querySelector(".loop-strength-model").textContent })) + rows.map((r) => ({ phase: r.querySelector(".loop-strength-phase").textContent, pick: r.querySelector("input:checked")?.value ?? null, model: r.querySelector(".loop-strength-model").textContent })) ); +// Each row is a radio group, one radio per column: #loop-strength--, "match" for Match my session. +// The cell is clicked, as a person does: its dot sits over the hidden radio. +const pickStrength = async (s, n, word) => { + const radio = s.page.locator(`#loop-strength-${n}-${word || "match"}`); + await radio.locator("..").click(); + await s.page.locator(`#loop-strength-${n}-${word || "match"}:checked`).waitFor({ state: "attached" }); +}; + test("the strength section is first in the form and off by default", async (t) => { const s = await openStrengthSetup(t); const toggle = s.page.locator("#loop-phase-strength"); @@ -469,7 +477,7 @@ test("turning it on shows one row per phase left with the model each pick become { phase: "Phase 2: Two", pick: "", model: "opus, medium" }, ], "untouched rows match the session and show the launch choice"); - await s.page.locator("#loop-strength-1").selectOption("thrifty"); + await pickStrength(s, 1, "thrifty"); assert.equal(await textOf(s.page.locator('[data-phase="1"] .loop-strength-model')), "sonnet, low"); assert.equal(await s.page.locator("#loop-strength-all").inputValue(), "-", "Set all to starts blank"); @@ -477,7 +485,7 @@ test("turning it on shows one row per phase left with the model each pick become assert.deepEqual((await strengthRows(s)).map((r) => [r.pick, r.model]), [["best", "opus, medium"], ["best", "opus, medium"]]); assert.equal(await s.page.locator("#loop-strength-all").inputValue(), "-", "and goes blank again: it is not a saved value"); - await s.page.locator("#loop-strength-2").selectOption("balanced"); + await pickStrength(s, 2, "balanced"); assert.deepEqual((await strengthRows(s)).map((r) => [r.pick, r.model]), [["best", "opus, medium"], ["balanced", "sonnet, medium"]], "a row can change after Set all"); await s.page.locator("#loop-strength-all").selectOption("match"); @@ -509,12 +517,12 @@ test("a saved pick that is not mapped holds Start with a line naming the row, an const why = s.page.locator(".loop-why"); assert.equal(await textOf(why), "Pick a new strength for Phase 2: not mapped for this agent."); assert.equal(await s.page.locator("#loop-start").isDisabled(), true); - const pick = s.page.locator("#loop-strength-2"); - assert.equal(await pick.inputValue(), "thrifty", "the saved word stays in the row"); - assert.equal(await pick.locator("option:checked").innerText(), "Thrifty (not mapped)"); - assert.equal(await pick.locator("option:checked").evaluate((o) => o.disabled), true); + const held = s.page.locator("#loop-strength-2-thrifty"); + assert.equal(await held.isChecked(), true, "the saved word stays in the row"); + assert.equal(await held.isDisabled(), true); + assert.deepEqual(await s.page.locator(".loop-strength-head .loop-strength-chip.is-unmapped").allInnerTexts(), ["Thrifty (not mapped)", "Balanced (not mapped)"]); - await pick.selectOption("best"); + await pickStrength(s, 2, "best"); assert.equal(await s.page.locator(".loop-why").count(), 0, "the hold is gone"); assert.equal(await s.page.locator("#loop-start").isDisabled(), false); }); @@ -548,8 +556,8 @@ test("startBlock names every unmapped row, ignores the picks while the toggle is test("the toggle and the picks survive reopening the screen, and the toggle off sends nothing for the loop", async (t) => { const s = await openStrengthSetup(t); await s.page.locator("#loop-phase-strength").check(); - await s.page.locator("#loop-strength-1").selectOption("thrifty"); - await s.page.locator("#loop-strength-2").selectOption("best"); + await pickStrength(s, 1, "thrifty"); + await pickStrength(s, 2, "best"); const save = () => s.page.evaluate(async () => { @@ -573,7 +581,7 @@ test("the toggle and the picks survive reopening the screen, and the toggle off await s.page.locator("#loop-start").waitFor(); }; await reopen(); - await s.page.locator("#loop-strength-1").waitFor(); + await s.page.locator(".loop-strength-row").first().waitFor(); assert.equal(await s.page.locator("#loop-phase-strength").isChecked(), true); assert.deepEqual((await strengthRows(s)).map((r) => [r.pick, r.model]), [["thrifty", "sonnet, low"], ["best", "opus, medium"]]); diff --git a/src/web-console/notes/loop.md b/src/web-console/notes/loop.md index beef740..7040677 100644 --- a/src/web-console/notes/loop.md +++ b/src/web-console/notes/loop.md @@ -1,8 +1,7 @@ # Loop Mode on the Web Console -Workflow notes for Implement and Implement + Review started by the desktop app's -Implementation Loop with `--loop`, part of the web console contract -(`console.md`). Read `building.md` and `notes/implement.md` first: this note says +Notes for Implement and Implement + Review run by the desktop app's +Implementation Loop (`--loop`), part of the `console.md` contract. Read `building.md` and `notes/implement.md` first: this note says only where loop mode differs. The app judges the result, so you report and never approve. @@ -57,16 +56,14 @@ approve. `passed`. Never list a failure the Notes do not name. - A waiting `**Plan change:**` line in the phase's Notes: do not ask Revise first or Resume; report `failed`, reason `other`, and say so in `summary`. -- Run only the tests the phase file names, as the Implement prompt's tests rule - says: a phase task or a task's `Test:` line (a `## Phase Testing` block counts - when it lists them as tasks). Never the full suite unless the phase file names it. +- Run only the tests the phase file names (a phase task, a task's `Test:` line, + or tasks under `## Phase Testing`), never the full suite unless it names it. ## Headline stages Post `headline.stage` as each begins, using only these words: `Build`, `Review`, -`Fixes`, `Re-check`, `Reporting`. The app's strip reads them, and any other word -shows as Build, so do not invent new ones in loop mode. Keep `cleared` and -`total` as in any build. +`Fixes`, `Re-check`, `Reporting` (the app's strip shows any other word as +Build). Keep `cleared` and `total` as in any build. ## Choosing the phase @@ -99,8 +96,8 @@ or `checkoff` post `result: "failed"`, `reason: "other"` and `"handledBy": "loop"` and the answer filled in, so the page shows "The loop handles this", for example `{ "id": "fixes", "kind": "multi", "title": "Which to fix", "options": [ ... ], "status": "answered", "answer": { "ks": ["1", "2"] }, "handledBy": "loop" }`. -- Ask (chat) questions do not arrive while the loop drives. If one does, answer - it briefly as usual. +- Ask (chat) questions do not arrive while the loop drives; if one does, answer + it briefly. ## Review, one fix round and the re-check @@ -130,8 +127,7 @@ say why. Post the triage's answers for the record as the settled `fixes` item (i Then run the one fix round on the findings marked `fix`, and the fresh re-check of only those fixes, as above. `left` counts the picked findings still open after -the re-check. Smart pick always reports `triage.ran: true` and `review.recheck: true`, even when no finding was raised or none was picked (an empty re-check). The triage runs under the `Review` stage; the stage words do not -change. +the re-check. Smart pick always reports `triage.ran: true` and `review.recheck: true`, even when no finding was raised or none was picked (an empty re-check). The triage runs under the `Review` stage. ## Reporting the outcome