Files
pi-goals/test/plan-view.test.ts
T
wassnameandPi/OpenAI 6fa518fc49 Fix goal state recovery, approval invalidation and worker tracking
Unify Log boundaries, serialize completion edits, preserve immutable session state and solo recovery, and match stock worker execution events. Remove unused plan views and brittle prose checks; correct installation and context guidance.

Co-Authored-By: Pi/OpenAI <288921227+claudypoo@users.noreply.github.com>
2026-09-12 15:01:43 +08:00

20 lines
1.1 KiB
TypeScript

import { expect, it } from "vitest";
import { planViews } from "../src/plan-view.js";
it.each(["", " "])("ignores %sindented identity bookkeeping and Log edits, but reviews tasks and goals", indent => {
const base = `# Plan\n- [ ] goal: result\n - tasks:\n - [ ] run it\n${indent}- worker session: /saved.jsonl\n## Log\nfirst entry`;
const view = planViews(base).notify;
expect(planViews(base.replace("/saved.jsonl", "/moved.jsonl")).notify).toBe(view);
expect(planViews(base.replace("first entry", "second entry")).notify).toBe(view);
expect(planViews(base.replace("- [ ] run it", "- [x] run it")).notify).not.toBe(view);
expect(planViews(base.replace("[ ] goal: result", "[x] goal: result")).notify).not.toBe(view);
});
it("uses Log as the boundary even when Interview precedes Goals", () => {
const plan = "# Plan\n## Interview\nOriginal discussion\n## Goals\n- [ ] goal: output\n### Log\n- [ ] goal: archived";
const view = planViews(plan).notify;
expect(view).toContain("goal: output");
expect(view).not.toContain("archived");
expect(planViews(plan.replace("goal: output", "goal: changed output")).notify).not.toBe(view);
});