mirror of
https://github.com/jparkerweb/plan2code.git
synced 2026-11-17 04:45:33 -08:00
Clear a pressed Review when a different finish replaces it
AI Assisted
This commit is contained in:
1 parent
dd86279e88
commit
d4b604ba7f
6 files changed
+37
-1
No files matched your search
@@ -1042,6 +1042,23 @@ test("Before you close this shows while a review is on offer, goes while it is a
|
|||||||
assert.equal(await closeGuide(s).count(), 0, "the guide came back on a reload");
|
assert.equal(await closeGuide(s).count(), 0, "the guide came back on a reload");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// What a person sees break: Commit, Changelog and Dashboard dead on the finish after a review, because the agent posted the new finish without clearing the old one.
|
||||||
|
test("a different finish posted over a pressed Review starts with its own buttons live", async (t) => {
|
||||||
|
const s = await openSession(await suite.browser(), { t, workflow: "quick-task", payload: { agent: { status: "working", activity: "Task 1 of 1" } } });
|
||||||
|
s.post({ finish: OFFERS });
|
||||||
|
const main = s.page.locator("#main");
|
||||||
|
await main.getByRole("button", { name: "Review it now" }).click();
|
||||||
|
await main.getByRole("button", { name: "Review requested…" }).waitFor();
|
||||||
|
collect(s);
|
||||||
|
s.post({ finish: { ...OFFERS, headline: "The review is done", review: false } });
|
||||||
|
await main.getByRole("heading", { name: "The review is done" }).waitFor();
|
||||||
|
await s.page.waitForFunction(() => {
|
||||||
|
const b = [...document.querySelectorAll("#main button")].find((x) => x.textContent.trim() === "Commit it now");
|
||||||
|
return b && !b.disabled;
|
||||||
|
});
|
||||||
|
assert.equal(await main.getByRole("button", { name: "Commit it now" }).isEnabled(), true, "Commit stayed dead after the new finish");
|
||||||
|
});
|
||||||
|
|
||||||
// What a person sees break: the guide missing while a commit or the dashboard
|
// What a person sees break: the guide missing while a commit or the dashboard
|
||||||
// is starting (it would say "start a new one" under "Opening Git"), or missing
|
// is starting (it would say "start a new one" under "Opening Git"), or missing
|
||||||
// once they said they are done or the server is gone.
|
// once they said they are done or the server is gone.
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ test("state: page starts as app.js always started it", () => {
|
|||||||
sent: {},
|
sent: {},
|
||||||
stopping: null,
|
stopping: null,
|
||||||
afterBuild: null,
|
afterBuild: null,
|
||||||
|
afterBuildFinish: null,
|
||||||
homeward: null,
|
homeward: null,
|
||||||
launching: null,
|
launching: null,
|
||||||
deleting: null,
|
deleting: null,
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ import { FOOTER_TIERS, footerLabel } from "../workspace.js";
|
|||||||
import {
|
import {
|
||||||
activity, agentAdrift, agentWorking, askBusy, loopDriving, loopWaiting, loopWaitingKey, asked, awaitingReply, byId, dashboardLive, docs, doingNow,
|
activity, agentAdrift, agentWorking, askBusy, loopDriving, loopWaiting, loopWaitingKey, asked, awaitingReply, byId, dashboardLive, docs, doingNow,
|
||||||
AGENTS_VIEW, agentsTabShown, finish, gitAwaiting, isDashboard, isGitBoard, isOpen, isSpecFileView, items, loadAgentsDoc, loadOverview, myTurn, openItems,
|
AGENTS_VIEW, agentsTabShown, finish, gitAwaiting, isDashboard, isGitBoard, isOpen, isSpecFileView, items, loadAgentsDoc, loadOverview, myTurn, openItems,
|
||||||
patience, pressStranded, reviewPending, scan, selSpec, sendCollected, specFileTabs, stagedCount, stranded,
|
finishKey, patience, pressStranded, reviewPending, scan, selSpec, sendCollected, specFileTabs, stagedCount, stranded,
|
||||||
topics, workingMs, WORKING_GRACE_MS,
|
topics, workingMs, WORKING_GRACE_MS,
|
||||||
workspaceFolders,
|
workspaceFolders,
|
||||||
} from "../selectors.js";
|
} from "../selectors.js";
|
||||||
@@ -394,6 +394,15 @@ export function adopt(body) {
|
|||||||
// with its own offer unanswered.
|
// with its own offer unanswered.
|
||||||
if (!finish() && page.local.afterBuild) {
|
if (!finish() && page.local.afterBuild) {
|
||||||
page.local.afterBuild = null;
|
page.local.afterBuild = null;
|
||||||
|
page.local.afterBuildFinish = null;
|
||||||
|
save();
|
||||||
|
}
|
||||||
|
// Same when the agent took the review up and posted a different finish
|
||||||
|
// without clearing the old one: the press was on the old finish, so the new
|
||||||
|
// finish's Commit, Changelog and Dashboard start live.
|
||||||
|
if (page.local.afterBuild === "review" && finish() && page.local.afterBuildFinish && page.local.afterBuildFinish !== finishKey(finish())) {
|
||||||
|
page.local.afterBuild = null;
|
||||||
|
page.local.afterBuildFinish = null;
|
||||||
save();
|
save();
|
||||||
}
|
}
|
||||||
// A way home that ended in a finish instead (the agent paused rather than
|
// A way home that ended in a finish instead (the agent paused rather than
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ import {
|
|||||||
reviewPending,
|
reviewPending,
|
||||||
docs,
|
docs,
|
||||||
finish,
|
finish,
|
||||||
|
finishKey,
|
||||||
agentAdrift,
|
agentAdrift,
|
||||||
agentWorking,
|
agentWorking,
|
||||||
awaitingReply,
|
awaitingReply,
|
||||||
@@ -645,6 +646,7 @@ async function sendAfterBuild(kind, launch = null) {
|
|||||||
}
|
}
|
||||||
if (!res.ok) throw new Error(String(res.status));
|
if (!res.ok) throw new Error(String(res.status));
|
||||||
page.local.afterBuild = kind;
|
page.local.afterBuild = kind;
|
||||||
|
page.local.afterBuildFinish = finishKey(finish());
|
||||||
page.pendingResult = true;
|
page.pendingResult = true;
|
||||||
saveNow();
|
saveNow();
|
||||||
const started = {
|
const started = {
|
||||||
|
|||||||
@@ -71,6 +71,11 @@ export const stagedCount = () => Object.keys(page.local.staged).length;
|
|||||||
// sessions end with nothing left to run.
|
// sessions end with nothing left to run.
|
||||||
export const finish = () => (page.S && page.S.finish && typeof page.S.finish === "object" ? page.S.finish : null);
|
export const finish = () => (page.S && page.S.finish && typeof page.S.finish === "object" ? page.S.finish : null);
|
||||||
|
|
||||||
|
// A finish's identity: what a press was made against. A different finish
|
||||||
|
// replacing it (the agent took the review up and posted a new one without
|
||||||
|
// clearing the old) is a new offer, not the old press's answer.
|
||||||
|
export const finishKey = (fin) => (fin ? JSON.stringify([fin.headline, fin.command, fin.body]) : null);
|
||||||
|
|
||||||
// The dashboard is the one workflow that is not a conversation: a menu of the
|
// The dashboard is the one workflow that is not a conversation: a menu of the
|
||||||
// skills, rendered from the page's own catalog, where a click IS the answer.
|
// skills, rendered from the page's own catalog, where a click IS the answer.
|
||||||
export const isDashboard = () => page.S && page.S.workflow === "dashboard";
|
export const isDashboard = () => page.S && page.S.workflow === "dashboard";
|
||||||
|
|||||||
@@ -42,6 +42,8 @@ export function fresh() {
|
|||||||
sent: {},
|
sent: {},
|
||||||
stopping: null,
|
stopping: null,
|
||||||
afterBuild: null,
|
afterBuild: null,
|
||||||
|
// The finish `afterBuild` was pressed on (finishKey), so a different one is a new offer.
|
||||||
|
afterBuildFinish: null,
|
||||||
homeward: null,
|
homeward: null,
|
||||||
launching: null,
|
launching: null,
|
||||||
// A picker Delete sent and not yet answered by a rescan: { dir, scanAt }.
|
// A picker Delete sent and not yet answered by a rescan: { dir, scanAt }.
|
||||||
|
|||||||
Reference in new issue
Block a user