Add the Review Loop: unattended review-and-fix rounds in the desktop app and in loop phases

AI Assisted
This commit is contained in:
jparkerweb committed 2026-11-28 21:09:02 -08:00
1 parent d6a28b5dc8
commit 57567d7a0b
71 files changed
+11331 -443

No files matched your search

+34
View File
@@ -956,3 +956,37 @@ test("a pick for an unmapped word, or a phase left out, keeps that row as it was
assert.deepEqual((await strengthRows(s)).map((r) => r.pick), ["", "thrifty"]);
assert.equal(await s.page.locator(".loop-strength-why").count(), 0, "no reason shows for a pick that was not applied");
});
test("Review rounds per phase shows under Review, is off with Review off, and goes out with the setup", async (t) => {
const s = await openSetup(t);
const rounds = s.page.locator("#loop-review-rounds");
const field = s.page.locator(".loop-field", { hasText: "Review each phase with a fresh agent" });
assert.equal(await field.locator("#loop-review-rounds").count(), 1, "the number sits in the Review field");
assert.equal(await rounds.inputValue(), "2", "two rounds by default");
assert.deepEqual(await rounds.evaluate((el) => [el.min, el.max, el.disabled]), ["0", "6", false]);
assert.equal(await field.getByText("Applies only with Review on").count(), 0, "no hint while Review is on");
await rounds.fill("4");
await s.page.locator("#loop-review").uncheck();
assert.equal(await rounds.isDisabled(), true, "Review off disables the field");
assert.equal(await field.getByText("Applies only with Review on").count(), 1);
assert.equal(await rounds.inputValue(), "4", "the number is kept while it is off");
await s.page.locator("#loop-review").check();
assert.equal(await rounds.isDisabled(), false);
const body = await s.page.evaluate(async () => {
const { page } = await import(new URL("state.js", document.baseURI).href);
const { setupBody } = await import(new URL("screens/loop-setup.js", document.baseURI).href);
return setupBody(page.loopSetup.form, page.loopSetup);
});
assert.equal(body.reviewRounds, 4, "the number is in the posted body");
const saved = await s.page.evaluate(async () => {
const { page } = await import(new URL("state.js", document.baseURI).href);
const { setupBody } = await import(new URL("screens/loop-setup.js", document.baseURI).href);
const res = await fetch("/loop-setup", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(setupBody(page.loopSetup.form, page.loopSetup)) });
return { status: res.status, body: await res.json() };
});
assert.equal(saved.status, 200, JSON.stringify(saved.body));
const reread = await s.page.evaluate(async () => (await fetch("/loop-setup")).json());
assert.equal(reread.reviewRounds, 4, "remembered with the rest of the setup");
});