gsd-pi 2.82.0-dev.c22380fc3 → 2.82.0-dev.dfbc5f58f
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/README.md +4 -3
- package/dist/resources/.managed-resources-content-hash +1 -1
- package/dist/resources/GSD-WORKFLOW.md +10 -1
- package/dist/resources/extensions/claude-code-cli/partial-builder.js +2 -1
- package/dist/resources/extensions/cmux/index.js +5 -0
- package/dist/resources/extensions/gsd/auto/infra-errors.js +9 -3
- package/dist/resources/extensions/gsd/auto/loop.js +5 -5
- package/dist/resources/extensions/gsd/auto/orchestrator.js +11 -0
- package/dist/resources/extensions/gsd/auto/phases.js +8 -1
- package/dist/resources/extensions/gsd/auto/workflow-memory-pressure.js +12 -0
- package/dist/resources/extensions/gsd/auto-dispatch.js +13 -6
- package/dist/resources/extensions/gsd/auto-model-selection.js +2 -0
- package/dist/resources/extensions/gsd/auto-post-unit.js +233 -127
- package/dist/resources/extensions/gsd/auto-prompts.js +2 -2
- package/dist/resources/extensions/gsd/auto-recovery.js +31 -1
- package/dist/resources/extensions/gsd/auto-start.js +85 -12
- package/dist/resources/extensions/gsd/auto-verification.js +28 -22
- package/dist/resources/extensions/gsd/auto-worktree.js +111 -1
- package/dist/resources/extensions/gsd/auto.js +30 -3
- package/dist/resources/extensions/gsd/bootstrap/agent-end-recovery.js +4 -1
- package/dist/resources/extensions/gsd/bootstrap/db-tools.js +9 -8
- package/dist/resources/extensions/gsd/bootstrap/subagent-input.js +21 -9
- package/dist/resources/extensions/gsd/bootstrap/write-gate.js +16 -2
- package/dist/resources/extensions/gsd/clean-root-preflight.js +170 -8
- package/dist/resources/extensions/gsd/commands/catalog.js +4 -1
- package/dist/resources/extensions/gsd/commands/handlers/core.js +37 -0
- package/dist/resources/extensions/gsd/commands-bootstrap.js +5 -0
- package/dist/resources/extensions/gsd/crash-recovery.js +31 -5
- package/dist/resources/extensions/gsd/db/unit-dispatches.js +3 -2
- package/dist/resources/extensions/gsd/dispatch-guard.js +2 -2
- package/dist/resources/extensions/gsd/doctor-runtime-checks.js +28 -11
- package/dist/resources/extensions/gsd/doctor.js +2 -28
- package/dist/resources/extensions/gsd/export-html.js +27 -425
- package/dist/resources/extensions/gsd/git-service.js +39 -1
- package/dist/resources/extensions/gsd/gsd-db.js +1 -0
- package/dist/resources/extensions/gsd/guided-flow.js +6 -0
- package/dist/resources/extensions/gsd/migrate/parsers.js +10 -0
- package/dist/resources/extensions/gsd/milestone-actions.js +11 -4
- package/dist/resources/extensions/gsd/native-git-bridge.js +48 -12
- package/dist/resources/extensions/gsd/post-execution-checks.js +73 -2
- package/dist/resources/extensions/gsd/pre-execution-checks.js +28 -1
- package/dist/resources/extensions/gsd/prompt-loader.js +1 -1
- package/dist/resources/extensions/gsd/prompts/plan-slice.md +3 -3
- package/dist/resources/extensions/gsd/prompts/refine-slice.md +1 -1
- package/dist/resources/extensions/gsd/state-reconciliation/drift/merge-state.js +6 -1
- package/dist/resources/extensions/gsd/status-guards.js +4 -0
- package/dist/resources/extensions/gsd/templates/plan.md +8 -5
- package/dist/resources/extensions/gsd/templates/task-plan.md +4 -2
- package/dist/resources/extensions/gsd/tools/complete-milestone.js +6 -8
- package/dist/resources/extensions/gsd/tools/complete-slice.js +6 -8
- package/dist/resources/extensions/gsd/tools/plan-milestone.js +7 -1
- package/dist/resources/extensions/gsd/tools/plan-slice.js +89 -14
- package/dist/resources/extensions/gsd/unit-context-manifest.js +32 -10
- package/dist/resources/extensions/gsd/validation.js +23 -1
- package/dist/resources/extensions/gsd/verification-gate.js +68 -7
- package/dist/resources/extensions/gsd/verification-verdict.js +26 -0
- package/dist/resources/extensions/gsd/workflow-projections.js +6 -8
- package/dist/resources/extensions/gsd/worktree-lifecycle.js +33 -8
- package/dist/resources/extensions/shared/html-shell.js +388 -0
- package/dist/resources/extensions/subagent/index.js +448 -78
- package/dist/resources/extensions/subagent/launch.js +77 -0
- package/dist/resources/extensions/subagent/run-store.js +148 -0
- package/dist/resources/extensions/visual-brief/artifact-policy.js +29 -0
- package/dist/resources/extensions/visual-brief/extension-manifest.json +8 -0
- package/dist/resources/extensions/visual-brief/index.js +5 -0
- package/dist/resources/extensions/visual-brief/page-contract.js +124 -0
- package/dist/resources/extensions/visual-brief/prompts.js +140 -0
- package/dist/tsconfig.extensions.tsbuildinfo +1 -1
- 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 +3 -3
- package/dist/web/standalone/.next/prerender-manifest.json +3 -3
- package/dist/web/standalone/.next/react-loadable-manifest.json +3 -3
- package/dist/web/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- 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/page.js +2 -2
- package/dist/web/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.html +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.rsc +4 -7
- package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +4 -7
- 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 +4 -5
- 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 +2 -5
- package/dist/web/standalone/.next/server/app/api/git/route.js +1 -1
- package/dist/web/standalone/.next/server/app/index.html +1 -1
- package/dist/web/standalone/.next/server/app/index.rsc +4 -7
- 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 +4 -7
- 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 +4 -5
- package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +2 -5
- package/dist/web/standalone/.next/server/app/page.js +2 -2
- package/dist/web/standalone/.next/server/app/page.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app-paths-manifest.json +12 -12
- package/dist/web/standalone/.next/server/chunks/4266.js +2 -0
- package/dist/web/standalone/.next/server/middleware-build-manifest.js +1 -1
- package/dist/web/standalone/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/dist/web/standalone/.next/server/next-font-manifest.js +1 -1
- package/dist/web/standalone/.next/server/next-font-manifest.json +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/.next/static/chunks/2973.33f26573894b6153.js +2 -0
- package/dist/web/standalone/.next/static/chunks/{8359.e059d86b255fce1c.js → 8359.7eb3bb8f8ecf4c01.js} +2 -2
- package/dist/web/standalone/.next/static/chunks/app/layout-8c10ec293ae0f1d5.js +1 -0
- package/dist/web/standalone/.next/static/chunks/{webpack-de742b64187e13fe.js → webpack-9a4db269f9ed63ad.js} +1 -1
- package/dist/web/standalone/.next/static/css/746ee28c929d1880.css +1 -0
- package/package.json +4 -4
- package/packages/mcp-server/src/workflow-tools.test.ts +1 -1
- package/packages/native/tsconfig.json +2 -1
- package/packages/native/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-ai/dist/providers/openai-codex-responses.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/openai-codex-responses.js +82 -1
- package/packages/pi-ai/dist/providers/openai-codex-responses.js.map +1 -1
- package/packages/pi-ai/dist/providers/openai-codex-responses.test.d.ts +2 -0
- package/packages/pi-ai/dist/providers/openai-codex-responses.test.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/openai-codex-responses.test.js +52 -0
- package/packages/pi-ai/dist/providers/openai-codex-responses.test.js.map +1 -0
- package/packages/pi-ai/dist/providers/simple-options.d.ts +2 -4
- package/packages/pi-ai/dist/providers/simple-options.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/simple-options.js +5 -6
- package/packages/pi-ai/dist/providers/simple-options.js.map +1 -1
- package/packages/pi-ai/dist/providers/simple-options.test.d.ts +2 -0
- package/packages/pi-ai/dist/providers/simple-options.test.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/simple-options.test.js +50 -0
- package/packages/pi-ai/dist/providers/simple-options.test.js.map +1 -0
- package/packages/pi-ai/src/providers/openai-codex-responses.test.ts +63 -0
- package/packages/pi-ai/src/providers/openai-codex-responses.ts +91 -1
- package/packages/pi-ai/src/providers/simple-options.test.ts +60 -0
- package/packages/pi-ai/src/providers/simple-options.ts +5 -6
- package/packages/pi-ai/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-coding-agent/dist/core/agent-session-thinking-level.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/agent-session-thinking-level.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/agent-session-thinking-level.test.js +66 -0
- package/packages/pi-coding-agent/dist/core/agent-session-thinking-level.test.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/agent-session.js +1 -1
- package/packages/pi-coding-agent/dist/core/agent-session.js.map +1 -1
- package/packages/pi-coding-agent/src/core/agent-session-thinking-level.test.ts +79 -0
- package/packages/pi-coding-agent/src/core/agent-session.ts +1 -1
- package/packages/pi-coding-agent/tsconfig.tsbuildinfo +1 -1
- package/src/resources/GSD-WORKFLOW.md +10 -1
- package/src/resources/extensions/claude-code-cli/partial-builder.ts +2 -1
- package/src/resources/extensions/claude-code-cli/tests/partial-builder.test.ts +19 -2
- package/src/resources/extensions/cmux/index.ts +6 -0
- package/src/resources/extensions/gsd/auto/contracts.ts +14 -6
- package/src/resources/extensions/gsd/auto/infra-errors.ts +9 -3
- package/src/resources/extensions/gsd/auto/loop.ts +8 -5
- package/src/resources/extensions/gsd/auto/orchestrator.ts +11 -0
- package/src/resources/extensions/gsd/auto/phases.ts +7 -1
- package/src/resources/extensions/gsd/auto/workflow-memory-pressure.ts +13 -0
- package/src/resources/extensions/gsd/auto-dispatch.ts +14 -6
- package/src/resources/extensions/gsd/auto-model-selection.ts +2 -1
- package/src/resources/extensions/gsd/auto-post-unit.ts +266 -139
- package/src/resources/extensions/gsd/auto-prompts.ts +2 -2
- package/src/resources/extensions/gsd/auto-recovery.ts +29 -0
- package/src/resources/extensions/gsd/auto-start.ts +92 -9
- package/src/resources/extensions/gsd/auto-verification.ts +36 -34
- package/src/resources/extensions/gsd/auto-worktree.ts +119 -1
- package/src/resources/extensions/gsd/auto.ts +32 -3
- package/src/resources/extensions/gsd/bootstrap/agent-end-recovery.ts +6 -1
- package/src/resources/extensions/gsd/bootstrap/db-tools.ts +9 -8
- package/src/resources/extensions/gsd/bootstrap/subagent-input.ts +19 -7
- package/src/resources/extensions/gsd/bootstrap/write-gate.ts +19 -3
- package/src/resources/extensions/gsd/clean-root-preflight.ts +174 -8
- package/src/resources/extensions/gsd/commands/catalog.ts +4 -1
- package/src/resources/extensions/gsd/commands/handlers/core.ts +40 -0
- package/src/resources/extensions/gsd/commands-bootstrap.ts +10 -0
- package/src/resources/extensions/gsd/crash-recovery.ts +30 -4
- package/src/resources/extensions/gsd/db/unit-dispatches.ts +4 -3
- package/src/resources/extensions/gsd/dispatch-guard.ts +2 -2
- package/src/resources/extensions/gsd/doctor-runtime-checks.ts +25 -13
- package/src/resources/extensions/gsd/doctor.ts +2 -27
- package/src/resources/extensions/gsd/export-html.ts +27 -427
- package/src/resources/extensions/gsd/git-service.ts +45 -1
- package/src/resources/extensions/gsd/gsd-db.ts +3 -0
- package/src/resources/extensions/gsd/guided-flow.ts +6 -0
- package/src/resources/extensions/gsd/migrate/parsers.ts +11 -0
- package/src/resources/extensions/gsd/milestone-actions.ts +10 -4
- package/src/resources/extensions/gsd/native-git-bridge.ts +54 -12
- package/src/resources/extensions/gsd/post-execution-checks.ts +87 -2
- package/src/resources/extensions/gsd/pre-execution-checks.ts +32 -1
- package/src/resources/extensions/gsd/prompt-loader.ts +1 -1
- package/src/resources/extensions/gsd/prompts/plan-slice.md +3 -3
- package/src/resources/extensions/gsd/prompts/refine-slice.md +1 -1
- package/src/resources/extensions/gsd/state-reconciliation/drift/merge-state.ts +8 -1
- package/src/resources/extensions/gsd/status-guards.ts +5 -0
- package/src/resources/extensions/gsd/templates/plan.md +8 -5
- package/src/resources/extensions/gsd/templates/task-plan.md +4 -2
- package/src/resources/extensions/gsd/tests/auto-deterministic-error-classification-4973.test.ts +116 -0
- package/src/resources/extensions/gsd/tests/auto-loop.test.ts +54 -0
- package/src/resources/extensions/gsd/tests/auto-orchestrator.test.ts +80 -1
- package/src/resources/extensions/gsd/tests/auto-paused-ui-cleanup.test.ts +6 -6
- package/src/resources/extensions/gsd/tests/auto-post-unit-step-message.test.ts +12 -1
- package/src/resources/extensions/gsd/tests/auto-recovery.test.ts +15 -1
- package/src/resources/extensions/gsd/tests/auto-start-orphan-bootstrap.test.ts +1 -0
- package/src/resources/extensions/gsd/tests/auto-worktree-registry.test.ts +69 -1
- package/src/resources/extensions/gsd/tests/brief-command.test.ts +89 -0
- package/src/resources/extensions/gsd/tests/clean-root-preflight.test.ts +107 -2
- package/src/resources/extensions/gsd/tests/closeout-git-deferral.test.ts +16 -0
- package/src/resources/extensions/gsd/tests/complete-milestone.test.ts +4 -1
- package/src/resources/extensions/gsd/tests/complete-task.test.ts +3 -1
- package/src/resources/extensions/gsd/tests/crash-recovery-via-db.test.ts +43 -2
- package/src/resources/extensions/gsd/tests/deep-project-auto-loop.test.ts +59 -2
- package/src/resources/extensions/gsd/tests/dispatch-complete-milestone-guard.test.ts +39 -0
- package/src/resources/extensions/gsd/tests/dispatch-guard.test.ts +27 -0
- package/src/resources/extensions/gsd/tests/evidence-cross-ref.test.ts +38 -0
- package/src/resources/extensions/gsd/tests/export-html-enhancements.test.ts +8 -0
- package/src/resources/extensions/gsd/tests/guided-flow.test.ts +21 -0
- package/src/resources/extensions/gsd/tests/hook-model-resolution.test.ts +5 -0
- package/src/resources/extensions/gsd/tests/infra-error.test.ts +2 -2
- package/src/resources/extensions/gsd/tests/infra-errors-cooldown.test.ts +9 -0
- package/src/resources/extensions/gsd/tests/integration/doctor-runtime.test.ts +20 -0
- package/src/resources/extensions/gsd/tests/integration/git-service.test.ts +103 -1
- package/src/resources/extensions/gsd/tests/integration/state-machine-runtime-failures.test.ts +6 -1
- package/src/resources/extensions/gsd/tests/migrate-validator-parsers.test.ts +24 -1
- package/src/resources/extensions/gsd/tests/native-git-bridge-exec-fallback.test.ts +63 -2
- package/src/resources/extensions/gsd/tests/orphaned-worktree-audit.test.ts +121 -1
- package/src/resources/extensions/gsd/tests/park-db-sync.test.ts +55 -1
- package/src/resources/extensions/gsd/tests/plan-milestone.test.ts +26 -0
- package/src/resources/extensions/gsd/tests/plan-slice.test.ts +225 -1
- package/src/resources/extensions/gsd/tests/plan-task.test.ts +17 -0
- package/src/resources/extensions/gsd/tests/post-exec-retry-bypass.test.ts +79 -1
- package/src/resources/extensions/gsd/tests/post-execution-checks.test.ts +86 -0
- package/src/resources/extensions/gsd/tests/post-unit-git-failure.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/pre-execution-checks.test.ts +53 -0
- package/src/resources/extensions/gsd/tests/prompt-loader.test.ts +23 -0
- package/src/resources/extensions/gsd/tests/remediation-completion-guard.test.ts +46 -2
- package/src/resources/extensions/gsd/tests/session-switch-abort-misclassification.test.ts +10 -0
- package/src/resources/extensions/gsd/tests/start-auto-detached.test.ts +31 -1
- package/src/resources/extensions/gsd/tests/stuck-state-via-db.test.ts +64 -1
- package/src/resources/extensions/gsd/tests/summary-render-parity.test.ts +7 -3
- package/src/resources/extensions/gsd/tests/unit-context-manifest.test.ts +86 -7
- package/src/resources/extensions/gsd/tests/verification-gate.test.ts +110 -1
- package/src/resources/extensions/gsd/tests/verification-verdict.test.ts +78 -0
- package/src/resources/extensions/gsd/tests/workflow-mcp.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/workflow-memory-pressure.test.ts +21 -1
- package/src/resources/extensions/gsd/tests/workflow-tool-executors.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/worktree-git-pathspec.test.ts +39 -0
- package/src/resources/extensions/gsd/tests/worktree-journal-events.test.ts +64 -12
- package/src/resources/extensions/gsd/tests/write-gate-planning-unit.test.ts +54 -0
- package/src/resources/extensions/gsd/tools/complete-milestone.ts +8 -10
- package/src/resources/extensions/gsd/tools/complete-slice.ts +6 -8
- package/src/resources/extensions/gsd/tools/plan-milestone.ts +5 -1
- package/src/resources/extensions/gsd/tools/plan-slice.ts +98 -12
- package/src/resources/extensions/gsd/types.ts +1 -1
- package/src/resources/extensions/gsd/unit-context-manifest.ts +47 -11
- package/src/resources/extensions/gsd/validation.ts +23 -1
- package/src/resources/extensions/gsd/verification-gate.ts +78 -6
- package/src/resources/extensions/gsd/verification-verdict.ts +47 -0
- package/src/resources/extensions/gsd/workflow-projections.ts +6 -8
- package/src/resources/extensions/gsd/worktree-lifecycle.ts +41 -8
- package/src/resources/extensions/shared/html-shell.ts +412 -0
- package/src/resources/extensions/subagent/index.ts +567 -103
- package/src/resources/extensions/subagent/launch.ts +131 -0
- package/src/resources/extensions/subagent/run-store.ts +218 -0
- package/src/resources/extensions/subagent/tests/launch.test.ts +115 -0
- package/src/resources/extensions/subagent/tests/run-store.test.ts +111 -0
- package/src/resources/extensions/visual-brief/artifact-policy.ts +41 -0
- package/src/resources/extensions/visual-brief/extension-manifest.json +8 -0
- package/src/resources/extensions/visual-brief/index.ts +8 -0
- package/src/resources/extensions/visual-brief/page-contract.ts +136 -0
- package/src/resources/extensions/visual-brief/prompts.ts +183 -0
- package/src/resources/extensions/visual-brief/tests/visual-brief.test.ts +212 -0
- package/dist/web/standalone/.next/server/chunks/5822.js +0 -2
- package/dist/web/standalone/.next/static/chunks/2556.0527fea66e123b7f.js +0 -1
- package/dist/web/standalone/.next/static/chunks/app/layout-a16c7a7ecdf0c2cf.js +0 -1
- package/dist/web/standalone/.next/static/css/54ec2745c1da488b.css +0 -1
- package/dist/web/standalone/.next/static/css/de70bee13400563f.css +0 -1
- package/dist/web/standalone/.next/static/media/4cf2300e9c8272f7-s.p.woff2 +0 -0
- package/dist/web/standalone/.next/static/media/747892c23ea88013-s.woff2 +0 -0
- package/dist/web/standalone/.next/static/media/8d697b304b401681-s.woff2 +0 -0
- package/dist/web/standalone/.next/static/media/93f479601ee12b01-s.p.woff2 +0 -0
- package/dist/web/standalone/.next/static/media/9610d9e46709d722-s.woff2 +0 -0
- package/dist/web/standalone/.next/static/media/ba015fad6dcf6784-s.woff2 +0 -0
- /package/dist/web/standalone/.next/static/{Wop3A7KRGyR06H3rla_1- → q0WYuDVbHeFFYbdd-fei2}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{Wop3A7KRGyR06H3rla_1- → q0WYuDVbHeFFYbdd-fei2}/_ssgManifest.js +0 -0
|
@@ -243,7 +243,7 @@ describe("auditOrphanedMilestoneBranches", () => {
|
|
|
243
243
|
);
|
|
244
244
|
});
|
|
245
245
|
|
|
246
|
-
test("
|
|
246
|
+
test("milestone in DB, no branch, no worktree dir → no-op", () => {
|
|
247
247
|
insertMilestone({ id: "M001", title: "Test", status: "complete" });
|
|
248
248
|
|
|
249
249
|
const result = auditOrphanedMilestoneBranches(dir, "worktree");
|
|
@@ -251,4 +251,124 @@ describe("auditOrphanedMilestoneBranches", () => {
|
|
|
251
251
|
assert.deepStrictEqual(result.recovered, []);
|
|
252
252
|
assert.deepStrictEqual(result.warnings, []);
|
|
253
253
|
});
|
|
254
|
+
|
|
255
|
+
test("#5879 — cleans orphaned worktree dir for complete milestone whose branch was already deleted", () => {
|
|
256
|
+
// Reproduces the postflight-stash-restore-failed scenario:
|
|
257
|
+
// 1. An earlier audit deleted milestone/M001 (merged + complete).
|
|
258
|
+
// 2. The worktree dir cleanup failed silently (logWarning only).
|
|
259
|
+
// 3. On the next startup the branch is gone, so the existing branch-keyed
|
|
260
|
+
// loop is invisible to the orphan dir. Without the second pass, the
|
|
261
|
+
// directory lives forever.
|
|
262
|
+
insertMilestone({ id: "M001", title: "Test", status: "complete" });
|
|
263
|
+
|
|
264
|
+
const wtDir = join(dir, ".gsd", "worktrees", "M001");
|
|
265
|
+
mkdirSync(wtDir, { recursive: true });
|
|
266
|
+
writeFileSync(join(wtDir, "leftover.txt"), "stranded from a prior session\n");
|
|
267
|
+
|
|
268
|
+
// No milestone/M001 branch — already deleted on a previous run.
|
|
269
|
+
const branches = run("git branch --list milestone/M001", dir);
|
|
270
|
+
assert.equal(branches, "", "test fixture: branch should not exist");
|
|
271
|
+
|
|
272
|
+
const result = auditOrphanedMilestoneBranches(dir, "worktree");
|
|
273
|
+
|
|
274
|
+
assert.ok(
|
|
275
|
+
result.recovered.some((r) => r.includes("M001") && r.includes("branch already deleted")),
|
|
276
|
+
`should report branch-less orphan cleanup; got: ${JSON.stringify(result.recovered)}`,
|
|
277
|
+
);
|
|
278
|
+
assert.ok(!existsSync(wtDir), "branch-less orphan worktree dir should be removed");
|
|
279
|
+
});
|
|
280
|
+
|
|
281
|
+
test("#5879 — branch list failure still cleans complete orphan only after branch absence is verified", () => {
|
|
282
|
+
insertMilestone({ id: "M001", title: "Test", status: "complete" });
|
|
283
|
+
|
|
284
|
+
const wtDir = join(dir, ".gsd", "worktrees", "M001");
|
|
285
|
+
mkdirSync(wtDir, { recursive: true });
|
|
286
|
+
writeFileSync(join(wtDir, "leftover.txt"), "stranded from a prior session\n");
|
|
287
|
+
|
|
288
|
+
const result = auditOrphanedMilestoneBranches(dir, "worktree", {
|
|
289
|
+
branchList: () => {
|
|
290
|
+
throw new Error("branch list failed");
|
|
291
|
+
},
|
|
292
|
+
branchExists: (_basePath, branch) => {
|
|
293
|
+
assert.equal(branch, "milestone/M001");
|
|
294
|
+
return false;
|
|
295
|
+
},
|
|
296
|
+
});
|
|
297
|
+
|
|
298
|
+
assert.ok(
|
|
299
|
+
result.recovered.some((r) => r.includes("M001") && r.includes("branch already deleted")),
|
|
300
|
+
`should report verified branch-less orphan cleanup; got: ${JSON.stringify(result.recovered)}`,
|
|
301
|
+
);
|
|
302
|
+
assert.ok(!existsSync(wtDir), "verified branch-less orphan worktree dir should be removed");
|
|
303
|
+
});
|
|
304
|
+
|
|
305
|
+
test("#5879 — branch list failure preserves complete worktree when branch still exists", () => {
|
|
306
|
+
insertMilestone({ id: "M001", title: "Test", status: "complete" });
|
|
307
|
+
|
|
308
|
+
const wtDir = join(dir, ".gsd", "worktrees", "M001");
|
|
309
|
+
mkdirSync(wtDir, { recursive: true });
|
|
310
|
+
writeFileSync(join(wtDir, "live-work.txt"), "do not delete\n");
|
|
311
|
+
|
|
312
|
+
const result = auditOrphanedMilestoneBranches(dir, "worktree", {
|
|
313
|
+
branchList: () => {
|
|
314
|
+
throw new Error("branch list failed");
|
|
315
|
+
},
|
|
316
|
+
branchExists: (_basePath, branch) => {
|
|
317
|
+
assert.equal(branch, "milestone/M001");
|
|
318
|
+
return true;
|
|
319
|
+
},
|
|
320
|
+
});
|
|
321
|
+
|
|
322
|
+
assert.deepStrictEqual(result.recovered, []);
|
|
323
|
+
assert.ok(existsSync(wtDir), "worktree dir must be preserved when branch existence is verified");
|
|
324
|
+
});
|
|
325
|
+
|
|
326
|
+
test("#5879 — skips branch-less orphan for milestone that is not complete", () => {
|
|
327
|
+
// Defensive: only `complete` milestones get the branch-less cleanup. An
|
|
328
|
+
// `active` milestone with no branch but a worktree dir is a different
|
|
329
|
+
// state (probably mid-recovery) and should not be silently wiped.
|
|
330
|
+
insertMilestone({ id: "M001", title: "Test", status: "active" });
|
|
331
|
+
|
|
332
|
+
const wtDir = join(dir, ".gsd", "worktrees", "M001");
|
|
333
|
+
mkdirSync(wtDir, { recursive: true });
|
|
334
|
+
writeFileSync(join(wtDir, "live-work.txt"), "do not delete\n");
|
|
335
|
+
|
|
336
|
+
const result = auditOrphanedMilestoneBranches(dir, "worktree");
|
|
337
|
+
|
|
338
|
+
assert.deepStrictEqual(result.recovered, []);
|
|
339
|
+
assert.ok(existsSync(wtDir), "active milestone worktree dir must be preserved");
|
|
340
|
+
});
|
|
341
|
+
|
|
342
|
+
test("#5879 — branch list failure does not delete worktree for milestone that is not complete", () => {
|
|
343
|
+
insertMilestone({ id: "M001", title: "Test", status: "active" });
|
|
344
|
+
|
|
345
|
+
const wtDir = join(dir, ".gsd", "worktrees", "M001");
|
|
346
|
+
mkdirSync(wtDir, { recursive: true });
|
|
347
|
+
writeFileSync(join(wtDir, "live-work.txt"), "do not delete\n");
|
|
348
|
+
|
|
349
|
+
const result = auditOrphanedMilestoneBranches(dir, "worktree", {
|
|
350
|
+
branchList: () => {
|
|
351
|
+
throw new Error("branch list failed");
|
|
352
|
+
},
|
|
353
|
+
branchExists: () => {
|
|
354
|
+
throw new Error("branchExists should not be called for active milestones");
|
|
355
|
+
},
|
|
356
|
+
});
|
|
357
|
+
|
|
358
|
+
assert.deepStrictEqual(result.recovered, []);
|
|
359
|
+
assert.ok(existsSync(wtDir), "active milestone worktree dir must be preserved");
|
|
360
|
+
});
|
|
361
|
+
|
|
362
|
+
test("#5879 — skips branch-less orphan in 'none' isolation mode", () => {
|
|
363
|
+
insertMilestone({ id: "M001", title: "Test", status: "complete" });
|
|
364
|
+
|
|
365
|
+
const wtDir = join(dir, ".gsd", "worktrees", "M001");
|
|
366
|
+
mkdirSync(wtDir, { recursive: true });
|
|
367
|
+
writeFileSync(join(wtDir, "leftover.txt"), "stranded\n");
|
|
368
|
+
|
|
369
|
+
const result = auditOrphanedMilestoneBranches(dir, "none");
|
|
370
|
+
|
|
371
|
+
assert.deepStrictEqual(result.recovered, []);
|
|
372
|
+
assert.ok(existsSync(wtDir), "'none' mode must not touch worktree dirs");
|
|
373
|
+
});
|
|
254
374
|
});
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { test } from "node:test";
|
|
9
9
|
import assert from "node:assert/strict";
|
|
10
|
-
import { mkdtempSync, mkdirSync, writeFileSync, rmSync } from "node:fs";
|
|
10
|
+
import { existsSync, mkdtempSync, mkdirSync, writeFileSync, rmSync } from "node:fs";
|
|
11
11
|
import { join } from "node:path";
|
|
12
12
|
import { tmpdir } from "node:os";
|
|
13
13
|
|
|
@@ -48,6 +48,60 @@ test("parkMilestone updates DB status to 'parked' (#2694)", () => {
|
|
|
48
48
|
}
|
|
49
49
|
});
|
|
50
50
|
|
|
51
|
+
test("parkMilestone ignores blocked SUMMARY.md when DB milestone is active (#5828)", () => {
|
|
52
|
+
const base = createBase();
|
|
53
|
+
try {
|
|
54
|
+
openDatabase(":memory:");
|
|
55
|
+
insertMilestone({ id: "M001", title: "Test", status: "active" });
|
|
56
|
+
writeFileSync(
|
|
57
|
+
join(base, ".gsd", "milestones", "M001", "M001-SUMMARY.md"),
|
|
58
|
+
[
|
|
59
|
+
"---",
|
|
60
|
+
"status: closeout_blocked",
|
|
61
|
+
"---",
|
|
62
|
+
"",
|
|
63
|
+
"# M001 Summary",
|
|
64
|
+
"",
|
|
65
|
+
"Completion was not persisted.",
|
|
66
|
+
].join("\n"),
|
|
67
|
+
"utf-8",
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
const parked = parkMilestone(base, "M001", "test");
|
|
71
|
+
|
|
72
|
+
assert.ok(parked, "active DB row should allow parking despite a blocked SUMMARY.md");
|
|
73
|
+
assert.ok(
|
|
74
|
+
existsSync(join(base, ".gsd", "milestones", "M001", "M001-PARKED.md")),
|
|
75
|
+
"PARKED.md should be written",
|
|
76
|
+
);
|
|
77
|
+
assert.equal(getMilestone("M001")!.status, "parked", "DB status should be parked");
|
|
78
|
+
} finally {
|
|
79
|
+
closeDatabase();
|
|
80
|
+
rmSync(base, { recursive: true, force: true });
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
test("parkMilestone refuses DB-complete milestones (#5828)", () => {
|
|
85
|
+
const base = createBase();
|
|
86
|
+
try {
|
|
87
|
+
openDatabase(":memory:");
|
|
88
|
+
insertMilestone({ id: "M001", title: "Test", status: "complete" });
|
|
89
|
+
|
|
90
|
+
const parked = parkMilestone(base, "M001", "test");
|
|
91
|
+
|
|
92
|
+
assert.equal(parked, false, "complete DB row should not be parkable");
|
|
93
|
+
assert.equal(
|
|
94
|
+
existsSync(join(base, ".gsd", "milestones", "M001", "M001-PARKED.md")),
|
|
95
|
+
false,
|
|
96
|
+
"PARKED.md should not be written",
|
|
97
|
+
);
|
|
98
|
+
assert.equal(getMilestone("M001")!.status, "complete", "DB status should remain complete");
|
|
99
|
+
} finally {
|
|
100
|
+
closeDatabase();
|
|
101
|
+
rmSync(base, { recursive: true, force: true });
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
|
|
51
105
|
test("unparkMilestone updates DB status to 'active' (#2694)", () => {
|
|
52
106
|
const base = createBase();
|
|
53
107
|
try {
|
|
@@ -116,6 +116,32 @@ test('handlePlanMilestone rejects invalid payloads', async () => {
|
|
|
116
116
|
}
|
|
117
117
|
});
|
|
118
118
|
|
|
119
|
+
test('handlePlanMilestone rejects delimiter characters in milestone and slice titles', async () => {
|
|
120
|
+
const base = makeTmpBase();
|
|
121
|
+
const dbPath = join(base, '.gsd', 'gsd.db');
|
|
122
|
+
openDatabase(dbPath);
|
|
123
|
+
|
|
124
|
+
try {
|
|
125
|
+
const milestoneResult = await handlePlanMilestone({ ...validParams(), title: 'Client/Server split' }, base);
|
|
126
|
+
assert.ok('error' in milestoneResult);
|
|
127
|
+
assert.match(milestoneResult.error, /validation failed: title is invalid: .*forward slash/);
|
|
128
|
+
assert.equal(getMilestone('M001'), null, 'invalid milestone title must not persist');
|
|
129
|
+
|
|
130
|
+
const sliceResult = await handlePlanMilestone({
|
|
131
|
+
...validParams(),
|
|
132
|
+
slices: [
|
|
133
|
+
validParams().slices[0],
|
|
134
|
+
{ ...validParams().slices[1], title: 'Client/Server migration' },
|
|
135
|
+
],
|
|
136
|
+
}, base);
|
|
137
|
+
assert.ok('error' in sliceResult);
|
|
138
|
+
assert.match(sliceResult.error, /validation failed: slices\[1\]\.title is invalid: .*forward slash/);
|
|
139
|
+
assert.equal(getMilestoneSlices('M001').length, 0, 'invalid slice title must not persist partial roadmap state');
|
|
140
|
+
} finally {
|
|
141
|
+
cleanup(base);
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
|
|
119
145
|
test('handlePlanMilestone surfaces render failures and does not clear parse-visible state on failure', async () => {
|
|
120
146
|
const base = makeTmpBase();
|
|
121
147
|
const dbPath = join(base, '.gsd', 'gsd.db');
|
|
@@ -6,7 +6,7 @@ import { mkdtempSync, mkdirSync, rmSync, readFileSync, existsSync, writeFileSync
|
|
|
6
6
|
import { join } from 'node:path';
|
|
7
7
|
import { tmpdir } from 'node:os';
|
|
8
8
|
|
|
9
|
-
import { openDatabase, closeDatabase, insertMilestone, insertSlice, getSlice, getSliceTasks, getTask } from '../gsd-db.ts';
|
|
9
|
+
import { openDatabase, closeDatabase, insertMilestone, insertSlice, getSlice, getSliceTasks, getTask, getGateResults, updateTaskStatus } from '../gsd-db.ts';
|
|
10
10
|
import { handlePlanSlice } from '../tools/plan-slice.ts';
|
|
11
11
|
import { parsePlan } from '../parsers-legacy.ts';
|
|
12
12
|
import { parseTaskPlanFile } from '../files.ts';
|
|
@@ -15,6 +15,10 @@ import { deriveState, invalidateStateCache } from '../state.ts';
|
|
|
15
15
|
function makeTmpBase(): string {
|
|
16
16
|
const base = mkdtempSync(join(tmpdir(), 'gsd-plan-slice-'));
|
|
17
17
|
mkdirSync(join(base, '.gsd', 'milestones', 'M001', 'slices', 'S02', 'tasks'), { recursive: true });
|
|
18
|
+
mkdirSync(join(base, 'src', 'resources', 'extensions', 'gsd', 'tools'), { recursive: true });
|
|
19
|
+
writeFileSync(join(base, 'src', 'resources', 'extensions', 'gsd', 'tools', 'plan-milestone.ts'), '// fixture\n', 'utf-8');
|
|
20
|
+
writeFileSync(join(base, 'src', 'resources', 'extensions', 'gsd', 'tools', 'plan-task.ts'), '// fixture\n', 'utf-8');
|
|
21
|
+
writeFileSync(join(base, 'stale-input.py'), '# fixture\n', 'utf-8');
|
|
18
22
|
return base;
|
|
19
23
|
}
|
|
20
24
|
|
|
@@ -125,6 +129,31 @@ test('handlePlanSlice advances DB-derived state out of planning immediately', as
|
|
|
125
129
|
}
|
|
126
130
|
});
|
|
127
131
|
|
|
132
|
+
test('handlePlanSlice clears sketch flag so DB-derived state leaves refining', async () => {
|
|
133
|
+
const base = makeTmpBase();
|
|
134
|
+
openDatabase(join(base, '.gsd', 'gsd.db'));
|
|
135
|
+
|
|
136
|
+
try {
|
|
137
|
+
insertMilestone({ id: 'M001', title: 'Milestone', status: 'active' });
|
|
138
|
+
insertSlice({ id: 'S02', milestoneId: 'M001', title: 'Planning slice', status: 'pending', demo: 'Rendered plans exist.', isSketch: true });
|
|
139
|
+
|
|
140
|
+
invalidateStateCache();
|
|
141
|
+
const before = await deriveState(base);
|
|
142
|
+
assert.equal(before.phase, 'refining');
|
|
143
|
+
|
|
144
|
+
const result = await handlePlanSlice(validParams(), base);
|
|
145
|
+
assert.ok(!('error' in result), `unexpected error: ${'error' in result ? result.error : ''}`);
|
|
146
|
+
assert.equal(getSlice('M001', 'S02')?.is_sketch, 0, 'planned slice must no longer be treated as a sketch');
|
|
147
|
+
|
|
148
|
+
invalidateStateCache();
|
|
149
|
+
const after = await deriveState(base);
|
|
150
|
+
assert.notEqual(after.phase, 'refining');
|
|
151
|
+
assert.equal(after.progress?.tasks?.total, 2);
|
|
152
|
+
} finally {
|
|
153
|
+
cleanup(base);
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
|
|
128
157
|
test('handlePlanSlice leaves omitted enrichment fields empty instead of rendering placeholders', async () => {
|
|
129
158
|
const base = makeTmpBase();
|
|
130
159
|
openDatabase(join(base, '.gsd', 'gsd.db'));
|
|
@@ -172,6 +201,28 @@ test('handlePlanSlice rejects invalid payloads', async () => {
|
|
|
172
201
|
}
|
|
173
202
|
});
|
|
174
203
|
|
|
204
|
+
test('handlePlanSlice explains string task IO fields must be arrays', async () => {
|
|
205
|
+
const base = makeTmpBase();
|
|
206
|
+
openDatabase(join(base, '.gsd', 'gsd.db'));
|
|
207
|
+
|
|
208
|
+
try {
|
|
209
|
+
seedParentSlice();
|
|
210
|
+
const result = await handlePlanSlice({
|
|
211
|
+
...validParams(),
|
|
212
|
+
tasks: [
|
|
213
|
+
{
|
|
214
|
+
...validParams().tasks[0],
|
|
215
|
+
inputs: 'src/index.ts' as unknown as string[],
|
|
216
|
+
},
|
|
217
|
+
],
|
|
218
|
+
}, base);
|
|
219
|
+
assert.ok('error' in result);
|
|
220
|
+
assert.match(result.error, /validation failed: tasks\[0\]\.inputs must be an array of strings, not string/);
|
|
221
|
+
} finally {
|
|
222
|
+
cleanup(base);
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
|
|
175
226
|
test('handlePlanSlice rejects absolute task IO paths outside the active worktree', async () => {
|
|
176
227
|
const base = makeTmpBase();
|
|
177
228
|
openDatabase(join(base, '.gsd', 'gsd.db'));
|
|
@@ -198,6 +249,63 @@ test('handlePlanSlice rejects absolute task IO paths outside the active worktree
|
|
|
198
249
|
}
|
|
199
250
|
});
|
|
200
251
|
|
|
252
|
+
test('handlePlanSlice rejects missing task input paths before persisting tasks', async () => {
|
|
253
|
+
const base = makeTmpBase();
|
|
254
|
+
openDatabase(join(base, '.gsd', 'gsd.db'));
|
|
255
|
+
|
|
256
|
+
try {
|
|
257
|
+
seedParentSlice();
|
|
258
|
+
const result = await handlePlanSlice({
|
|
259
|
+
...validParams(),
|
|
260
|
+
tasks: [
|
|
261
|
+
{
|
|
262
|
+
...validParams().tasks[0],
|
|
263
|
+
inputs: ['fixtures/missing-source.json'],
|
|
264
|
+
},
|
|
265
|
+
],
|
|
266
|
+
}, base);
|
|
267
|
+
|
|
268
|
+
assert.ok('error' in result);
|
|
269
|
+
assert.match(result.error, /pre-execution validation failed:/);
|
|
270
|
+
assert.match(result.error, /fixtures\/missing-source\.json/);
|
|
271
|
+
assert.equal(getSliceTasks('M001', 'S02').length, 0, 'invalid planning IO must not persist tasks');
|
|
272
|
+
} finally {
|
|
273
|
+
cleanup(base);
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
|
|
277
|
+
test('handlePlanSlice rejects task input paths created by later tasks before persisting tasks', async () => {
|
|
278
|
+
const base = makeTmpBase();
|
|
279
|
+
openDatabase(join(base, '.gsd', 'gsd.db'));
|
|
280
|
+
|
|
281
|
+
try {
|
|
282
|
+
seedParentSlice();
|
|
283
|
+
const params = validParams();
|
|
284
|
+
const result = await handlePlanSlice({
|
|
285
|
+
...params,
|
|
286
|
+
tasks: [
|
|
287
|
+
{
|
|
288
|
+
...params.tasks[0],
|
|
289
|
+
inputs: ['generated/report.json'],
|
|
290
|
+
expectedOutput: ['generated/summary.json'],
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
...params.tasks[1],
|
|
294
|
+
inputs: [],
|
|
295
|
+
expectedOutput: ['generated/report.json'],
|
|
296
|
+
},
|
|
297
|
+
],
|
|
298
|
+
}, base);
|
|
299
|
+
|
|
300
|
+
assert.ok('error' in result);
|
|
301
|
+
assert.match(result.error, /pre-execution validation failed:/);
|
|
302
|
+
assert.match(result.error, /sequence violation/);
|
|
303
|
+
assert.equal(getSliceTasks('M001', 'S02').length, 0, 'invalid task ordering must not persist tasks');
|
|
304
|
+
} finally {
|
|
305
|
+
cleanup(base);
|
|
306
|
+
}
|
|
307
|
+
});
|
|
308
|
+
|
|
201
309
|
test('handlePlanSlice accepts absolute task IO paths inside the active worktree', async () => {
|
|
202
310
|
const base = makeTmpBase();
|
|
203
311
|
openDatabase(join(base, '.gsd', 'gsd.db'));
|
|
@@ -304,3 +412,119 @@ test('handlePlanSlice reruns idempotently and refreshes parse-visible state', as
|
|
|
304
412
|
cleanup(base);
|
|
305
413
|
}
|
|
306
414
|
});
|
|
415
|
+
|
|
416
|
+
test('handlePlanSlice removes omitted pending tasks when replanning a smaller task set', async () => {
|
|
417
|
+
const base = makeTmpBase();
|
|
418
|
+
openDatabase(join(base, '.gsd', 'gsd.db'));
|
|
419
|
+
|
|
420
|
+
try {
|
|
421
|
+
seedParentSlice();
|
|
422
|
+
const fourTaskPlan = {
|
|
423
|
+
...validParams(),
|
|
424
|
+
tasks: [
|
|
425
|
+
...validParams().tasks,
|
|
426
|
+
{ ...validParams().tasks[0], taskId: 'T03', title: 'Third task' },
|
|
427
|
+
{ ...validParams().tasks[0], taskId: 'T04', title: 'Stale task', inputs: ['stale-input.py'] },
|
|
428
|
+
],
|
|
429
|
+
};
|
|
430
|
+
|
|
431
|
+
const first = await handlePlanSlice(fourTaskPlan, base);
|
|
432
|
+
assert.ok(!('error' in first), `unexpected error: ${'error' in first ? first.error : ''}`);
|
|
433
|
+
const staleTaskPlanPath = join(base, '.gsd', 'milestones', 'M001', 'slices', 'S02', 'tasks', 'T04-PLAN.md');
|
|
434
|
+
assert.ok(existsSync(staleTaskPlanPath), 'initial plan should render T04');
|
|
435
|
+
|
|
436
|
+
const second = await handlePlanSlice({
|
|
437
|
+
...validParams(),
|
|
438
|
+
tasks: fourTaskPlan.tasks.filter((task) => task.taskId !== 'T04'),
|
|
439
|
+
}, base);
|
|
440
|
+
assert.ok(!('error' in second), `unexpected error: ${'error' in second ? second.error : ''}`);
|
|
441
|
+
|
|
442
|
+
assert.deepEqual(getSliceTasks('M001', 'S02').map((task) => task.id), ['T01', 'T02', 'T03']);
|
|
443
|
+
assert.equal(getGateResults('M001', 'S02', 'task').some((gate) => gate.task_id === 'T04'), false);
|
|
444
|
+
assert.equal(existsSync(staleTaskPlanPath), false, 'omitted task plan artifact should be removed');
|
|
445
|
+
} finally {
|
|
446
|
+
cleanup(base);
|
|
447
|
+
}
|
|
448
|
+
});
|
|
449
|
+
|
|
450
|
+
test('handlePlanSlice rejects omitted completed tasks without changing slice or task state', async () => {
|
|
451
|
+
const base = makeTmpBase();
|
|
452
|
+
openDatabase(join(base, '.gsd', 'gsd.db'));
|
|
453
|
+
|
|
454
|
+
try {
|
|
455
|
+
seedParentSlice();
|
|
456
|
+
const fourTaskPlan = {
|
|
457
|
+
...validParams(),
|
|
458
|
+
tasks: [
|
|
459
|
+
...validParams().tasks,
|
|
460
|
+
{ ...validParams().tasks[0], taskId: 'T03', title: 'Third task' },
|
|
461
|
+
{ ...validParams().tasks[0], taskId: 'T04', title: 'Stale task', inputs: ['stale-input.py'] },
|
|
462
|
+
],
|
|
463
|
+
};
|
|
464
|
+
|
|
465
|
+
const first = await handlePlanSlice(fourTaskPlan, base);
|
|
466
|
+
assert.ok(!('error' in first), `unexpected error: ${'error' in first ? first.error : ''}`);
|
|
467
|
+
const staleTaskPlanPath = join(base, '.gsd', 'milestones', 'M001', 'slices', 'S02', 'tasks', 'T04-PLAN.md');
|
|
468
|
+
assert.ok(existsSync(staleTaskPlanPath), 'initial plan should render T04');
|
|
469
|
+
|
|
470
|
+
updateTaskStatus('M001', 'S02', 'T04', 'complete', '2026-05-12T00:00:00.000Z');
|
|
471
|
+
const tasksBefore = getSliceTasks('M001', 'S02');
|
|
472
|
+
const gatesBefore = getGateResults('M001', 'S02', 'task');
|
|
473
|
+
|
|
474
|
+
const second = await handlePlanSlice({
|
|
475
|
+
...validParams(),
|
|
476
|
+
goal: 'Rejected replan should not persist.',
|
|
477
|
+
tasks: fourTaskPlan.tasks.filter((task) => task.taskId !== 'T04'),
|
|
478
|
+
}, base);
|
|
479
|
+
assert.deepEqual(second, { error: 'cannot remove completed task T04' });
|
|
480
|
+
|
|
481
|
+
assert.equal(getSlice('M001', 'S02')?.goal, 'Persist slice planning through the DB.');
|
|
482
|
+
assert.deepEqual(getSliceTasks('M001', 'S02'), tasksBefore);
|
|
483
|
+
assert.deepEqual(getGateResults('M001', 'S02', 'task'), gatesBefore);
|
|
484
|
+
assert.ok(existsSync(staleTaskPlanPath), 'completed task plan artifact should remain after rejected replan');
|
|
485
|
+
} finally {
|
|
486
|
+
cleanup(base);
|
|
487
|
+
}
|
|
488
|
+
});
|
|
489
|
+
|
|
490
|
+
test('regression: validateTasks surfaces clean per-field errors for non-array IO inputs', async () => {
|
|
491
|
+
// Regression for the bug fixed in PR #5872: an earlier refactor on main
|
|
492
|
+
// (0b0e1a901) re-added validateStringArray() calls inside validateTasks
|
|
493
|
+
// without re-adding its import. The catch around validateParams swallowed
|
|
494
|
+
// the ReferenceError into a generic "validation failed: validateStringArray
|
|
495
|
+
// is not defined" message, so silent runtime breakage was possible.
|
|
496
|
+
//
|
|
497
|
+
// Exercise every validateStringArray call site (files, inputs, expectedOutput)
|
|
498
|
+
// so a future missing-import would surface as a per-field assertion failure
|
|
499
|
+
// here, not a deep ReferenceError that's easy to mis-diagnose.
|
|
500
|
+
const base = makeTmpBase();
|
|
501
|
+
openDatabase(join(base, '.gsd', 'gsd.db'));
|
|
502
|
+
|
|
503
|
+
try {
|
|
504
|
+
seedParentSlice();
|
|
505
|
+
|
|
506
|
+
for (const field of ['files', 'inputs', 'expectedOutput'] as const) {
|
|
507
|
+
const result = await handlePlanSlice({
|
|
508
|
+
...validParams(),
|
|
509
|
+
tasks: [{
|
|
510
|
+
...validParams().tasks[0],
|
|
511
|
+
[field]: 'not-an-array' as unknown as string[],
|
|
512
|
+
}],
|
|
513
|
+
}, base);
|
|
514
|
+
assert.ok('error' in result, `${field}: expected validation error, got success`);
|
|
515
|
+
assert.match(
|
|
516
|
+
result.error,
|
|
517
|
+
new RegExp(`tasks\\[0\\]\\.${field} must be an array`),
|
|
518
|
+
`${field}: expected per-field validation message, got: ${result.error}`,
|
|
519
|
+
);
|
|
520
|
+
assert.doesNotMatch(
|
|
521
|
+
result.error,
|
|
522
|
+
/is not defined/,
|
|
523
|
+
`${field}: validation surfaced ReferenceError — likely a missing import in plan-slice.ts`,
|
|
524
|
+
);
|
|
525
|
+
assert.equal(getSliceTasks('M001', 'S02').length, 0, `${field}: invalid input must not persist`);
|
|
526
|
+
}
|
|
527
|
+
} finally {
|
|
528
|
+
cleanup(base);
|
|
529
|
+
}
|
|
530
|
+
});
|
|
@@ -79,6 +79,23 @@ test('handlePlanTask rejects invalid payloads', async () => {
|
|
|
79
79
|
}
|
|
80
80
|
});
|
|
81
81
|
|
|
82
|
+
test('handlePlanTask explains string IO fields must be arrays', async () => {
|
|
83
|
+
const base = makeTmpBase();
|
|
84
|
+
openDatabase(join(base, '.gsd', 'gsd.db'));
|
|
85
|
+
|
|
86
|
+
try {
|
|
87
|
+
seedParent();
|
|
88
|
+
const result = await handlePlanTask({
|
|
89
|
+
...validParams(),
|
|
90
|
+
expectedOutput: 'src/output.ts' as unknown as string[],
|
|
91
|
+
}, base);
|
|
92
|
+
assert.ok('error' in result);
|
|
93
|
+
assert.match(result.error, /validation failed: expectedOutput must be an array of strings, not string/);
|
|
94
|
+
} finally {
|
|
95
|
+
cleanup(base);
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
|
|
82
99
|
test('handlePlanTask rejects absolute task IO paths outside the active worktree', async () => {
|
|
83
100
|
const base = makeTmpBase();
|
|
84
101
|
openDatabase(join(base, '.gsd', 'gsd.db'));
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// Project/App: GSD-2
|
|
2
|
+
// File Purpose: Tests for post-execution retry bypass and verification gate failure handling.
|
|
1
3
|
/**
|
|
2
4
|
* post-exec-retry-bypass.test.ts — Tests for post-execution blocking failure retry bypass.
|
|
3
5
|
*
|
|
@@ -9,7 +11,7 @@
|
|
|
9
11
|
import { describe, test, mock, beforeEach, afterEach } from "node:test";
|
|
10
12
|
import assert from "node:assert/strict";
|
|
11
13
|
import { tmpdir } from "node:os";
|
|
12
|
-
import { mkdirSync, writeFileSync, rmSync
|
|
14
|
+
import { mkdirSync, readFileSync, writeFileSync, rmSync } from "node:fs";
|
|
13
15
|
import { join } from "node:path";
|
|
14
16
|
|
|
15
17
|
import { runPostUnitVerification, type VerificationContext } from "../auto-verification.ts";
|
|
@@ -71,6 +73,7 @@ function setupTestEnvironment(): void {
|
|
|
71
73
|
mkdirSync(milestonesDir, { recursive: true });
|
|
72
74
|
|
|
73
75
|
process.chdir(tempDir);
|
|
76
|
+
invalidateAllCaches();
|
|
74
77
|
_clearGsdRootCache();
|
|
75
78
|
|
|
76
79
|
dbPath = join(gsdDir, "gsd.db");
|
|
@@ -140,6 +143,34 @@ function createBasicTask(): void {
|
|
|
140
143
|
});
|
|
141
144
|
}
|
|
142
145
|
|
|
146
|
+
function createTaskWithoutVerify(): void {
|
|
147
|
+
insertMilestone({ id: "M001" });
|
|
148
|
+
insertSlice({
|
|
149
|
+
id: "S01",
|
|
150
|
+
milestoneId: "M001",
|
|
151
|
+
title: "Test Slice",
|
|
152
|
+
risk: "low",
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
insertTask({
|
|
156
|
+
id: "T01",
|
|
157
|
+
sliceId: "S01",
|
|
158
|
+
milestoneId: "M001",
|
|
159
|
+
title: "Task without host verification",
|
|
160
|
+
status: "pending",
|
|
161
|
+
planning: {
|
|
162
|
+
description: "Task intentionally missing runnable verification",
|
|
163
|
+
estimate: "1h",
|
|
164
|
+
files: [],
|
|
165
|
+
verify: "",
|
|
166
|
+
inputs: [],
|
|
167
|
+
expectedOutput: [],
|
|
168
|
+
observabilityImpact: "",
|
|
169
|
+
},
|
|
170
|
+
sequence: 0,
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
|
|
143
174
|
function createPostExecFailureTask(): void {
|
|
144
175
|
insertMilestone({ id: "M001" });
|
|
145
176
|
insertSlice({
|
|
@@ -327,6 +358,53 @@ describe("Post-execution blocking failure retry bypass", () => {
|
|
|
327
358
|
assert.equal(row?.outcome, "fail");
|
|
328
359
|
assert.equal(row?.failure_class, "artifact");
|
|
329
360
|
});
|
|
361
|
+
|
|
362
|
+
test("execute-task with no host-owned verification pauses fail-closed", async () => {
|
|
363
|
+
createTaskWithoutVerify();
|
|
364
|
+
|
|
365
|
+
const ctx = makeMockCtx();
|
|
366
|
+
const pi = makeMockPi();
|
|
367
|
+
const pauseAutoMock = mock.fn(async () => {});
|
|
368
|
+
const s = makeMockSession(tempDir, { type: "execute-task", id: "M001/S01/T01" });
|
|
369
|
+
|
|
370
|
+
const result = await runPostUnitVerification({ s, ctx, pi }, pauseAutoMock);
|
|
371
|
+
|
|
372
|
+
assert.equal(result, "pause");
|
|
373
|
+
assert.equal(pauseAutoMock.mock.callCount(), 1);
|
|
374
|
+
assert.equal(s.pendingVerificationRetry, null);
|
|
375
|
+
|
|
376
|
+
const evidencePath = join(tempDir, ".gsd", "milestones", "M001", "slices", "S01", "tasks", "T01-VERIFY.json");
|
|
377
|
+
const evidence = JSON.parse(readFileSync(evidencePath, "utf-8"));
|
|
378
|
+
assert.equal(evidence.passed, false);
|
|
379
|
+
assert.equal(evidence.discoverySource, "none");
|
|
380
|
+
assert.ok(!("retryAttempt" in evidence), "no-host-checks evidence must not include retryAttempt");
|
|
381
|
+
assert.ok(!("maxRetries" in evidence), "no-host-checks evidence must not include maxRetries");
|
|
382
|
+
});
|
|
383
|
+
|
|
384
|
+
test("auto-discovered package.json verification failure retries instead of continuing", async () => {
|
|
385
|
+
createTaskWithoutVerify();
|
|
386
|
+
writeFileSync(
|
|
387
|
+
join(tempDir, "package.json"),
|
|
388
|
+
JSON.stringify({ scripts: { test: "exit 1" } }),
|
|
389
|
+
"utf-8",
|
|
390
|
+
);
|
|
391
|
+
writePreferences({
|
|
392
|
+
verification_auto_fix: true,
|
|
393
|
+
verification_max_retries: 2,
|
|
394
|
+
});
|
|
395
|
+
|
|
396
|
+
const ctx = makeMockCtx();
|
|
397
|
+
const pi = makeMockPi();
|
|
398
|
+
const pauseAutoMock = mock.fn(async () => {});
|
|
399
|
+
const s = makeMockSession(tempDir, { type: "execute-task", id: "M001/S01/T01" });
|
|
400
|
+
|
|
401
|
+
const result = await runPostUnitVerification({ s, ctx, pi }, pauseAutoMock);
|
|
402
|
+
|
|
403
|
+
assert.equal(result, "retry");
|
|
404
|
+
assert.equal(pauseAutoMock.mock.callCount(), 0);
|
|
405
|
+
assert.equal(s.pendingVerificationRetry?.unitId, "M001/S01/T01");
|
|
406
|
+
assert.match(s.pendingVerificationRetry?.failureContext ?? "", /npm run test/);
|
|
407
|
+
});
|
|
330
408
|
});
|
|
331
409
|
|
|
332
410
|
describe("Post-execution retry behavior", () => {
|