mirror of
https://github.com/wassname/pi-plan.git
synced 2026-09-26 14:10:23 +08:00
Use explicit hello requests and replies, keep workers unready until model restoration succeeds, distinguish paused peers, and align all goal readers at the Log boundary. Add two-real-adapter handshake and failed-Ready/clear-during-wait regressions; warn once for unavailable supervisor context usage.
40 lines
1.4 KiB
TypeScript
40 lines
1.4 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.replace("## Log", "3. [ ] goal: Ship the docs\n\n## Log");
|
|
expect(tickGoal(dup, "Ship the docs")).toBeNull();
|
|
});
|
|
|
|
it("ignores a historical duplicate below the Log and leaves it unchanged", () => {
|
|
const historical = `${plan}3. [ ] goal: Ship the docs\n`;
|
|
const result = tickGoal(historical, "Ship the docs");
|
|
expect(result).toContain("2. [x] goal: Ship the docs");
|
|
expect(result).toContain("## Log\n3. [ ] goal: Ship the docs\n");
|
|
});
|
|
});
|