Files
pi-plan/test/tick-goal.test.ts
wassnameandClaudypoo 92d3f6d725 sign-off ticks the goal [x] itself + document that the judge reads the working tree, not HEAD
Dogfood exit interview: agent bookkeeping is the drift point (tick after accept was the
step most likely forgotten), and 'committed artifact' language implied the judge sees HEAD.
Tick is exact-subject match via the existing GOAL_LINE regex; on drift the result explicitly
asks the agent to tick, so neither path is silent.

Co-Authored-By: Claudypoo <288921227+claudypoo@users.noreply.github.com>
2026-07-03 11:49:31 +08:00

33 lines
1.0 KiB
TypeScript

import { describe, expect, it } from "vitest";
import { tickGoal } from "../src/index.js";
const plan = `# Plan
## Goals
1. [/] goal: Implement the cache layer
- tasks:
1. [x] wire client
2. [ ] goal: Ship the docs
## Log
`;
describe("tickGoal (sign-off ticks the goal; agent only ticks on wording drift)", () => {
it("ticks the exact-matching goal line, case-insensitive, leaving subtasks alone", () => {
const out = tickGoal(plan, "implement the CACHE layer");
expect(out).toContain("1. [x] goal: Implement the cache layer");
expect(out).toContain("1. [x] wire client"); // subtask untouched (was already x)
expect(out).toContain("2. [ ] goal: Ship the docs"); // other goal untouched
});
it("returns null on wording drift (fuzzy matching is the judge's job, not TypeScript's)", () => {
expect(tickGoal(plan, "Implement caching")).toBeNull();
});
it("returns null when the subject matches more than one goal line", () => {
const dup = `${plan}3. [ ] goal: Ship the docs\n`;
expect(tickGoal(dup, "Ship the docs")).toBeNull();
});
});