feat(FN-4063): enforce planning and triage memory write contracts

Enforces memory write contracts for triage and planning agents, adding tests in both `project-memory.test.ts` and `triage.test.ts` to guard the contract boundaries established in `project-memory.ts`.

Fusion-Task-Id: FN-4063

Fusion-Task-Lineage: 5f86295b-d583-4757-9aa5-30a64b2cc2d6
This commit is contained in:
Fusion
2026-05-11 20:40:30 -07:00
committed by gsxdsm
parent 1f7958fc0f
commit 0056b85668
4 changed files with 21 additions and 1 deletions

View File

@@ -536,6 +536,9 @@ describe("project-memory", () => {
const instructions = buildTriageMemoryInstructions(testDir, settings);
expect(instructions).toContain(".fusion/memory/MEMORY.md");
expect(instructions).toContain("## Project Memory");
expect(instructions).toContain("fn_memory_append");
expect(instructions).toContain("Do **not** write");
expect(instructions).toContain("or any other memory files directly");
});
it("includes read-only wording for readonly backend without write directives", () => {
@@ -558,6 +561,8 @@ describe("project-memory", () => {
expect(instructions).not.toContain(".fusion/memory/MEMORY.md");
expect(instructions).toContain("memory_search");
expect(instructions).toContain("memory_get");
expect(instructions).toContain("fn_memory_append");
expect(instructions).toContain("Do **not** write memory files directly");
});
it("QMD triage instructions completeness - contains consult guidance", () => {

View File

@@ -52,7 +52,9 @@ export function createTaskStoreTestHarness() {
afterEach: async () => {
vi.useRealTimers();
store.stopWatching();
await new Promise<void>((resolve) => process.nextTick(resolve));
// Yield one microtask tick without relying on process.nextTick,
// which can be faked in timer-heavy suites and hang teardown.
await Promise.resolve();
store.close();
await rm(rootDir, { recursive: true, force: true, maxRetries: 5, retryDelay: 50 });
await rm(globalDir, { recursive: true, force: true, maxRetries: 5, retryDelay: 50 });