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
Check · Review · Land · Live done — Landed and live in production.
scout/forge:scout/13264-the-planner-s-plan-route-says-in-its-ref → main 2 commits fork 1 thread · 1 unresolved
3 files
changed +31
−4
src/actions/plan.ts +4 −3
| @@ -157,7 +157,7 @@ export function parsePlan(raw: unknown): Result<PlanItem[], PlanError> { | ||
| 157 | 157 | if (alike !== undefined) |
| 158 | 158 | return refuse( |
| 159 | 159 | "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`, | |
| 161 | 161 | ); |
| 162 | 162 | return ok(items); |
| 163 | 163 | } |
| @@ -231,7 +231,8 @@ function vet( | ||
| 231 | 231 | ); |
| 232 | 232 | |
| 233 | 233 | // 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. | |
| 235 | 236 | if (actor.kind === "agent" && crewRole(app.db, repo.id, actor.id) === "planner") { |
| 236 | 237 | if (pausedUntil(app.db, repo.id, new Date()) !== null) return refuse("planner_paused", PAUSE_REFUSAL); |
| 237 | 238 | const held = ceilingHold(app.db, repo.id, items.every((i) => hasEvidence(i.body)) ? EVIDENCE_ROOM : 0); |
| @@ -298,7 +299,7 @@ function vet( | ||
| 298 | 299 | } else if (pillars.length > 0) |
| 299 | 300 | return refuse( |
| 300 | 301 | "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`, | |
| 302 | 303 | ); |
| 303 | 304 | } |
| 304 | 305 | 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", () => { | ||
| 146 | 146 | ]); |
| 147 | 147 | expect(refused.error).toContain("no_pillar"); |
| 148 | 148 | 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', | |
| 150 | 150 | ); |
| 151 | 151 | expect((await mapOf("alice/forge")).issues.length).toBe(before); |
| 152 | 152 | }); |
test/plan-route.test.ts +26
| @@ -131,6 +131,32 @@ describe("POST …/plan", () => { | ||
| 131 | 131 | expect(proposals()).toBe(stored); |
| 132 | 132 | }); |
| 133 | 133 | |
| 134 | test("a look-alike plan is refused with the item keys, the rule and what to change", async () => { | |
| 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 | ||
| 134 | 160 | test("off, the plan opens its issues as before and stores no proposal", async () => { |
| 135 | 161 | nod(false); |
| 136 | 162 | const stored = proposals(); |
new above
offline
Nothing asserts the sentence reaches the planner run log (box 2). Add a test that reads it there.