From 68202d4c04cce4758adfd2e1908108d29e52ed4b Mon Sep 17 00:00:00 2001 From: Divya Chukkapalli <12871391+divya0795@users.noreply.github.com> Date: Sun, 15 Nov 2026 22:54:19 -0800 Subject: [PATCH] fix(pstack): treat fences inside nested list items as code in plan checks check-plan only recognized fences indented 0-3 spaces. A fence inside a nested list item sits at the item's content indent (4+ spaces or a tab), which CommonMark and GitHub still render as a code block, so the checker read its contents as plan prose: style rules fired on the code and `- [ ]` lines inside it were counted as boxes. Accept any leading whitespace on opening and closing fences, and cover both nested-fence plans and prose after them in the CLI tests. The harness mirror is regenerated. --- .../skills/poteto-mode/scripts/check-plan.mjs | 4 ++-- .../skills/poteto-mode/scripts/check-plan.test.ts | 13 +++++++++++++ pstack/skills/poteto-mode/scripts/check-plan.mjs | 4 ++-- .../skills/poteto-mode/scripts/check-plan.test.ts | 13 +++++++++++++ 4 files changed, 30 insertions(+), 4 deletions(-) diff --git a/harness/pstack/claude-code/skills/poteto-mode/scripts/check-plan.mjs b/harness/pstack/claude-code/skills/poteto-mode/scripts/check-plan.mjs index c3ddc39899..2f3f4118ef 100755 --- a/harness/pstack/claude-code/skills/poteto-mode/scripts/check-plan.mjs +++ b/harness/pstack/claude-code/skills/poteto-mode/scripts/check-plan.mjs @@ -46,12 +46,12 @@ if (raw[0] === "---") { const lines = []; let fence = null; const openingFence = (text) => { - const match = text.match(/^ {0,3}(`{3,}|~{3,})(.*)$/); + const match = text.match(/^[ \t]*(`{3,}|~{3,})(.*)$/); if (!match || (match[1][0] === "`" && match[2].includes("`"))) return null; return { char: match[1][0], length: match[1].length }; }; const closingFence = (text, opening) => { - const match = text.match(/^ {0,3}(`+|~+)[ \t]*$/); + const match = text.match(/^[ \t]*(`+|~+)[ \t]*$/); return Boolean( match && match[1][0] === opening.char && diff --git a/harness/pstack/claude-code/skills/poteto-mode/scripts/check-plan.test.ts b/harness/pstack/claude-code/skills/poteto-mode/scripts/check-plan.test.ts index cd1debfa31..8769c59cee 100644 --- a/harness/pstack/claude-code/skills/poteto-mode/scripts/check-plan.test.ts +++ b/harness/pstack/claude-code/skills/poteto-mode/scripts/check-plan.test.ts @@ -69,6 +69,19 @@ test("accepts ordinary, indented, and longer closing fences", () => { runPlan("```markdown\n## Example only\n````\n", 0); }); +test("treats fences inside nested list items as code", () => { + const body = "## Example only\nThis prose has a mid-sentence colon: inside code\n- [ ] Not a box.\n"; + for (const indent of [" ", " ", "\t"]) { + const indented = body.replace(/^/gm, indent); + runPlan(`- [ ] Outer.\n - [ ] Inner.\n\n${indent}\`\`\`yaml\n${indented}${indent}\`\`\`\n`, 0); + } +}); + +test("checks prose after a fence inside a nested list item", () => { + const result = runPlan("- [ ] Outer.\n - [ ] Inner.\n\n ```yaml\n retry: 3\n ```\nThis prose has a mid-sentence colon: bad.\n", 1); + expect(result.stderr).toContain("mid-sentence colon"); +}); + test("accepts nested backticks and tilde info strings", () => { runPlan("````markdown\n```markdown\n## Example only\n```\n````\n", 0); runPlan("~~~markdown `info`\n## Example only\n ~~~\n", 0); diff --git a/pstack/skills/poteto-mode/scripts/check-plan.mjs b/pstack/skills/poteto-mode/scripts/check-plan.mjs index c3ddc39899..2f3f4118ef 100755 --- a/pstack/skills/poteto-mode/scripts/check-plan.mjs +++ b/pstack/skills/poteto-mode/scripts/check-plan.mjs @@ -46,12 +46,12 @@ if (raw[0] === "---") { const lines = []; let fence = null; const openingFence = (text) => { - const match = text.match(/^ {0,3}(`{3,}|~{3,})(.*)$/); + const match = text.match(/^[ \t]*(`{3,}|~{3,})(.*)$/); if (!match || (match[1][0] === "`" && match[2].includes("`"))) return null; return { char: match[1][0], length: match[1].length }; }; const closingFence = (text, opening) => { - const match = text.match(/^ {0,3}(`+|~+)[ \t]*$/); + const match = text.match(/^[ \t]*(`+|~+)[ \t]*$/); return Boolean( match && match[1][0] === opening.char && diff --git a/pstack/skills/poteto-mode/scripts/check-plan.test.ts b/pstack/skills/poteto-mode/scripts/check-plan.test.ts index cd1debfa31..8769c59cee 100644 --- a/pstack/skills/poteto-mode/scripts/check-plan.test.ts +++ b/pstack/skills/poteto-mode/scripts/check-plan.test.ts @@ -69,6 +69,19 @@ test("accepts ordinary, indented, and longer closing fences", () => { runPlan("```markdown\n## Example only\n````\n", 0); }); +test("treats fences inside nested list items as code", () => { + const body = "## Example only\nThis prose has a mid-sentence colon: inside code\n- [ ] Not a box.\n"; + for (const indent of [" ", " ", "\t"]) { + const indented = body.replace(/^/gm, indent); + runPlan(`- [ ] Outer.\n - [ ] Inner.\n\n${indent}\`\`\`yaml\n${indented}${indent}\`\`\`\n`, 0); + } +}); + +test("checks prose after a fence inside a nested list item", () => { + const result = runPlan("- [ ] Outer.\n - [ ] Inner.\n\n ```yaml\n retry: 3\n ```\nThis prose has a mid-sentence colon: bad.\n", 1); + expect(result.stderr).toContain("mid-sentence colon"); +}); + test("accepts nested backticks and tilde info strings", () => { runPlan("````markdown\n```markdown\n## Example only\n```\n````\n", 0); runPlan("~~~markdown `info`\n## Example only\n ~~~\n", 0);