@opengsd/gsd-pi 1.2.0-dev.d6c5343c → 1.2.0-dev.ddc97c10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/mcp-server.js +2 -1
- package/dist/resources/.managed-resources-content-hash +1 -1
- package/dist/resources/extensions/gsd/auto/orchestrator.js +28 -10
- package/dist/resources/extensions/gsd/auto/phases.js +47 -4
- package/dist/resources/extensions/gsd/auto/session.js +3 -0
- package/dist/resources/extensions/gsd/auto-direct-dispatch.js +3 -2
- package/dist/resources/extensions/gsd/auto-dispatch.js +11 -2
- package/dist/resources/extensions/gsd/auto-model-selection.js +11 -7
- package/dist/resources/extensions/gsd/auto-post-unit.js +18 -6
- package/dist/resources/extensions/gsd/auto-unit-closeout.js +45 -21
- package/dist/resources/extensions/gsd/auto-verification.js +14 -2
- package/dist/resources/extensions/gsd/auto.js +37 -1
- package/dist/resources/extensions/gsd/blocked-models.js +28 -0
- package/dist/resources/extensions/gsd/bootstrap/agent-end-recovery.js +26 -6
- package/dist/resources/extensions/gsd/bootstrap/exec-tools.js +2 -2
- package/dist/resources/extensions/gsd/closeout-wizard.js +92 -0
- package/dist/resources/extensions/gsd/commands/context.js +16 -2
- package/dist/resources/extensions/gsd/commands-handlers.js +46 -3
- package/dist/resources/extensions/gsd/consent-question.js +16 -0
- package/dist/resources/extensions/gsd/crash-recovery.js +8 -3
- package/dist/resources/extensions/gsd/doctor-engine-checks.js +3 -3
- package/dist/resources/extensions/gsd/doctor-git-checks.js +2 -18
- package/dist/resources/extensions/gsd/gsd-command-home.js +22 -12
- package/dist/resources/extensions/gsd/gsd-db.js +2 -1
- package/dist/resources/extensions/gsd/guided-flow.js +6 -3
- package/dist/resources/extensions/gsd/milestone-closeout.js +73 -2
- package/dist/resources/extensions/gsd/milestone-planning-persistence.js +2 -2
- package/dist/resources/extensions/gsd/projection-flush.js +7 -0
- package/dist/resources/extensions/gsd/prompts/complete-slice.md +1 -1
- package/dist/resources/extensions/gsd/prompts/execute-task.md +1 -1
- package/dist/resources/extensions/gsd/prompts/plan-milestone.md +1 -1
- package/dist/resources/extensions/gsd/prompts/plan-slice.md +1 -1
- package/dist/resources/extensions/gsd/prompts/quick-task.md +1 -1
- package/dist/resources/extensions/gsd/prompts/reassess-roadmap.md +1 -1
- package/dist/resources/extensions/gsd/prompts/refine-slice.md +1 -1
- package/dist/resources/extensions/gsd/prompts/replan-slice.md +1 -1
- package/dist/resources/extensions/gsd/prompts/research-milestone.md +1 -1
- package/dist/resources/extensions/gsd/prompts/research-slice.md +1 -1
- package/dist/resources/extensions/gsd/prompts/rewrite-docs.md +1 -1
- package/dist/resources/extensions/gsd/prompts/run-uat.md +1 -1
- package/dist/resources/extensions/gsd/prompts/triage-captures.md +1 -1
- package/dist/resources/extensions/gsd/prompts/validate-milestone.md +1 -1
- package/dist/resources/extensions/gsd/roadmap-slices.js +25 -3
- package/dist/resources/extensions/gsd/session-lock.js +1 -1
- package/dist/resources/extensions/gsd/tool-contract.js +14 -3
- package/dist/resources/extensions/gsd/tools/complete-milestone.js +3 -2
- package/dist/resources/extensions/gsd/tools/complete-slice.js +2 -2
- package/dist/resources/extensions/gsd/tools/complete-task.js +3 -2
- package/dist/resources/extensions/gsd/tools/plan-slice.js +2 -2
- package/dist/resources/extensions/gsd/tools/plan-task.js +2 -2
- package/dist/resources/extensions/gsd/tools/reassess-roadmap.js +2 -2
- package/dist/resources/extensions/gsd/tools/reopen-milestone.js +2 -2
- package/dist/resources/extensions/gsd/tools/reopen-slice.js +2 -2
- package/dist/resources/extensions/gsd/tools/reopen-task.js +2 -2
- package/dist/resources/extensions/gsd/tools/replan-slice.js +2 -2
- package/dist/resources/extensions/gsd/tools/workflow-tool-executors.js +67 -2
- package/dist/resources/extensions/gsd/verification-verdict.js +2 -1
- package/dist/resources/extensions/shared/gsd-browser-cli.js +21 -2
- package/dist/resources/shared/gsd-browser-path-sync.js +214 -0
- package/dist/resources/shared/package-manager-detection.js +1 -1
- package/dist/tsconfig.extensions.tsbuildinfo +1 -1
- package/dist/update-check.d.ts +2 -0
- package/dist/update-check.js +24 -1
- package/dist/update-cmd.js +20 -3
- package/dist/web/standalone/.next/BUILD_ID +1 -1
- package/dist/web/standalone/.next/app-path-routes-manifest.json +12 -12
- package/dist/web/standalone/.next/build-manifest.json +2 -2
- package/dist/web/standalone/.next/prerender-manifest.json +3 -3
- package/dist/web/standalone/.next/server/app/_global-error.html +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.html +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.html +1 -1
- package/dist/web/standalone/.next/server/app/index.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app-paths-manifest.json +12 -12
- package/dist/web/standalone/.next/server/chunks/8357.js +2 -2
- package/dist/web/standalone/.next/server/middleware-build-manifest.js +1 -1
- package/dist/web/standalone/.next/server/pages/404.html +1 -1
- package/dist/web/standalone/.next/server/pages/500.html +1 -1
- package/dist/web/standalone/.next/server/server-reference-manifest.json +1 -1
- package/dist/web/standalone/node_modules/node-pty/build/Makefile +1 -1
- package/package.json +1 -1
- package/packages/cloud-mcp-gateway/package.json +2 -2
- package/packages/contracts/package.json +1 -1
- package/packages/daemon/package.json +4 -4
- package/packages/gsd-agent-core/package.json +5 -5
- package/packages/gsd-agent-modes/package.json +7 -7
- package/packages/mcp-server/dist/cli.js +10 -5
- package/packages/mcp-server/dist/cli.js.map +1 -1
- package/packages/mcp-server/dist/moonshot-tool-schema.d.ts +29 -0
- package/packages/mcp-server/dist/moonshot-tool-schema.d.ts.map +1 -0
- package/packages/mcp-server/dist/moonshot-tool-schema.js +50 -0
- package/packages/mcp-server/dist/moonshot-tool-schema.js.map +1 -0
- package/packages/mcp-server/dist/server.d.ts.map +1 -1
- package/packages/mcp-server/dist/server.js +4 -0
- package/packages/mcp-server/dist/server.js.map +1 -1
- package/packages/mcp-server/dist/workflow-tools.d.ts +18 -18
- package/packages/mcp-server/dist/workflow-tools.d.ts.map +1 -1
- package/packages/mcp-server/dist/workflow-tools.js +99 -38
- package/packages/mcp-server/dist/workflow-tools.js.map +1 -1
- package/packages/mcp-server/package.json +5 -4
- package/packages/native/package.json +1 -1
- package/packages/pi-agent-core/package.json +1 -1
- package/packages/pi-ai/dist/index.d.ts +2 -0
- package/packages/pi-ai/dist/index.d.ts.map +1 -1
- package/packages/pi-ai/dist/index.js +2 -0
- package/packages/pi-ai/dist/index.js.map +1 -1
- package/packages/pi-ai/dist/providers/anthropic.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/anthropic.js +12 -7
- package/packages/pi-ai/dist/providers/anthropic.js.map +1 -1
- package/packages/pi-ai/dist/providers/google-shared.d.ts +5 -0
- package/packages/pi-ai/dist/providers/google-shared.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/google-shared.js +12 -3
- package/packages/pi-ai/dist/providers/google-shared.js.map +1 -1
- package/packages/pi-ai/dist/providers/openai-completions.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/openai-completions.js +7 -3
- package/packages/pi-ai/dist/providers/openai-completions.js.map +1 -1
- package/packages/pi-ai/dist/utils/moonshot-tool-schema.d.ts +9 -0
- package/packages/pi-ai/dist/utils/moonshot-tool-schema.d.ts.map +1 -0
- package/packages/pi-ai/dist/utils/moonshot-tool-schema.js +34 -0
- package/packages/pi-ai/dist/utils/moonshot-tool-schema.js.map +1 -0
- package/packages/pi-ai/dist/utils/oauth/github-copilot.d.ts.map +1 -1
- package/packages/pi-ai/dist/utils/oauth/github-copilot.js +6 -2
- package/packages/pi-ai/dist/utils/oauth/github-copilot.js.map +1 -1
- package/packages/pi-ai/package.json +1 -1
- package/packages/pi-coding-agent/package.json +7 -7
- package/packages/pi-tui/package.json +2 -2
- package/packages/rpc-client/package.json +2 -2
- package/pkg/package.json +1 -1
- package/src/resources/extensions/browser-tools/tests/gsd-browser-launch-config.test.mjs +11 -0
- package/src/resources/extensions/gsd/auto/orchestrator.ts +28 -10
- package/src/resources/extensions/gsd/auto/phases.ts +63 -24
- package/src/resources/extensions/gsd/auto/session.ts +3 -0
- package/src/resources/extensions/gsd/auto-direct-dispatch.ts +10 -16
- package/src/resources/extensions/gsd/auto-dispatch.ts +11 -10
- package/src/resources/extensions/gsd/auto-model-selection.ts +16 -7
- package/src/resources/extensions/gsd/auto-post-unit.ts +21 -6
- package/src/resources/extensions/gsd/auto-unit-closeout.ts +83 -28
- package/src/resources/extensions/gsd/auto-verification.ts +18 -2
- package/src/resources/extensions/gsd/auto.ts +44 -1
- package/src/resources/extensions/gsd/blocked-models.ts +49 -0
- package/src/resources/extensions/gsd/bootstrap/agent-end-recovery.ts +34 -5
- package/src/resources/extensions/gsd/bootstrap/exec-tools.ts +2 -2
- package/src/resources/extensions/gsd/closeout-wizard.ts +102 -0
- package/src/resources/extensions/gsd/commands/context.ts +16 -2
- package/src/resources/extensions/gsd/commands-handlers.ts +46 -3
- package/src/resources/extensions/gsd/consent-question.ts +15 -0
- package/src/resources/extensions/gsd/crash-recovery.ts +10 -2
- package/src/resources/extensions/gsd/doctor-engine-checks.ts +3 -3
- package/src/resources/extensions/gsd/doctor-git-checks.ts +2 -19
- package/src/resources/extensions/gsd/gsd-command-home.ts +13 -3
- package/src/resources/extensions/gsd/gsd-db.ts +4 -3
- package/src/resources/extensions/gsd/guided-flow.ts +21 -26
- package/src/resources/extensions/gsd/milestone-closeout.ts +97 -2
- package/src/resources/extensions/gsd/milestone-planning-persistence.ts +2 -2
- package/src/resources/extensions/gsd/projection-flush.ts +20 -0
- package/src/resources/extensions/gsd/prompts/complete-slice.md +1 -1
- package/src/resources/extensions/gsd/prompts/execute-task.md +1 -1
- package/src/resources/extensions/gsd/prompts/plan-milestone.md +1 -1
- package/src/resources/extensions/gsd/prompts/plan-slice.md +1 -1
- package/src/resources/extensions/gsd/prompts/quick-task.md +1 -1
- package/src/resources/extensions/gsd/prompts/reassess-roadmap.md +1 -1
- package/src/resources/extensions/gsd/prompts/refine-slice.md +1 -1
- package/src/resources/extensions/gsd/prompts/replan-slice.md +1 -1
- package/src/resources/extensions/gsd/prompts/research-milestone.md +1 -1
- package/src/resources/extensions/gsd/prompts/research-slice.md +1 -1
- package/src/resources/extensions/gsd/prompts/rewrite-docs.md +1 -1
- package/src/resources/extensions/gsd/prompts/run-uat.md +1 -1
- package/src/resources/extensions/gsd/prompts/triage-captures.md +1 -1
- package/src/resources/extensions/gsd/prompts/validate-milestone.md +1 -1
- package/src/resources/extensions/gsd/roadmap-slices.ts +28 -3
- package/src/resources/extensions/gsd/session-lock.ts +1 -1
- package/src/resources/extensions/gsd/tests/auto-model-selection.test.ts +69 -0
- package/src/resources/extensions/gsd/tests/auto-orchestrator.test.ts +97 -0
- package/src/resources/extensions/gsd/tests/auto-remote-session-lock-cleanup.test.ts +65 -3
- package/src/resources/extensions/gsd/tests/blocked-models.test.ts +19 -0
- package/src/resources/extensions/gsd/tests/consent-question.test.ts +15 -0
- package/src/resources/extensions/gsd/tests/doctor-git-checks-terminal.test.ts +73 -0
- package/src/resources/extensions/gsd/tests/gsd-command-home.test.ts +120 -0
- package/src/resources/extensions/gsd/tests/guided-dispatch-root.test.ts +2 -6
- package/src/resources/extensions/gsd/tests/milestone-closeout.test.ts +95 -4
- package/src/resources/extensions/gsd/tests/parsers-legacy-importers.test.ts +0 -1
- package/src/resources/extensions/gsd/tests/phases-terminal-complete-idempotent.test.ts +242 -0
- package/src/resources/extensions/gsd/tests/post-exec-retry-bypass.test.ts +63 -2
- package/src/resources/extensions/gsd/tests/roadmap-slices.test.ts +68 -0
- package/src/resources/extensions/gsd/tests/runtime-invariant-modules.test.ts +19 -1
- package/src/resources/extensions/gsd/tests/tool-unavailable-retry.test.ts +33 -0
- package/src/resources/extensions/gsd/tests/transport-gate-double-complete.test.ts +139 -0
- package/src/resources/extensions/gsd/tests/verification-verdict.test.ts +2 -0
- package/src/resources/extensions/gsd/tests/workflow-tool-executors.test.ts +273 -38
- package/src/resources/extensions/gsd/tool-contract.ts +38 -3
- package/src/resources/extensions/gsd/tools/complete-milestone.ts +3 -2
- package/src/resources/extensions/gsd/tools/complete-slice.ts +2 -2
- package/src/resources/extensions/gsd/tools/complete-task.ts +3 -2
- package/src/resources/extensions/gsd/tools/plan-slice.ts +2 -2
- package/src/resources/extensions/gsd/tools/plan-task.ts +2 -2
- package/src/resources/extensions/gsd/tools/reassess-roadmap.ts +2 -2
- package/src/resources/extensions/gsd/tools/reopen-milestone.ts +2 -2
- package/src/resources/extensions/gsd/tools/reopen-slice.ts +2 -2
- package/src/resources/extensions/gsd/tools/reopen-task.ts +2 -2
- package/src/resources/extensions/gsd/tools/replan-slice.ts +2 -2
- package/src/resources/extensions/gsd/tools/workflow-tool-executors.ts +81 -2
- package/src/resources/extensions/gsd/verification-verdict.ts +4 -2
- package/src/resources/extensions/shared/gsd-browser-cli.ts +23 -2
- package/src/resources/shared/gsd-browser-path-sync.ts +273 -0
- package/src/resources/shared/package-manager-detection.ts +1 -1
- /package/dist/web/standalone/.next/static/{jmTLg6xZmAuq_LIqKOxrH → McokybTayhff1xEVc-d3T}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{jmTLg6xZmAuq_LIqKOxrH → McokybTayhff1xEVc-d3T}/_ssgManifest.js +0 -0
|
@@ -3,22 +3,24 @@
|
|
|
3
3
|
|
|
4
4
|
import test from "node:test";
|
|
5
5
|
import assert from "node:assert/strict";
|
|
6
|
-
import { mkdtempSync, mkdirSync, writeFileSync, rmSync } from "node:fs";
|
|
6
|
+
import { mkdtempSync, mkdirSync, writeFileSync, rmSync, existsSync, readFileSync } from "node:fs";
|
|
7
7
|
import { join } from "node:path";
|
|
8
8
|
import { tmpdir } from "node:os";
|
|
9
9
|
import { openDatabase, insertAssessment, insertMilestone, insertSlice, closeDatabase } from "../gsd-db.js";
|
|
10
10
|
import {
|
|
11
11
|
isMilestoneCloseoutSettled,
|
|
12
12
|
evaluateCompleteMilestoneDispatch,
|
|
13
|
+
isCompletedMilestoneTerminal,
|
|
14
|
+
repairMissingMilestoneSummaryProjection,
|
|
13
15
|
} from "../milestone-closeout.js";
|
|
14
16
|
import type { DispatchContext } from "../auto-dispatch.js";
|
|
15
17
|
|
|
16
18
|
/** Build a minimal DispatchContext for the dispatch-policy branches under test. */
|
|
17
|
-
function makeDispatchCtx(base: string, phase: string): DispatchContext {
|
|
19
|
+
function makeDispatchCtx(base: string, phase: string, mid = "M001"): DispatchContext {
|
|
18
20
|
return {
|
|
19
21
|
basePath: base,
|
|
20
|
-
mid
|
|
21
|
-
midTitle:
|
|
22
|
+
mid,
|
|
23
|
+
midTitle: `${mid}: Test`,
|
|
22
24
|
state: { phase } as DispatchContext["state"],
|
|
23
25
|
prefs: undefined,
|
|
24
26
|
} as DispatchContext;
|
|
@@ -119,3 +121,92 @@ test("evaluateCompleteMilestoneDispatch skips when milestone is already closed",
|
|
|
119
121
|
assert.ok(action, "an already-closed milestone in completing-milestone should yield an action");
|
|
120
122
|
assert.equal(action!.action, "skip", "already-closed milestone should resolve to skip (idempotent)");
|
|
121
123
|
});
|
|
124
|
+
|
|
125
|
+
test("isCompletedMilestoneTerminal accepts DB complete without SUMMARY artifact", async () => {
|
|
126
|
+
const base = mkdtempSync(join(tmpdir(), "gsd-terminal-db-complete-"));
|
|
127
|
+
tmpDirs.push(base);
|
|
128
|
+
mkdirSync(join(base, ".gsd"), { recursive: true });
|
|
129
|
+
openDatabase(join(base, ".gsd", "gsd.db"));
|
|
130
|
+
insertMilestone({ id: "M008", title: "Done", status: "complete" });
|
|
131
|
+
insertSlice({ id: "S01", milestoneId: "M008", title: "Slice", status: "complete" });
|
|
132
|
+
|
|
133
|
+
assert.equal(await isCompletedMilestoneTerminal(base, "M008"), true);
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
test("isCompletedMilestoneTerminal accepts validation-pass with all slices closed", async () => {
|
|
137
|
+
const base = mkdtempSync(join(tmpdir(), "gsd-terminal-validation-pass-"));
|
|
138
|
+
tmpDirs.push(base);
|
|
139
|
+
mkdirSync(join(base, ".gsd"), { recursive: true });
|
|
140
|
+
openDatabase(join(base, ".gsd", "gsd.db"));
|
|
141
|
+
insertMilestone({ id: "M008", title: "Active", status: "active" });
|
|
142
|
+
insertSlice({ id: "S01", milestoneId: "M008", title: "Slice", status: "complete" });
|
|
143
|
+
insertAssessment({
|
|
144
|
+
path: "milestones/M008/M008-VALIDATION.md",
|
|
145
|
+
milestoneId: "M008",
|
|
146
|
+
status: "pass",
|
|
147
|
+
scope: "milestone-validation",
|
|
148
|
+
fullContent: "verdict: pass",
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
assert.equal(await isCompletedMilestoneTerminal(base, "M008"), true);
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
test("evaluateCompleteMilestoneDispatch repairs missing SUMMARY when DB is closed", async () => {
|
|
155
|
+
const base = mkdtempSync(join(tmpdir(), "gsd-dispatch-repair-summary-"));
|
|
156
|
+
tmpDirs.push(base);
|
|
157
|
+
mkdirSync(join(base, ".gsd", "milestones", "M008"), { recursive: true });
|
|
158
|
+
openDatabase(join(base, ".gsd", "gsd.db"));
|
|
159
|
+
insertMilestone({ id: "M008", title: "Live Text Search", status: "complete" });
|
|
160
|
+
insertSlice({ id: "S01", milestoneId: "M008", title: "Slice", status: "complete" });
|
|
161
|
+
insertAssessment({
|
|
162
|
+
path: "milestones/M008/M008-VALIDATION.md",
|
|
163
|
+
milestoneId: "M008",
|
|
164
|
+
status: "pass",
|
|
165
|
+
scope: "milestone-validation",
|
|
166
|
+
fullContent: "verdict: pass",
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
const action = await evaluateCompleteMilestoneDispatch(
|
|
170
|
+
makeDispatchCtx(base, "completing-milestone", "M008"),
|
|
171
|
+
);
|
|
172
|
+
assert.equal(action?.action, "skip");
|
|
173
|
+
assert.ok(
|
|
174
|
+
existsSync(join(base, ".gsd", "milestones", "M008", "M008-SUMMARY.md")),
|
|
175
|
+
"repair should write the missing milestone SUMMARY projection",
|
|
176
|
+
);
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
test("repairMissingMilestoneSummaryProjection succeeds when milestone dir does not exist yet", async () => {
|
|
180
|
+
// Regression: resolveExpectedArtifactPath returns null before the milestone
|
|
181
|
+
// directory exists. The post-write success check must use the handler's
|
|
182
|
+
// returned summaryPath (the absolute path it just created), not the
|
|
183
|
+
// pre-write resolver result, otherwise repair always reports failure and
|
|
184
|
+
// dispatch falls back to re-dispatching complete-milestone.
|
|
185
|
+
const base = mkdtempSync(join(tmpdir(), "gsd-repair-summary-new-dir-"));
|
|
186
|
+
tmpDirs.push(base);
|
|
187
|
+
mkdirSync(join(base, ".gsd"), { recursive: true });
|
|
188
|
+
openDatabase(join(base, ".gsd", "gsd.db"));
|
|
189
|
+
insertMilestone({ id: "M042", title: "Done", status: "complete" });
|
|
190
|
+
|
|
191
|
+
const repair = await repairMissingMilestoneSummaryProjection(base, "M042");
|
|
192
|
+
assert.equal(repair.ok, true, "repair should report success when handler creates the SUMMARY");
|
|
193
|
+
assert.ok(
|
|
194
|
+
existsSync(join(base, ".gsd", "milestones", "M042", "M042-SUMMARY.md")),
|
|
195
|
+
"repair should write the SUMMARY artifact to the canonical projection path",
|
|
196
|
+
);
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
test("repairMissingMilestoneSummaryProjection is idempotent when SUMMARY exists", async () => {
|
|
200
|
+
const base = mkdtempSync(join(tmpdir(), "gsd-repair-summary-idempotent-"));
|
|
201
|
+
tmpDirs.push(base);
|
|
202
|
+
const milestoneDir = join(base, ".gsd", "milestones", "M001");
|
|
203
|
+
mkdirSync(milestoneDir, { recursive: true });
|
|
204
|
+
openDatabase(join(base, ".gsd", "gsd.db"));
|
|
205
|
+
insertMilestone({ id: "M001", title: "Done", status: "complete" });
|
|
206
|
+
const summaryPath = join(milestoneDir, "M001-SUMMARY.md");
|
|
207
|
+
writeFileSync(summaryPath, "# Existing summary\n");
|
|
208
|
+
|
|
209
|
+
const repair = await repairMissingMilestoneSummaryProjection(base, "M001");
|
|
210
|
+
assert.equal(repair.ok, true);
|
|
211
|
+
assert.equal(readFileSync(summaryPath, "utf-8"), "# Existing summary\n");
|
|
212
|
+
});
|
|
@@ -52,7 +52,6 @@ const ALLOWED_IMPORTERS = new Set([
|
|
|
52
52
|
"gsd/auto-recovery.ts",
|
|
53
53
|
// diagnostics-only surfaces: report on projections, make no dispatch decisions
|
|
54
54
|
"gsd/doctor.ts",
|
|
55
|
-
"gsd/doctor-git-checks.ts",
|
|
56
55
|
// display/telemetry-only surfaces
|
|
57
56
|
"gsd/workspace-index.ts",
|
|
58
57
|
"gsd/visualizer-data.ts",
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* phases-terminal-complete-idempotent.test.ts — Regression test for the
|
|
3
|
+
* milestone-completion double-closeout guard in `runPreDispatch`.
|
|
4
|
+
*
|
|
5
|
+
* When `runPreDispatch` observes that the active milestone (or the last one
|
|
6
|
+
* the session was working on) has already been closed by another session,
|
|
7
|
+
* the loop must exit cleanly with `{ action: "break", reason:
|
|
8
|
+
* "milestone-complete" }` and must NOT replay merge, desktop / cmux
|
|
9
|
+
* notifications, unit closeout, or `stopAuto`.
|
|
10
|
+
*
|
|
11
|
+
* There are two `deriveState` shapes the guard must cover, and both are
|
|
12
|
+
* exercised below because the canonical one is easy to miss:
|
|
13
|
+
*
|
|
14
|
+
* 1. `state.phase === "complete"` with `activeMilestone` set, so the
|
|
15
|
+
* loop computes a non-null `mid` from `state.activeMilestone.id`.
|
|
16
|
+
*
|
|
17
|
+
* 2. `state.phase === "complete"` with `activeMilestone: null` — the
|
|
18
|
+
* canonical "all milestones complete" return from `deriveState`
|
|
19
|
+
* (state.ts:613, state.ts:1293). `mid` is undefined here, so the
|
|
20
|
+
* guard must consult `s.currentMilestoneId` (the milestone this
|
|
21
|
+
* session was working on) instead. Without coverage for this case,
|
|
22
|
+
* a guard that only inspects `mid` is unreachable in production and
|
|
23
|
+
* the loop replays `_runMilestoneMergeOnceWithStashRestore`,
|
|
24
|
+
* `sendDesktopNotification("All milestones complete!")`,
|
|
25
|
+
* `logCmuxEvent`, and `stopAuto` — exactly the duplicate side
|
|
26
|
+
* effects this fix exists to prevent.
|
|
27
|
+
*
|
|
28
|
+
* Both fire-paths of the guard (`completionStopInProgress` and a
|
|
29
|
+
* DB-already-closed milestone) are exercised against each shape.
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
import { createTestContext } from "./test-helpers.ts";
|
|
33
|
+
import { runPreDispatch } from "../auto/phases.ts";
|
|
34
|
+
import {
|
|
35
|
+
openDatabase,
|
|
36
|
+
closeDatabase,
|
|
37
|
+
insertMilestone,
|
|
38
|
+
isDbAvailable,
|
|
39
|
+
} from "../gsd-db.ts";
|
|
40
|
+
|
|
41
|
+
const { assertTrue, report } = createTestContext();
|
|
42
|
+
|
|
43
|
+
type SideEffect = string;
|
|
44
|
+
|
|
45
|
+
interface ScenarioOverrides {
|
|
46
|
+
completionStopInProgress: boolean;
|
|
47
|
+
sideEffects: SideEffect[];
|
|
48
|
+
notifications: Array<{ message: string; level?: string }>;
|
|
49
|
+
// When `null`, deriveState returns activeMilestone: null (canonical
|
|
50
|
+
// all-complete path). Otherwise, returns an activeMilestone with this id.
|
|
51
|
+
activeMilestone: { id: string; title: string } | null;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function makeIterationContext(overrides: ScenarioOverrides): any {
|
|
55
|
+
const basePath = "/tmp/gsd-test-terminal-complete";
|
|
56
|
+
const recordSideEffect = (label: string) => {
|
|
57
|
+
overrides.sideEffects.push(label);
|
|
58
|
+
};
|
|
59
|
+
return {
|
|
60
|
+
ctx: {
|
|
61
|
+
ui: {
|
|
62
|
+
notify(message: string, level?: string) {
|
|
63
|
+
overrides.notifications.push({ message, level });
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
pi: {},
|
|
68
|
+
s: {
|
|
69
|
+
basePath,
|
|
70
|
+
originalBasePath: basePath,
|
|
71
|
+
canonicalProjectRoot: basePath,
|
|
72
|
+
resourceVersionOnStart: "test",
|
|
73
|
+
// Critical for the `!mid` canonical path: even when deriveState returns
|
|
74
|
+
// activeMilestone: null, the session still remembers the milestone it
|
|
75
|
+
// was working on, and we use that to look up DB status.
|
|
76
|
+
currentMilestoneId: "M001",
|
|
77
|
+
currentUnit: null,
|
|
78
|
+
milestoneMergedInPhases: false,
|
|
79
|
+
completionStopInProgress: overrides.completionStopInProgress,
|
|
80
|
+
},
|
|
81
|
+
prefs: undefined,
|
|
82
|
+
iteration: 1,
|
|
83
|
+
flowId: "test-flow",
|
|
84
|
+
nextSeq: () => 1,
|
|
85
|
+
deps: {
|
|
86
|
+
checkResourcesStale() {
|
|
87
|
+
return null;
|
|
88
|
+
},
|
|
89
|
+
invalidateAllCaches() {},
|
|
90
|
+
async preDispatchHealthGate() {
|
|
91
|
+
return { proceed: true, fixesApplied: [] };
|
|
92
|
+
},
|
|
93
|
+
async deriveState() {
|
|
94
|
+
return {
|
|
95
|
+
phase: "complete",
|
|
96
|
+
activeMilestone: overrides.activeMilestone,
|
|
97
|
+
activeSlice: null,
|
|
98
|
+
activeTask: null,
|
|
99
|
+
// Registry says M001 is complete and no other milestones exist, so
|
|
100
|
+
// `incomplete.length === 0 && state.registry.length > 0` evaluates
|
|
101
|
+
// true in the `!mid` branch.
|
|
102
|
+
registry: [{ id: "M001", status: "complete" }],
|
|
103
|
+
nextAction: "complete",
|
|
104
|
+
};
|
|
105
|
+
},
|
|
106
|
+
syncCmuxSidebar() {},
|
|
107
|
+
setActiveMilestoneId() {},
|
|
108
|
+
reconcileMergeState() {
|
|
109
|
+
return "clean";
|
|
110
|
+
},
|
|
111
|
+
// Anything below this point MUST NOT be reached when the guard fires.
|
|
112
|
+
preflightCleanRoot() {
|
|
113
|
+
recordSideEffect("preflight");
|
|
114
|
+
return { ok: true, stashPushed: false, stashMarker: null };
|
|
115
|
+
},
|
|
116
|
+
postflightPopStash() {
|
|
117
|
+
recordSideEffect("postflight");
|
|
118
|
+
return { ok: true, needsManualRecovery: false };
|
|
119
|
+
},
|
|
120
|
+
lifecycle: {
|
|
121
|
+
exitMilestone() {
|
|
122
|
+
recordSideEffect("merge");
|
|
123
|
+
return { ok: true };
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
sendDesktopNotification() {
|
|
127
|
+
recordSideEffect("desktop-notify");
|
|
128
|
+
},
|
|
129
|
+
logCmuxEvent() {
|
|
130
|
+
recordSideEffect("cmux-event");
|
|
131
|
+
},
|
|
132
|
+
async closeoutUnit() {
|
|
133
|
+
recordSideEffect("closeout-unit");
|
|
134
|
+
},
|
|
135
|
+
buildSnapshotOpts() {
|
|
136
|
+
return {};
|
|
137
|
+
},
|
|
138
|
+
async stopAuto(_ctx: unknown, _pi: unknown, reason?: string) {
|
|
139
|
+
recordSideEffect(`stop:${reason ?? ""}`);
|
|
140
|
+
},
|
|
141
|
+
async pauseAuto() {
|
|
142
|
+
recordSideEffect("pause");
|
|
143
|
+
},
|
|
144
|
+
emitJournalEvent() {
|
|
145
|
+
recordSideEffect("journal-event");
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
async function runScenario(opts: {
|
|
152
|
+
label: string;
|
|
153
|
+
completionStopInProgress: boolean;
|
|
154
|
+
activeMilestone: { id: string; title: string } | null;
|
|
155
|
+
// When true, the test opens an in-memory DB and inserts M001 with status
|
|
156
|
+
// "complete" so the DB-closed branch of the guard can fire.
|
|
157
|
+
dbAlreadyClosed: boolean;
|
|
158
|
+
}): Promise<void> {
|
|
159
|
+
if (isDbAvailable()) {
|
|
160
|
+
closeDatabase();
|
|
161
|
+
}
|
|
162
|
+
if (opts.dbAlreadyClosed) {
|
|
163
|
+
openDatabase(":memory:");
|
|
164
|
+
insertMilestone({ id: "M001", title: "Milestone one", status: "complete" });
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
try {
|
|
168
|
+
const sideEffects: SideEffect[] = [];
|
|
169
|
+
const notifications: Array<{ message: string; level?: string }> = [];
|
|
170
|
+
const ic = makeIterationContext({
|
|
171
|
+
completionStopInProgress: opts.completionStopInProgress,
|
|
172
|
+
sideEffects,
|
|
173
|
+
notifications,
|
|
174
|
+
activeMilestone: opts.activeMilestone,
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
const result = await runPreDispatch(ic, {
|
|
178
|
+
recentUnits: [],
|
|
179
|
+
stuckRecoveryAttempts: 0,
|
|
180
|
+
consecutiveFinalizeTimeouts: 0,
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
assertTrue(
|
|
184
|
+
result.action === "break",
|
|
185
|
+
`${opts.label}: returns break instead of next`,
|
|
186
|
+
);
|
|
187
|
+
if (result.action === "break") {
|
|
188
|
+
assertTrue(
|
|
189
|
+
result.reason === "milestone-complete",
|
|
190
|
+
`${opts.label}: reason is milestone-complete (got "${result.reason}")`,
|
|
191
|
+
);
|
|
192
|
+
}
|
|
193
|
+
assertTrue(
|
|
194
|
+
sideEffects.length === 0,
|
|
195
|
+
`${opts.label}: no closeout side effects replayed (saw [${sideEffects.join(", ")}])`,
|
|
196
|
+
);
|
|
197
|
+
assertTrue(
|
|
198
|
+
notifications.length === 0,
|
|
199
|
+
`${opts.label}: no user notifications emitted (saw ${notifications.length})`,
|
|
200
|
+
);
|
|
201
|
+
} finally {
|
|
202
|
+
if (isDbAvailable()) {
|
|
203
|
+
closeDatabase();
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
console.log("\n=== Terminal complete is idempotent across both observer paths ===");
|
|
209
|
+
|
|
210
|
+
// ── state.phase === "complete" branch (activeMilestone non-null) ────────────
|
|
211
|
+
await runScenario({
|
|
212
|
+
label: "phase=complete + mid set + completionStopInProgress",
|
|
213
|
+
completionStopInProgress: true,
|
|
214
|
+
activeMilestone: { id: "M001", title: "Milestone one" },
|
|
215
|
+
dbAlreadyClosed: false,
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
await runScenario({
|
|
219
|
+
label: "phase=complete + mid set + DB closed",
|
|
220
|
+
completionStopInProgress: false,
|
|
221
|
+
activeMilestone: { id: "M001", title: "Milestone one" },
|
|
222
|
+
dbAlreadyClosed: true,
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
// ── Canonical !mid "all milestones complete" sub-branch ────────────────────
|
|
226
|
+
// deriveState returns phase: "complete" with activeMilestone: null. The
|
|
227
|
+
// session's s.currentMilestoneId (M001) is what the guard consults.
|
|
228
|
+
await runScenario({
|
|
229
|
+
label: "phase=complete + activeMilestone=null + completionStopInProgress",
|
|
230
|
+
completionStopInProgress: true,
|
|
231
|
+
activeMilestone: null,
|
|
232
|
+
dbAlreadyClosed: false,
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
await runScenario({
|
|
236
|
+
label: "phase=complete + activeMilestone=null + DB closed",
|
|
237
|
+
completionStopInProgress: false,
|
|
238
|
+
activeMilestone: null,
|
|
239
|
+
dbAlreadyClosed: true,
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
report();
|
|
@@ -145,7 +145,7 @@ function createBasicTask(): void {
|
|
|
145
145
|
});
|
|
146
146
|
}
|
|
147
147
|
|
|
148
|
-
function createTaskWithoutVerify(): void {
|
|
148
|
+
function createTaskWithoutVerify(status = "pending"): void {
|
|
149
149
|
insertMilestone({ id: "M001" });
|
|
150
150
|
insertSlice({
|
|
151
151
|
id: "S01",
|
|
@@ -159,7 +159,7 @@ function createTaskWithoutVerify(): void {
|
|
|
159
159
|
sliceId: "S01",
|
|
160
160
|
milestoneId: "M001",
|
|
161
161
|
title: "Task without host verification",
|
|
162
|
-
status
|
|
162
|
+
status,
|
|
163
163
|
planning: {
|
|
164
164
|
description: "Task intentionally missing runnable verification",
|
|
165
165
|
estimate: "1h",
|
|
@@ -558,6 +558,32 @@ describe("Post-execution blocking failure retry bypass", () => {
|
|
|
558
558
|
assert.equal(pauseAutoMock.mock.callCount(), 1);
|
|
559
559
|
assert.equal(s.pendingVerificationRetry, null);
|
|
560
560
|
|
|
561
|
+
const notifyMessages = ctx.ui.notify.mock.calls.map((c: { arguments: unknown[] }) =>
|
|
562
|
+
String(c.arguments[0])
|
|
563
|
+
);
|
|
564
|
+
assert.ok(
|
|
565
|
+
notifyMessages.some(
|
|
566
|
+
(m: string) =>
|
|
567
|
+
m.includes(".gsd/PREFERENCES.md") &&
|
|
568
|
+
m.includes("task-plan Verify command") &&
|
|
569
|
+
m.includes("/gsd next")
|
|
570
|
+
),
|
|
571
|
+
"no-host-checks notification should guide the user to add verification and resume",
|
|
572
|
+
);
|
|
573
|
+
|
|
574
|
+
const pauseCalls = pauseAutoMock.mock.calls as Array<{ arguments: unknown[] }>;
|
|
575
|
+
const pauseCallArgs = pauseCalls[0]?.arguments[2] as
|
|
576
|
+
| { message?: string }
|
|
577
|
+
| undefined;
|
|
578
|
+
assert.ok(
|
|
579
|
+
pauseCallArgs?.message?.includes(".gsd/PREFERENCES.md"),
|
|
580
|
+
"pause reason should include the project verification configuration path",
|
|
581
|
+
);
|
|
582
|
+
assert.ok(
|
|
583
|
+
pauseCallArgs?.message?.includes("/gsd next"),
|
|
584
|
+
"pause reason should tell the user how to resume",
|
|
585
|
+
);
|
|
586
|
+
|
|
561
587
|
const evidencePath = join(tempDir, ".gsd", "milestones", "M001", "slices", "S01", "tasks", "T01-VERIFY.json");
|
|
562
588
|
const evidence = JSON.parse(readFileSync(evidencePath, "utf-8"));
|
|
563
589
|
assert.equal(evidence.passed, false);
|
|
@@ -566,6 +592,41 @@ describe("Post-execution blocking failure retry bypass", () => {
|
|
|
566
592
|
assert.ok(!("maxRetries" in evidence), "no-host-checks evidence must not include maxRetries");
|
|
567
593
|
});
|
|
568
594
|
|
|
595
|
+
test("completed browser-facing execute-task with no host-owned verification continues toward browser UAT", async () => {
|
|
596
|
+
createTaskWithoutVerify("complete");
|
|
597
|
+
writeFileSync(join(tempDir, "index.html"), "<!doctype html><button>Import</button>", "utf-8");
|
|
598
|
+
|
|
599
|
+
const ctx = makeMockCtx();
|
|
600
|
+
const pi = makeMockPi();
|
|
601
|
+
const pauseAutoMock = mock.fn(async () => {});
|
|
602
|
+
const s = makeMockSession(tempDir, { type: "execute-task", id: "M001/S01/T01" });
|
|
603
|
+
|
|
604
|
+
const result = await runPostUnitVerification({ s, ctx, pi }, pauseAutoMock);
|
|
605
|
+
|
|
606
|
+
assert.equal(result, "continue");
|
|
607
|
+
assert.equal(pauseAutoMock.mock.callCount(), 0);
|
|
608
|
+
assert.equal(s.pendingVerificationRetry, null);
|
|
609
|
+
|
|
610
|
+
const notifyMessages = ctx.ui.notify.mock.calls.map((c: { arguments: unknown[] }) =>
|
|
611
|
+
String(c.arguments[0])
|
|
612
|
+
);
|
|
613
|
+
assert.ok(
|
|
614
|
+
notifyMessages.some(
|
|
615
|
+
(m: string) =>
|
|
616
|
+
m.includes("browser-facing task") &&
|
|
617
|
+
m.includes("slice UAT") &&
|
|
618
|
+
m.includes("browser tools")
|
|
619
|
+
),
|
|
620
|
+
"completed web tasks without task-level commands should explain browser UAT handoff",
|
|
621
|
+
);
|
|
622
|
+
|
|
623
|
+
const evidencePath = join(tempDir, ".gsd", "milestones", "M001", "slices", "S01", "tasks", "T01-VERIFY.json");
|
|
624
|
+
const evidence = JSON.parse(readFileSync(evidencePath, "utf-8"));
|
|
625
|
+
assert.equal(evidence.passed, false);
|
|
626
|
+
assert.equal(evidence.discoverySource, "none");
|
|
627
|
+
assert.ok(!("retryAttempt" in evidence), "browser-UAT handoff evidence must not request a task retry");
|
|
628
|
+
});
|
|
629
|
+
|
|
569
630
|
test("auto-discovered package.json verification failure retries instead of continuing", async () => {
|
|
570
631
|
createTaskWithoutVerify();
|
|
571
632
|
writeFileSync(
|
|
@@ -200,6 +200,74 @@ test("parseRoadmapSlices: checkbox slices with pipe characters do not switch to
|
|
|
200
200
|
assert.deepEqual(slices[2]?.depends, ["S01", "S02"]);
|
|
201
201
|
});
|
|
202
202
|
|
|
203
|
+
test("parseRoadmapSlices: demo markdown table does not switch checkbox roadmap to table mode (#721)", () => {
|
|
204
|
+
const checkboxWithDemoTable = [
|
|
205
|
+
"# M004: Demo Table Repro",
|
|
206
|
+
"",
|
|
207
|
+
"## Slices",
|
|
208
|
+
"",
|
|
209
|
+
"- [x] **S01: First** `risk:low` `depends:[]`",
|
|
210
|
+
" > After this: cli can render examples:",
|
|
211
|
+
"| Example | Meaning |",
|
|
212
|
+
"| --- | --- |",
|
|
213
|
+
"| S01 | Not a roadmap row |",
|
|
214
|
+
"- [ ] **S02: Second** `risk:medium` `depends:[S01]`",
|
|
215
|
+
" > After this: cat file | sort returns stable output.",
|
|
216
|
+
"",
|
|
217
|
+
].join("\n");
|
|
218
|
+
|
|
219
|
+
const slices = parseRoadmapSlices(checkboxWithDemoTable);
|
|
220
|
+
assert.equal(slices.length, 2);
|
|
221
|
+
assert.equal(slices[0]?.id, "S01");
|
|
222
|
+
assert.equal(slices[0]?.title, "First");
|
|
223
|
+
assert.equal(slices[0]?.done, true);
|
|
224
|
+
assert.equal(slices[1]?.id, "S02");
|
|
225
|
+
assert.deepEqual(slices[1]?.depends, ["S01"]);
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
test("parseRoadmapSlices: table preceded by intro prose still parsed as table (#722)", () => {
|
|
229
|
+
const tableWithIntro = [
|
|
230
|
+
"# M005: Intro Before Table",
|
|
231
|
+
"",
|
|
232
|
+
"## Slices",
|
|
233
|
+
"",
|
|
234
|
+
"This milestone is broken into the following slices:",
|
|
235
|
+
"",
|
|
236
|
+
"| Slice | Title | Risk | Status |",
|
|
237
|
+
"| --- | --- | --- | --- |",
|
|
238
|
+
"| S01 | Foundation | Low | [x] Done |",
|
|
239
|
+
"| S02 | Core | High | [ ] Pending |",
|
|
240
|
+
"",
|
|
241
|
+
].join("\n");
|
|
242
|
+
|
|
243
|
+
const slices = parseRoadmapSlices(tableWithIntro);
|
|
244
|
+
assert.equal(slices.length, 2);
|
|
245
|
+
assert.equal(slices[0]?.id, "S01");
|
|
246
|
+
assert.equal(slices[0]?.done, true);
|
|
247
|
+
assert.equal(slices[1]?.id, "S02");
|
|
248
|
+
assert.equal(slices[1]?.done, false);
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
test("parseRoadmapSlices: table without markdown separator row still parsed as table (#722)", () => {
|
|
252
|
+
const tableWithoutSeparator = [
|
|
253
|
+
"# M006: No Separator",
|
|
254
|
+
"",
|
|
255
|
+
"## Slices",
|
|
256
|
+
"",
|
|
257
|
+
"| Slice | Title | Risk | Status |",
|
|
258
|
+
"| S01 | Foundation | Low | [x] Done |",
|
|
259
|
+
"| S02 | Core | High | [ ] Pending |",
|
|
260
|
+
"",
|
|
261
|
+
].join("\n");
|
|
262
|
+
|
|
263
|
+
const slices = parseRoadmapSlices(tableWithoutSeparator);
|
|
264
|
+
assert.equal(slices.length, 2);
|
|
265
|
+
assert.equal(slices[0]?.id, "S01");
|
|
266
|
+
assert.equal(slices[0]?.done, true);
|
|
267
|
+
assert.equal(slices[1]?.id, "S02");
|
|
268
|
+
assert.equal(slices[1]?.done, false);
|
|
269
|
+
});
|
|
270
|
+
|
|
203
271
|
// --- Prose slice header completion marker tests (#1803) ---
|
|
204
272
|
|
|
205
273
|
test("parseRoadmapSlices: prose headers with ✓ marker detected as done", () => {
|
|
@@ -6,7 +6,11 @@ import assert from "node:assert/strict";
|
|
|
6
6
|
|
|
7
7
|
import { classifyFailure } from "../recovery-classification.js";
|
|
8
8
|
import { reconcileBeforeDispatch } from "../state-reconciliation.js";
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
compileUnitContextContract,
|
|
11
|
+
compileUnitToolContract,
|
|
12
|
+
getUnitWorkflowDispatchReadinessError,
|
|
13
|
+
} from "../tool-contract.js";
|
|
10
14
|
import { shouldBlockAutoUnitToolCall } from "../auto-unit-tool-scope.js";
|
|
11
15
|
import type { GSDState } from "../types.js";
|
|
12
16
|
|
|
@@ -87,6 +91,20 @@ test("Tool Contract compiles known Unit prompt and tool policy", () => {
|
|
|
87
91
|
});
|
|
88
92
|
});
|
|
89
93
|
|
|
94
|
+
test("Tool Contract derives dispatch readiness from Unit workflow tools", () => {
|
|
95
|
+
const error = getUnitWorkflowDispatchReadinessError({
|
|
96
|
+
provider: "claude-code",
|
|
97
|
+
unitType: "plan-slice",
|
|
98
|
+
projectRoot: "/tmp/project",
|
|
99
|
+
env: { GSD_WORKFLOW_MCP_COMMAND: "node" },
|
|
100
|
+
surface: "auto-mode",
|
|
101
|
+
authMode: "externalCli",
|
|
102
|
+
baseUrl: "local://claude-code",
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
assert.equal(error, null);
|
|
106
|
+
});
|
|
107
|
+
|
|
90
108
|
test("Unit Context Contract exposes prompt context without workflow tool surface", () => {
|
|
91
109
|
const result = compileUnitContextContract("execute-task");
|
|
92
110
|
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Regression test for MCP tool-availability race.
|
|
3
|
+
*
|
|
4
|
+
* When the MCP workflow server is still connecting, tool calls fail with
|
|
5
|
+
* "No such tool available". The bounded retry counter on AutoSession
|
|
6
|
+
* (toolUnavailableRetries) prevents infinite re-dispatch loops by capping
|
|
7
|
+
* retries at 3 with escalating delay, then pausing auto-mode.
|
|
8
|
+
*/
|
|
9
|
+
import { describe, test } from "node:test";
|
|
10
|
+
import assert from "node:assert/strict";
|
|
11
|
+
import { AutoSession } from "../auto/session.ts";
|
|
12
|
+
|
|
13
|
+
describe("toolUnavailableRetries on AutoSession", () => {
|
|
14
|
+
test("defaults to 0", () => {
|
|
15
|
+
const s = new AutoSession();
|
|
16
|
+
assert.equal(s.toolUnavailableRetries, 0);
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
test("is cleared on reset()", () => {
|
|
20
|
+
const s = new AutoSession();
|
|
21
|
+
s.toolUnavailableRetries = 2;
|
|
22
|
+
s.reset();
|
|
23
|
+
assert.equal(s.toolUnavailableRetries, 0);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
test("accumulates across assignments (simulates retry increments)", () => {
|
|
27
|
+
const s = new AutoSession();
|
|
28
|
+
s.toolUnavailableRetries = 1;
|
|
29
|
+
s.toolUnavailableRetries = 2;
|
|
30
|
+
s.toolUnavailableRetries = 3;
|
|
31
|
+
assert.equal(s.toolUnavailableRetries, 3);
|
|
32
|
+
});
|
|
33
|
+
});
|