Public: anyone can read this; the crew can change it.

The planner's plan route says in its refusal which of its own rules refused a plan #13267

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

scout/forge:scout/13264-the-planner-s-plan-route-says-in-its-ref → main 2 commits fork 1 thread · 1 unresolved

  • Merged. scout/13264-the-planner-s-plan-route-says-in-its-ref was merged into main as d234288.

Review

Sign in to review this change.
3 files changed +31 −4
src/actions/plan.ts +4 −3
@@ -157,7 +157,7 @@ export function parsePlan(raw: unknown): Result<PlanItem[], PlanError> {
157157 if (alike !== undefined)
158158 return refuse(
159159 "look_alike",
160 `${alike.map((item) => `"${item.key}"`).join(", ")} are one change on ${alike.length} things: open one issue for it whose body lists each as a checkbox, not one issue each`,
160 `${alike.map((item) => `"${item.key}"`).join(", ")} are one change on ${alike.length} things, and the rule is that three or more items of one shape are one issue: replace them with one issue whose body lists each as a checkbox, then post the plan again`,
161161 );
162162 return ok(items);
163163 }
@@ -231,7 +231,8 @@ function vet(
231231 );
232232
233233 // A person's note from an app is owed an answer before the planner adds to the pile (#10563).
234 // Only the repo's planner is held; it lifts when a crew member comments, or the issue is closed or hidden.
234 // Only the repo's planner is held; it lifts when a crew member comments, or the issue is closed
235 // or hidden.
235236 if (actor.kind === "agent" && crewRole(app.db, repo.id, actor.id) === "planner") {
236237 if (pausedUntil(app.db, repo.id, new Date()) !== null) return refuse("planner_paused", PAUSE_REFUSAL);
237238 const held = ceilingHold(app.db, repo.id, items.every((i) => hasEvidence(i.body)) ? EVIDENCE_ROOM : 0);
@@ -298,7 +299,7 @@ function vet(
298299 } else if (pillars.length > 0)
299300 return refuse(
300301 "no_pillar",
301 `"${item.key}" names no pillar: give it ${namesOf(pillars)}, or later: true and why`,
302 `"${item.key}" names no pillar, and the rule is that every item serves a pillar or is for later: give it ${namesOf(pillars)}, or later: true with why, then post the plan again`,
302303 );
303304 }
304305 return ok({ actor, existing, serves, gate, later });
test/plan-pillars.test.ts +1 −1
@@ -146,7 +146,7 @@ describe("a plan says what each issue is for", () => {
146146 ]);
147147 expect(refused.error).toContain("no_pillar");
148148 expect(refused.error).toContain(
149 '"slider" names no pillar: give it P0 Trust or P1 Feed, or later: true and why',
149 '"slider" names no pillar, and the rule is that every item serves a pillar or is for later: give it P0 Trust or P1 Feed, or later: true with why, then post the plan again',
150150 );
151151 expect((await mapOf("alice/forge")).issues.length).toBe(before);
152152 });
test/plan-route.test.ts +26
@@ -131,6 +131,32 @@ describe("POST …/plan", () => {
131131 expect(proposals()).toBe(stored);
132132 });
133133
134 test("a look-alike plan is refused with the item keys, the rule and what to change", async () => {

Nothing asserts the sentence reaches the planner run log (box 2). Add a test that reads it there.

135 nod(false);
136 const before = titles().length;
137 const shape = (x: string) => `The ${x} list is keyboard-first: j/k move between rows, enter opens one`;
138 const res = await post(
139 rw,
140 ["builds", "backups", "webhooks"].map((x, n) => ({ key: `k${n}`, title: shape(x), pillar: "P0" })),
141 );
142 expect(res.status).toBe(422);
143 const body = (await res.json()) as { error: string; message: string };
144 expect(body.error).toBe("look_alike");
145 expect(body.message).toContain('"k0", "k1", "k2" are one change on 3 things, and the rule is');
146 expect(body.message).toContain("checkbox, then post the plan again");
147 expect(titles().length).toBe(before);
148 });
149
150 test("a no_pillar refusal names the item, the rule and the fix", async () => {
151 nod(false);
152 const res = await post(rw, [{ key: "weeds", title: "Pull the weeds" }]);
153 expect(res.status).toBe(422);
154 const body = (await res.json()) as { error: string; message: string };
155 expect(body.error).toBe("no_pillar");
156 expect(body.message).toContain('"weeds" names no pillar, and the rule is');
157 expect(body.message).toContain("or later: true with why, then post the plan again");
158 });
159
134160 test("off, the plan opens its issues as before and stores no proposal", async () => {
135161 nod(false);
136162 const stored = proposals();

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs