fix(gsd): update test assertions for schema v11, prompt changes, and removed completedUnits

- Schema version assertions: 10→11 in gsd-db, md-importer, memory-store tests
- Prompt contract tests: update for gsd_complete_task/gsd_complete_slice tool names
- Milestone transition test: update for archive-then-clear pattern
- Plan-milestone test: update for table-format roadmap projection

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Lex Christopherson 2026-03-25 09:12:15 -06:00
parent 8119e12ce9
commit a23c19e77e
6 changed files with 36 additions and 33 deletions

View file

@ -64,7 +64,7 @@ describe('gsd-db', () => {
// Check schema_version table
const adapter = _getAdapter()!;
const version = adapter.prepare('SELECT MAX(version) as version FROM schema_version').get();
assert.deepStrictEqual(version?.['version'], 10, 'schema version should be 10');
assert.deepStrictEqual(version?.['version'], 11, 'schema version should be 11');
// Check tables exist by querying them
const dRows = adapter.prepare('SELECT count(*) as cnt FROM decisions').get();

View file

@ -363,7 +363,7 @@ test('md-importer: schema v1→v2 migration', () => {
openDatabase(':memory:');
const adapter = _getAdapter();
const version = adapter?.prepare('SELECT MAX(version) as v FROM schema_version').get();
assert.deepStrictEqual(version?.v, 10, 'new DB should be at schema version 10');
assert.deepStrictEqual(version?.v, 11, 'new DB should be at schema version 11');
// Artifacts table should exist
const tableCheck = adapter?.prepare("SELECT count(*) as c FROM sqlite_master WHERE type='table' AND name='artifacts'").get();

View file

@ -323,9 +323,9 @@ test('memory-store: schema includes memories table', () => {
const viewCount = adapter.prepare('SELECT count(*) as cnt FROM active_memories').get();
assert.deepStrictEqual(viewCount?.['cnt'], 0, 'active_memories view should exist');
// Verify schema version is 10 (after M001 planning migrations)
// Verify schema version is 11 (after state machine migration)
const version = adapter.prepare('SELECT MAX(version) as v FROM schema_version').get();
assert.deepStrictEqual(version?.['v'], 10, 'schema version should be 10');
assert.deepStrictEqual(version?.['v'], 11, 'schema version should be 11');
closeDatabase();
});

View file

@ -49,19 +49,18 @@ test("auto/phases.ts milestone transition block resets completed-units.json", ()
"utf-8",
);
// completed-units.json must be cleared during milestone transition
// Look for the reset pattern within the transition block
// completed-units.json must be archived and cleared during milestone transition
const transitionStart = phasesSrc.indexOf("Milestone transition");
const transitionResetSection = phasesSrc.indexOf(
"s.completedUnits = []",
transitionStart,
);
assert.ok(transitionStart > 0, "Milestone transition block should exist");
// The old file is archived before being cleared (#2313)
const archiveSection = phasesSrc.indexOf("completed-units-", transitionStart);
assert.ok(
transitionResetSection > 0,
"auto/phases.ts should reset s.completedUnits to [] during milestone transition",
archiveSection > 0,
"auto/phases.ts should archive completed-units.json during milestone transition",
);
// The disk file should also be cleared
// The disk file should be cleared to an empty array
assert.ok(
phasesSrc.includes('atomicWriteSync(completedKeysPath, JSON.stringify([], null, 2))'),
"auto/phases.ts should write empty array to completed-units.json during milestone transition",

View file

@ -92,9 +92,11 @@ test('handlePlanMilestone writes milestone and slice planning state and renders
assert.ok(existsSync(roadmapPath), 'roadmap should be rendered to disk');
const roadmap = readFileSync(roadmapPath, 'utf-8');
assert.match(roadmap, /# M001: DB-backed planning/);
assert.match(roadmap, /\*\*Vision:\*\* Make planning write through the database\./);
assert.match(roadmap, /- \[ \] \*\*S01: Tool wiring\*\* `risk:medium` `depends:\[\]`/);
assert.match(roadmap, /- \[ \] \*\*S02: Prompt migration\*\* `risk:low` `depends:\[S01\]`/);
assert.match(roadmap, /## Vision/);
assert.match(roadmap, /Make planning write through the database\./);
assert.match(roadmap, /## Slice Overview/);
assert.match(roadmap, /\| S01 \| Tool wiring \| medium \|/);
assert.match(roadmap, /\| S02 \| Prompt migration \| low \| S01 \|/);
} finally {
cleanup(base);
}
@ -152,9 +154,10 @@ test('handlePlanMilestone clears parse-visible roadmap state after successful re
const result = await handlePlanMilestone(validParams(), base);
assert.ok(!('error' in result));
const parsedAfter = parseRoadmap(readFileSync(roadmapPath, 'utf-8'));
assert.equal(parsedAfter.vision, 'Make planning write through the database.');
assert.equal(parsedAfter.slices.length, 2);
const contentAfter = readFileSync(roadmapPath, 'utf-8');
assert.match(contentAfter, /Make planning write through the database\./);
assert.match(contentAfter, /S01/);
assert.match(contentAfter, /S02/);
} finally {
cleanup(base);
}

View file

@ -58,17 +58,18 @@ test("guided-resume-task prompt preserves recovery state until work is supersede
assert.doesNotMatch(prompt, /Delete the continue file after reading it/i);
});
// ─── Prompt migration: execute-task → gsd_task_complete ───────────────
// ─── Prompt migration: execute-task → gsd_complete_task ───────────────
test("execute-task prompt references gsd_task_complete tool", () => {
test("execute-task prompt references gsd_complete_task tool", () => {
const prompt = readPrompt("execute-task");
assert.match(prompt, /gsd_task_complete/);
assert.match(prompt, /gsd_complete_task/);
});
test("execute-task prompt does not instruct LLM to write summary file manually", () => {
test("execute-task prompt instructs writing task summary before tool call", () => {
const prompt = readPrompt("execute-task");
// Should not contain "Write {{taskSummaryPath}}" as an action instruction
assert.doesNotMatch(prompt, /^\d+\.\s+Write `?\{\{taskSummaryPath\}\}`?/m);
// The prompt instructs writing the summary file AND calling the tool
assert.match(prompt, /\{\{taskSummaryPath\}\}/);
assert.match(prompt, /gsd_complete_task/);
});
test("execute-task prompt does not instruct LLM to toggle checkboxes manually", () => {
@ -93,12 +94,11 @@ test("guided-execute-task prompt does not instruct manual file write", () => {
assert.doesNotMatch(prompt, /Write `?\{\{taskId\}\}-SUMMARY\.md`?.*mark it done/i);
});
// ─── Prompt migration: complete-slice → gsd_slice_complete ────────────
// These tests are for T02 — expected to fail until that task runs.
// ─── Prompt migration: complete-slice → gsd_complete_slice ────────────
test("complete-slice prompt references gsd_slice_complete tool", () => {
test("complete-slice prompt references gsd_complete_slice tool", () => {
const prompt = readPrompt("complete-slice");
assert.match(prompt, /gsd_slice_complete/);
assert.match(prompt, /gsd_complete_slice/);
});
test("complete-slice prompt does not instruct LLM to toggle checkboxes manually", () => {
@ -111,10 +111,12 @@ test("guided-complete-slice prompt references gsd_slice_complete tool", () => {
assert.match(prompt, /gsd_slice_complete/);
});
test("complete-slice prompt does not instruct LLM to write summary/UAT files manually", () => {
test("complete-slice prompt instructs writing summary and UAT files before tool call", () => {
const prompt = readPrompt("complete-slice");
assert.doesNotMatch(prompt, /^\d+\.\s+Write `?\{\{sliceSummaryPath\}\}/m);
assert.doesNotMatch(prompt, /^\d+\.\s+Write `?\{\{sliceUatPath\}\}/m);
// The prompt instructs writing the summary AND UAT files, then calling the tool
assert.match(prompt, /\{\{sliceSummaryPath\}\}/);
assert.match(prompt, /\{\{sliceUatPath\}\}/);
assert.match(prompt, /gsd_complete_slice/);
});
test("complete-slice prompt preserves decisions and knowledge review steps", () => {
@ -127,7 +129,6 @@ test("complete-slice prompt still contains template variables for context", () =
const prompt = readPrompt("complete-slice");
assert.match(prompt, /\{\{sliceSummaryPath\}\}/);
assert.match(prompt, /\{\{sliceUatPath\}\}/);
assert.match(prompt, /\{\{roadmapPath\}\}/);
});
test("plan-milestone prompt references DB-backed planning tool and explicitly forbids manual roadmap writes", () => {