gsd-pi 2.82.0-dev.2841a1e44 → 2.82.0-dev.98ea09b1e
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 +2 -2
- package/dist/resources/.managed-resources-content-hash +1 -1
- package/dist/resources/GSD-WORKFLOW.md +7 -0
- package/dist/resources/extensions/claude-code-cli/partial-builder.js +2 -1
- 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 +70 -9
- 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-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 +5 -2
- package/dist/resources/extensions/gsd/bootstrap/write-gate.js +13 -1
- package/dist/resources/extensions/gsd/commands/handlers/core.js +17 -1
- 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 +13 -6
- package/dist/resources/extensions/gsd/migrate/parsers.js +10 -0
- package/dist/resources/extensions/gsd/migration-auto-check.js +12 -17
- 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/complete-milestone.md +1 -1
- package/dist/resources/extensions/gsd/prompts/complete-slice.md +1 -1
- package/dist/resources/extensions/gsd/prompts/discuss-headless.md +8 -8
- package/dist/resources/extensions/gsd/prompts/discuss.md +9 -9
- package/dist/resources/extensions/gsd/prompts/guided-discuss-project.md +4 -4
- package/dist/resources/extensions/gsd/prompts/guided-discuss-requirements.md +3 -3
- package/dist/resources/extensions/gsd/prompts/plan-slice.md +4 -4
- package/dist/resources/extensions/gsd/prompts/queue.md +4 -4
- package/dist/resources/extensions/gsd/prompts/refine-slice.md +2 -2
- package/dist/resources/extensions/gsd/prompts/rewrite-docs.md +1 -1
- package/dist/resources/extensions/gsd/state-reconciliation/drift/merge-state.js +6 -1
- package/dist/resources/extensions/gsd/state-reconciliation/drift/project-md.js +9 -14
- package/dist/resources/extensions/gsd/state-reconciliation/drift/roadmap.js +19 -24
- 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 +7 -8
- package/dist/resources/extensions/gsd/validation.js +23 -1
- package/dist/resources/extensions/gsd/verification-gate.js +68 -7
- 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/visual-brief/page-contract.js +2 -0
- package/dist/resources/extensions/visual-brief/prompts.js +29 -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 +13 -13
- 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/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 +13 -13
- 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/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/app/layout-8c10ec293ae0f1d5.js +1 -0
- package/dist/web/standalone/.next/static/chunks/{webpack-6a95bc41e0f7ec89.js → webpack-9a4db269f9ed63ad.js} +1 -1
- package/dist/web/standalone/.next/static/css/746ee28c929d1880.css +1 -0
- package/package.json +2 -2
- 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 +7 -0
- 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/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 +77 -7
- 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-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 +3 -1
- package/src/resources/extensions/gsd/bootstrap/write-gate.ts +16 -1
- package/src/resources/extensions/gsd/commands/handlers/core.ts +17 -1
- 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 +14 -7
- package/src/resources/extensions/gsd/migrate/parsers.ts +11 -0
- package/src/resources/extensions/gsd/migration-auto-check.ts +15 -23
- 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/complete-milestone.md +1 -1
- package/src/resources/extensions/gsd/prompts/complete-slice.md +1 -1
- package/src/resources/extensions/gsd/prompts/discuss-headless.md +8 -8
- package/src/resources/extensions/gsd/prompts/discuss.md +9 -9
- package/src/resources/extensions/gsd/prompts/guided-discuss-project.md +4 -4
- package/src/resources/extensions/gsd/prompts/guided-discuss-requirements.md +3 -3
- package/src/resources/extensions/gsd/prompts/plan-slice.md +4 -4
- package/src/resources/extensions/gsd/prompts/queue.md +4 -4
- package/src/resources/extensions/gsd/prompts/refine-slice.md +2 -2
- package/src/resources/extensions/gsd/prompts/rewrite-docs.md +1 -1
- package/src/resources/extensions/gsd/state-reconciliation/drift/merge-state.ts +8 -1
- package/src/resources/extensions/gsd/state-reconciliation/drift/project-md.ts +12 -15
- package/src/resources/extensions/gsd/state-reconciliation/drift/roadmap.ts +17 -25
- 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/complete-milestone.test.ts +4 -1
- package/src/resources/extensions/gsd/tests/complete-slice.test.ts +5 -9
- 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/db-authority-regression.test.ts +208 -0
- 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/export-html-enhancements.test.ts +8 -0
- package/src/resources/extensions/gsd/tests/guided-discuss-project-prompt-rendering.test.ts +2 -0
- package/src/resources/extensions/gsd/tests/guided-flow.test.ts +21 -0
- package/src/resources/extensions/gsd/tests/headless-milestone-parity.test.ts +6 -6
- 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/migration-auto-check.test.ts +26 -18
- 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-prompt.test.ts +2 -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-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/state-reconciliation-drift.test.ts +119 -23
- 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 +65 -7
- package/src/resources/extensions/gsd/tests/verification-gate.test.ts +110 -1
- 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 +38 -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 +12 -9
- package/src/resources/extensions/gsd/validation.ts +23 -1
- package/src/resources/extensions/gsd/verification-gate.ts +78 -6
- 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/visual-brief/page-contract.ts +2 -0
- package/src/resources/extensions/visual-brief/prompts.ts +37 -1
- package/src/resources/extensions/visual-brief/tests/visual-brief.test.ts +40 -0
- package/dist/web/standalone/.next/server/chunks/5822.js +0 -2
- package/dist/web/standalone/.next/static/chunks/app/layout-a16c7a7ecdf0c2cf.js +0 -1
- package/dist/web/standalone/.next/static/css/0262768ec1b89d34.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/{Qgr2B_MRhPxC0z8fwv4vT → euQ0CLP_v8V4e76Tu3odJ}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{Qgr2B_MRhPxC0z8fwv4vT → euQ0CLP_v8V4e76Tu3odJ}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
// Project/App: GSD-2
|
|
2
|
+
// File Purpose: Regression tests for DB authority over markdown projections.
|
|
3
|
+
|
|
4
|
+
import test from "node:test";
|
|
5
|
+
import assert from "node:assert/strict";
|
|
6
|
+
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
|
7
|
+
import { join } from "node:path";
|
|
8
|
+
import { tmpdir } from "node:os";
|
|
9
|
+
|
|
10
|
+
import {
|
|
11
|
+
closeDatabase,
|
|
12
|
+
getAllMilestones,
|
|
13
|
+
getSliceTasks,
|
|
14
|
+
insertMilestone,
|
|
15
|
+
insertRequirement,
|
|
16
|
+
insertSlice,
|
|
17
|
+
openDatabase,
|
|
18
|
+
} from "../gsd-db.ts";
|
|
19
|
+
import { migrateHierarchyToDb } from "../md-importer.ts";
|
|
20
|
+
import { checkMarkdownHierarchyAgainstDb } from "../migration-auto-check.ts";
|
|
21
|
+
import { queryDecisions } from "../context-store.ts";
|
|
22
|
+
import { deriveStateFromDb, invalidateStateCache } from "../state.ts";
|
|
23
|
+
import type { Requirement } from "../types.ts";
|
|
24
|
+
|
|
25
|
+
function makeBase(prefix = "gsd-db-authority-"): string {
|
|
26
|
+
const base = mkdtempSync(join(tmpdir(), prefix));
|
|
27
|
+
mkdirSync(join(base, ".gsd"), { recursive: true });
|
|
28
|
+
return base;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function cleanup(base: string): void {
|
|
32
|
+
try {
|
|
33
|
+
closeDatabase();
|
|
34
|
+
} catch {
|
|
35
|
+
/* noop */
|
|
36
|
+
}
|
|
37
|
+
rmSync(base, { recursive: true, force: true });
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function openProjectDb(base: string): void {
|
|
41
|
+
openDatabase(join(base, ".gsd", "gsd.db"));
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function activeRequirement(id: string): Requirement {
|
|
45
|
+
return {
|
|
46
|
+
id,
|
|
47
|
+
class: "functional",
|
|
48
|
+
status: "active",
|
|
49
|
+
description: `${id} from DB`,
|
|
50
|
+
why: "DB authority regression fixture",
|
|
51
|
+
source: "test",
|
|
52
|
+
primary_owner: "M999/S01",
|
|
53
|
+
supporting_slices: "",
|
|
54
|
+
validation: "derive state",
|
|
55
|
+
notes: "",
|
|
56
|
+
full_content: `${id} from DB`,
|
|
57
|
+
superseded_by: null,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
test("DB authority: PROJECT.md and QUEUE-ORDER projections do not choose runtime milestone", async (t) => {
|
|
62
|
+
const base = makeBase();
|
|
63
|
+
t.after(() => cleanup(base));
|
|
64
|
+
|
|
65
|
+
mkdirSync(join(base, ".gsd", "milestones", "M001"), { recursive: true });
|
|
66
|
+
writeFileSync(
|
|
67
|
+
join(base, ".gsd", "PROJECT.md"),
|
|
68
|
+
[
|
|
69
|
+
"# Projection Project",
|
|
70
|
+
"",
|
|
71
|
+
"## Milestone Sequence",
|
|
72
|
+
"- [ ] M001: Projection Only -- should not become active",
|
|
73
|
+
"",
|
|
74
|
+
].join("\n"),
|
|
75
|
+
);
|
|
76
|
+
writeFileSync(
|
|
77
|
+
join(base, ".gsd", "QUEUE-ORDER.json"),
|
|
78
|
+
JSON.stringify({ order: ["M001", "M999"], updatedAt: new Date().toISOString() }),
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
openProjectDb(base);
|
|
82
|
+
insertMilestone({ id: "M999", title: "DB Milestone", status: "active" });
|
|
83
|
+
insertSlice({ id: "S01", milestoneId: "M999", title: "DB Slice", status: "pending", risk: "low", depends: [], demo: "DB demo", sequence: 1 });
|
|
84
|
+
|
|
85
|
+
invalidateStateCache();
|
|
86
|
+
const state = await deriveStateFromDb(base);
|
|
87
|
+
|
|
88
|
+
assert.equal(state.activeMilestone?.id, "M999");
|
|
89
|
+
assert.equal(state.registry.some((entry) => entry.id === "M001"), false);
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
test("DB authority: REQUIREMENTS.md and DECISIONS.md projections do not populate DB reads", async (t) => {
|
|
93
|
+
const base = makeBase();
|
|
94
|
+
t.after(() => cleanup(base));
|
|
95
|
+
|
|
96
|
+
writeFileSync(
|
|
97
|
+
join(base, ".gsd", "REQUIREMENTS.md"),
|
|
98
|
+
[
|
|
99
|
+
"# Requirements",
|
|
100
|
+
"",
|
|
101
|
+
"## Active",
|
|
102
|
+
"### R001 - Projection-only requirement",
|
|
103
|
+
"- Class: functional",
|
|
104
|
+
"- Status: active",
|
|
105
|
+
"",
|
|
106
|
+
].join("\n"),
|
|
107
|
+
);
|
|
108
|
+
writeFileSync(
|
|
109
|
+
join(base, ".gsd", "DECISIONS.md"),
|
|
110
|
+
[
|
|
111
|
+
"# Decisions",
|
|
112
|
+
"",
|
|
113
|
+
"| # | When / Context | Scope | Decision | Choice | Rationale | Revisable | Made By |",
|
|
114
|
+
"|---|----------------|-------|----------|--------|-----------|----------|---------|",
|
|
115
|
+
"| D001 | Now | global | Projection-only decision | Ignore | DB is authority | Yes | human |",
|
|
116
|
+
"",
|
|
117
|
+
].join("\n"),
|
|
118
|
+
);
|
|
119
|
+
|
|
120
|
+
openProjectDb(base);
|
|
121
|
+
insertMilestone({ id: "M999", title: "DB Milestone", status: "active" });
|
|
122
|
+
|
|
123
|
+
invalidateStateCache();
|
|
124
|
+
const state = await deriveStateFromDb(base);
|
|
125
|
+
|
|
126
|
+
assert.deepEqual(state.requirements, {
|
|
127
|
+
active: 0,
|
|
128
|
+
validated: 0,
|
|
129
|
+
deferred: 0,
|
|
130
|
+
outOfScope: 0,
|
|
131
|
+
blocked: 0,
|
|
132
|
+
total: 0,
|
|
133
|
+
});
|
|
134
|
+
assert.deepEqual(queryDecisions(), []);
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
test("DB authority: DB requirements remain canonical when REQUIREMENTS.md disagrees", async (t) => {
|
|
138
|
+
const base = makeBase();
|
|
139
|
+
t.after(() => cleanup(base));
|
|
140
|
+
|
|
141
|
+
writeFileSync(
|
|
142
|
+
join(base, ".gsd", "REQUIREMENTS.md"),
|
|
143
|
+
[
|
|
144
|
+
"# Requirements",
|
|
145
|
+
"",
|
|
146
|
+
"## Active",
|
|
147
|
+
"### R999 - Projection-only requirement",
|
|
148
|
+
"- Class: functional",
|
|
149
|
+
"- Status: active",
|
|
150
|
+
"",
|
|
151
|
+
].join("\n"),
|
|
152
|
+
);
|
|
153
|
+
|
|
154
|
+
openProjectDb(base);
|
|
155
|
+
insertMilestone({ id: "M999", title: "DB Milestone", status: "active" });
|
|
156
|
+
insertRequirement(activeRequirement("R001"));
|
|
157
|
+
|
|
158
|
+
invalidateStateCache();
|
|
159
|
+
const state = await deriveStateFromDb(base);
|
|
160
|
+
|
|
161
|
+
assert.ok(state.requirements);
|
|
162
|
+
assert.equal(state.requirements.active, 1);
|
|
163
|
+
assert.equal(state.requirements.total, 1);
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
test("explicit markdown import remains opt-in and is not run by startup mismatch check", async (t) => {
|
|
167
|
+
const base = makeBase();
|
|
168
|
+
t.after(() => cleanup(base));
|
|
169
|
+
|
|
170
|
+
const milestoneDir = join(base, ".gsd", "milestones", "M001");
|
|
171
|
+
const sliceDir = join(milestoneDir, "slices", "S01");
|
|
172
|
+
const tasksDir = join(sliceDir, "tasks");
|
|
173
|
+
mkdirSync(tasksDir, { recursive: true });
|
|
174
|
+
writeFileSync(
|
|
175
|
+
join(milestoneDir, "M001-ROADMAP.md"),
|
|
176
|
+
[
|
|
177
|
+
"# M001: Imported Explicitly",
|
|
178
|
+
"",
|
|
179
|
+
"**Vision:** Explicit recovery import only",
|
|
180
|
+
"",
|
|
181
|
+
"## Slices",
|
|
182
|
+
"- [ ] **S01: Slice** `risk:low` `depends:[]`",
|
|
183
|
+
"",
|
|
184
|
+
].join("\n"),
|
|
185
|
+
);
|
|
186
|
+
writeFileSync(
|
|
187
|
+
join(sliceDir, "S01-PLAN.md"),
|
|
188
|
+
[
|
|
189
|
+
"# S01: Slice",
|
|
190
|
+
"",
|
|
191
|
+
"**Goal:** prove explicit import",
|
|
192
|
+
"",
|
|
193
|
+
"## Tasks",
|
|
194
|
+
"- [ ] **T01: Task** `est:5m`",
|
|
195
|
+
"",
|
|
196
|
+
].join("\n"),
|
|
197
|
+
);
|
|
198
|
+
|
|
199
|
+
openProjectDb(base);
|
|
200
|
+
const check = await checkMarkdownHierarchyAgainstDb(base);
|
|
201
|
+
assert.equal(check.action, "recovery-required");
|
|
202
|
+
assert.equal(getAllMilestones().length, 0, "startup mismatch check must not import markdown");
|
|
203
|
+
|
|
204
|
+
const imported = migrateHierarchyToDb(base);
|
|
205
|
+
assert.deepEqual(imported, { milestones: 1, slices: 1, tasks: 1 });
|
|
206
|
+
assert.equal(getAllMilestones().length, 1);
|
|
207
|
+
assert.equal(getSliceTasks("M001", "S01").length, 1);
|
|
208
|
+
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import test from "node:test";
|
|
2
2
|
import assert from "node:assert/strict";
|
|
3
|
-
import { existsSync, mkdirSync, readFileSync, realpathSync, rmSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { chmodSync, existsSync, mkdirSync, readFileSync, realpathSync, rmSync, writeFileSync } from "node:fs";
|
|
4
4
|
import { execFileSync } from "node:child_process";
|
|
5
5
|
import { tmpdir } from "node:os";
|
|
6
6
|
import { join } from "node:path";
|
|
@@ -10,7 +10,7 @@ import { runDispatch, runPreDispatch } from "../auto/phases.ts";
|
|
|
10
10
|
import { AutoSession } from "../auto/session.ts";
|
|
11
11
|
import { resolveUnitSupervisionTimeouts } from "../auto-timers.ts";
|
|
12
12
|
import { bootstrapAutoSession } from "../auto-start.ts";
|
|
13
|
-
import { postUnitPreVerification } from "../auto-post-unit.ts";
|
|
13
|
+
import { postUnitPostVerification, postUnitPreVerification } from "../auto-post-unit.ts";
|
|
14
14
|
import { resolveDispatch, setResearchProjectPromptBuilderForTest } from "../auto-dispatch.ts";
|
|
15
15
|
import { resolveExpectedArtifactPath, verifyExpectedArtifact, writeBlockerPlaceholder } from "../auto-recovery.ts";
|
|
16
16
|
import { finalizeProjectResearchTimeout } from "../project-research-policy.ts";
|
|
@@ -272,6 +272,7 @@ test("deep project setup: bootstrap can start auto-mode without an active milest
|
|
|
272
272
|
{
|
|
273
273
|
shouldUseWorktreeIsolation: () => false,
|
|
274
274
|
registerSigtermHandler: () => {},
|
|
275
|
+
registerAutoWorkerForSession: () => {},
|
|
275
276
|
lockBase: () => base,
|
|
276
277
|
buildLifecycle: () => ({
|
|
277
278
|
adoptSessionRoot: (sessionBase: string, originalBase?: string) => {
|
|
@@ -386,6 +387,7 @@ test("deep project setup: bootstrap continues queued M002 without milestone cont
|
|
|
386
387
|
{
|
|
387
388
|
shouldUseWorktreeIsolation: () => false,
|
|
388
389
|
registerSigtermHandler: () => {},
|
|
390
|
+
registerAutoWorkerForSession: () => {},
|
|
389
391
|
lockBase: () => base,
|
|
390
392
|
buildLifecycle: () => ({
|
|
391
393
|
adoptSessionRoot: (sessionBase: string, originalBase?: string) => {
|
|
@@ -1587,6 +1589,61 @@ test("deep project setup: discuss-milestone question failure pauses instead of a
|
|
|
1587
1589
|
}
|
|
1588
1590
|
});
|
|
1589
1591
|
|
|
1592
|
+
test("verified task git closeout failure retries and continues auto-mode", async () => {
|
|
1593
|
+
const base = makeBase();
|
|
1594
|
+
try {
|
|
1595
|
+
execFileSync("git", ["init"], { cwd: base, stdio: "ignore" });
|
|
1596
|
+
execFileSync("git", ["config", "user.email", "test@example.com"], { cwd: base, stdio: "ignore" });
|
|
1597
|
+
execFileSync("git", ["config", "user.name", "Test User"], { cwd: base, stdio: "ignore" });
|
|
1598
|
+
const hookPath = join(base, ".git", "hooks", "pre-commit");
|
|
1599
|
+
writeFileSync(
|
|
1600
|
+
hookPath,
|
|
1601
|
+
[
|
|
1602
|
+
"#!/bin/sh",
|
|
1603
|
+
"count_file=.git/pre-commit-count",
|
|
1604
|
+
"count=0",
|
|
1605
|
+
"if [ -f \"$count_file\" ]; then count=$(cat \"$count_file\"); fi",
|
|
1606
|
+
"count=$((count + 1))",
|
|
1607
|
+
"printf \"%s\" \"$count\" > \"$count_file\"",
|
|
1608
|
+
"echo blocked by test hook >&2",
|
|
1609
|
+
"exit 1",
|
|
1610
|
+
].join("\n"),
|
|
1611
|
+
);
|
|
1612
|
+
chmodSync(hookPath, 0o755);
|
|
1613
|
+
writeFileSync(join(base, "work.txt"), "changed\n");
|
|
1614
|
+
|
|
1615
|
+
const s = new AutoSession();
|
|
1616
|
+
s.active = true;
|
|
1617
|
+
s.basePath = base;
|
|
1618
|
+
s.originalBasePath = base;
|
|
1619
|
+
s.currentUnit = { type: "execute-task", id: "M001/S01/T01", startedAt: Date.now() };
|
|
1620
|
+
|
|
1621
|
+
let pauseCalled = false;
|
|
1622
|
+
const notifications: Array<{ message: string; severity?: string }> = [];
|
|
1623
|
+
const result = await postUnitPostVerification({
|
|
1624
|
+
s,
|
|
1625
|
+
ctx: { ui: { notify: (message: string, severity?: string) => notifications.push({ message, severity }) } } as any,
|
|
1626
|
+
pi: {} as any,
|
|
1627
|
+
buildSnapshotOpts: () => ({}) as any,
|
|
1628
|
+
lockBase: () => base,
|
|
1629
|
+
stopAuto: async () => {},
|
|
1630
|
+
pauseAuto: async () => { pauseCalled = true; },
|
|
1631
|
+
updateProgressWidget: () => {},
|
|
1632
|
+
});
|
|
1633
|
+
|
|
1634
|
+
assert.equal(result, "continue");
|
|
1635
|
+
assert.equal(pauseCalled, false);
|
|
1636
|
+
assert.equal(s.lastGitActionStatus, "failed");
|
|
1637
|
+
assert.equal(readFileSync(join(base, ".git", "pre-commit-count"), "utf-8"), "3");
|
|
1638
|
+
assert.ok(
|
|
1639
|
+
notifications.some((entry) => entry.severity === "warning" && entry.message.includes("Git commit failed")),
|
|
1640
|
+
"verified task git closeout failure should warn instead of stopping auto-mode",
|
|
1641
|
+
);
|
|
1642
|
+
} finally {
|
|
1643
|
+
rmSync(base, { recursive: true, force: true });
|
|
1644
|
+
}
|
|
1645
|
+
});
|
|
1646
|
+
|
|
1590
1647
|
test("deep project setup: approval wait wins over deterministic write-gate placeholder", async () => {
|
|
1591
1648
|
const base = makeBase();
|
|
1592
1649
|
try {
|
|
@@ -118,3 +118,42 @@ describe("complete phase dispatch guard (#5683)", () => {
|
|
|
118
118
|
assert.equal(result?.reason, "All milestones complete.");
|
|
119
119
|
});
|
|
120
120
|
});
|
|
121
|
+
|
|
122
|
+
describe("complete milestone context recovery guard (#5831)", () => {
|
|
123
|
+
let base = "";
|
|
124
|
+
const executionEntryRule = DISPATCH_RULES.find(
|
|
125
|
+
(candidate) => candidate.name === "execution-entry phase (no context) → discuss-milestone",
|
|
126
|
+
);
|
|
127
|
+
const prePlanningRule = DISPATCH_RULES.find(
|
|
128
|
+
(candidate) => candidate.name === "pre-planning (no context) → discuss-milestone",
|
|
129
|
+
);
|
|
130
|
+
assert.ok(executionEntryRule, "execution-entry missing-context rule should exist");
|
|
131
|
+
assert.ok(prePlanningRule, "pre-planning missing-context rule should exist");
|
|
132
|
+
|
|
133
|
+
afterEach(() => {
|
|
134
|
+
if (base) rmSync(base, { recursive: true, force: true });
|
|
135
|
+
base = "";
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
test("does not discuss a complete execution-entry milestone with no CONTEXT file", async () => {
|
|
139
|
+
base = makeBase();
|
|
140
|
+
const ctx = buildDispatchCtx(base);
|
|
141
|
+
ctx.state.registry = [{ id: "M001", title: "Milestone One", status: "complete" }];
|
|
142
|
+
ctx.state.phase = "completing-milestone";
|
|
143
|
+
|
|
144
|
+
const result = await executionEntryRule.match(ctx);
|
|
145
|
+
|
|
146
|
+
assert.equal(result, null);
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
test("does not discuss a complete pre-planning milestone with no CONTEXT file", async () => {
|
|
150
|
+
base = makeBase();
|
|
151
|
+
const ctx = buildDispatchCtx(base);
|
|
152
|
+
ctx.state.registry = [{ id: "M001", title: "Milestone One", status: "complete" }];
|
|
153
|
+
ctx.state.phase = "pre-planning";
|
|
154
|
+
|
|
155
|
+
const result = await prePlanningRule.match(ctx);
|
|
156
|
+
|
|
157
|
+
assert.equal(result, null);
|
|
158
|
+
});
|
|
159
|
+
});
|
|
@@ -47,6 +47,33 @@ test("dispatch guard blocks when prior milestone has incomplete slices", (t) =>
|
|
|
47
47
|
);
|
|
48
48
|
});
|
|
49
49
|
|
|
50
|
+
test("dispatch guard skips prior DB parked or deferred milestones without marker files", (t) => {
|
|
51
|
+
const repo = setupRepo();
|
|
52
|
+
t.after(() => teardownRepo(repo));
|
|
53
|
+
|
|
54
|
+
mkdirSync(join(repo, ".gsd", "milestones", "M001"), { recursive: true });
|
|
55
|
+
mkdirSync(join(repo, ".gsd", "milestones", "M002"), { recursive: true });
|
|
56
|
+
mkdirSync(join(repo, ".gsd", "milestones", "M003"), { recursive: true });
|
|
57
|
+
|
|
58
|
+
insertMilestone({ id: "M001", title: "Parked", status: "parked" });
|
|
59
|
+
insertSlice({ id: "S01", milestoneId: "M001", title: "Incomplete", status: "pending", depends: [], sequence: 1 });
|
|
60
|
+
|
|
61
|
+
insertMilestone({ id: "M002", title: "Deferred", status: "deferred" });
|
|
62
|
+
insertSlice({ id: "S01", milestoneId: "M002", title: "Incomplete", status: "pending", depends: [], sequence: 1 });
|
|
63
|
+
|
|
64
|
+
insertMilestone({ id: "M003", title: "Current", status: "active" });
|
|
65
|
+
insertSlice({ id: "S01", milestoneId: "M003", title: "First", status: "pending", depends: [], sequence: 1 });
|
|
66
|
+
|
|
67
|
+
writeFileSync(join(repo, ".gsd", "milestones", "M001", "M001-ROADMAP.md"), "# M001\n");
|
|
68
|
+
writeFileSync(join(repo, ".gsd", "milestones", "M002", "M002-ROADMAP.md"), "# M002\n");
|
|
69
|
+
writeFileSync(join(repo, ".gsd", "milestones", "M003", "M003-ROADMAP.md"), "# M003\n");
|
|
70
|
+
|
|
71
|
+
assert.equal(
|
|
72
|
+
getPriorSliceCompletionBlocker(repo, "main", "plan-slice", "M003/S01"),
|
|
73
|
+
null,
|
|
74
|
+
);
|
|
75
|
+
});
|
|
76
|
+
|
|
50
77
|
test("dispatch guard blocks later slice in same milestone when earlier incomplete", (t) => {
|
|
51
78
|
const repo = setupRepo();
|
|
52
79
|
t.after(() => teardownRepo(repo));
|
|
@@ -141,6 +141,14 @@ test("Feature 1: executive summary paragraph is rendered", () => {
|
|
|
141
141
|
assert.ok(html.includes("$2.50 spent"), "should contain cost");
|
|
142
142
|
});
|
|
143
143
|
|
|
144
|
+
test("report uses the shared GSD HTML shell", () => {
|
|
145
|
+
const html = generateHtmlReport(mockData(), mockOpts());
|
|
146
|
+
assert.ok(html.includes('<span class="logo">GSD</span>'), "should render shared shell logo");
|
|
147
|
+
assert.ok(html.includes('<span class="kind-chip">Report</span>'), "should render report kind chip");
|
|
148
|
+
assert.ok(html.includes('<nav class="toc" aria-label="Report sections">'), "should render shared shell TOC");
|
|
149
|
+
assert.ok(html.includes('<main>'), "should render content inside shared shell main");
|
|
150
|
+
});
|
|
151
|
+
|
|
144
152
|
test("Feature 1: executive summary includes budget context when set", () => {
|
|
145
153
|
const data = mockData({ health: { ...mockData().health, budgetCeiling: 10.00 } });
|
|
146
154
|
const html = generateHtmlReport(data, mockOpts());
|
|
@@ -34,6 +34,8 @@ test("guided project prompt renders compact interview and artifact guidance", as
|
|
|
34
34
|
assert.match(prompt, /depth_verification_project_confirm/);
|
|
35
35
|
assert.match(prompt, /artifact_type: "PROJECT"/);
|
|
36
36
|
assert.match(prompt, /omit `milestone_id`/);
|
|
37
|
+
assert.match(prompt, /do not write the projection directly/i);
|
|
38
|
+
assert.doesNotMatch(prompt, /then write `.gsd\/PROJECT\.md`/);
|
|
37
39
|
assert.match(prompt, /Do NOT use `artifact_type: "CONTEXT"` and do NOT pass `milestone_id: "PROJECT"`/);
|
|
38
40
|
assert.match(prompt, /\*\*Complexity:\*\* simple/);
|
|
39
41
|
assert.match(prompt, /\*\*Complexity:\*\* complex/);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import test from "node:test";
|
|
2
|
+
import assert from "node:assert/strict";
|
|
3
|
+
import { readFileSync } from "node:fs";
|
|
4
|
+
import { dirname, join } from "node:path";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
6
|
+
|
|
7
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
8
|
+
|
|
9
|
+
test("guided milestone discussion callsites pass workingDirectory to loadPrompt", () => {
|
|
10
|
+
const source = readFileSync(join(__dirname, "..", "guided-flow.ts"), "utf-8");
|
|
11
|
+
const calls = [...source.matchAll(/loadPrompt\("guided-discuss-milestone",\s*\{([\s\S]*?)\}\)/g)];
|
|
12
|
+
|
|
13
|
+
assert.equal(calls.length, 6, "all guided-flow guided-discuss-milestone callsites should be covered");
|
|
14
|
+
for (const call of calls) {
|
|
15
|
+
assert.match(
|
|
16
|
+
call[1] ?? "",
|
|
17
|
+
/\bworkingDirectory:\s*basePath\b/,
|
|
18
|
+
"guided-discuss-milestone prompts need workingDirectory so template validation does not crash",
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
});
|
|
@@ -65,15 +65,15 @@ describe("headless milestone bootstrap — parity with interactive flow", () =>
|
|
|
65
65
|
/### Ready-phrase pre-condition \(NON-BYPASSABLE\)/.test(section),
|
|
66
66
|
"single-milestone ready-phrase section must be present",
|
|
67
67
|
);
|
|
68
|
-
// All four required
|
|
68
|
+
// All four required outcomes must appear as checkboxes, not a prose list.
|
|
69
69
|
for (const artifact of [
|
|
70
|
-
"
|
|
71
|
-
"
|
|
70
|
+
"PROJECT artifact",
|
|
71
|
+
"REQUIREMENTS artifact",
|
|
72
72
|
"`{{contextPath}}`",
|
|
73
73
|
"`gsd_plan_milestone`",
|
|
74
74
|
]) {
|
|
75
75
|
assert.ok(
|
|
76
|
-
new RegExp(`- \\[ \\] [
|
|
76
|
+
new RegExp(`- \\[ \\] [^\\n]*${artifact.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}`).test(section),
|
|
77
77
|
`single-milestone pre-condition must include a checkbox for ${artifact}`,
|
|
78
78
|
);
|
|
79
79
|
}
|
|
@@ -103,8 +103,8 @@ describe("headless milestone bootstrap — parity with interactive flow", () =>
|
|
|
103
103
|
"multi-milestone ready-phrase section must be present",
|
|
104
104
|
);
|
|
105
105
|
for (const artifact of [
|
|
106
|
-
"
|
|
107
|
-
"
|
|
106
|
+
"PROJECT artifact",
|
|
107
|
+
"REQUIREMENTS artifact",
|
|
108
108
|
"`gsd_plan_milestone`",
|
|
109
109
|
"`.gsd/DISCUSSION-MANIFEST.json`",
|
|
110
110
|
]) {
|
|
@@ -92,6 +92,11 @@ test("resolveModelId: returns undefined for unknown model", () => {
|
|
|
92
92
|
assert.equal(match, undefined);
|
|
93
93
|
});
|
|
94
94
|
|
|
95
|
+
test("resolveModelId: returns undefined for missing model ID", () => {
|
|
96
|
+
const match = resolveModelId(undefined, AVAILABLE_MODELS, "anthropic");
|
|
97
|
+
assert.equal(match, undefined);
|
|
98
|
+
});
|
|
99
|
+
|
|
95
100
|
test("resolveModelId: returns undefined for unknown provider/model combo", () => {
|
|
96
101
|
const match = resolveModelId("fakeprovider/fake-model", AVAILABLE_MODELS, undefined);
|
|
97
102
|
assert.equal(match, undefined);
|
|
@@ -9,11 +9,11 @@ import { isInfrastructureError, INFRA_ERROR_CODES } from "../auto/infra-errors.j
|
|
|
9
9
|
test("INFRA_ERROR_CODES contains the expected codes", () => {
|
|
10
10
|
for (const code of [
|
|
11
11
|
"ENOSPC", "ENOMEM", "EROFS", "EDQUOT", "EMFILE", "ENFILE",
|
|
12
|
-
"EAGAIN", "ECONNREFUSED", "ENOTFOUND", "ENETUNREACH",
|
|
12
|
+
"EAGAIN", "ENOBUFS", "ECONNREFUSED", "ENOTFOUND", "ENETUNREACH",
|
|
13
13
|
]) {
|
|
14
14
|
assert.ok(INFRA_ERROR_CODES.has(code), `missing ${code}`);
|
|
15
15
|
}
|
|
16
|
-
assert.equal(INFRA_ERROR_CODES.size,
|
|
16
|
+
assert.equal(INFRA_ERROR_CODES.size, 11, "unexpected extra codes");
|
|
17
17
|
});
|
|
18
18
|
|
|
19
19
|
// ── isInfrastructureError: code property detection ───────────────────────────
|
|
@@ -5,6 +5,8 @@ import test, { describe } from "node:test";
|
|
|
5
5
|
import assert from "node:assert/strict";
|
|
6
6
|
|
|
7
7
|
import {
|
|
8
|
+
INFRA_ERROR_CODES,
|
|
9
|
+
isInfrastructureError,
|
|
8
10
|
isTransientCooldownError,
|
|
9
11
|
getCooldownRetryAfterMs,
|
|
10
12
|
MAX_COOLDOWN_RETRIES,
|
|
@@ -13,6 +15,13 @@ import {
|
|
|
13
15
|
|
|
14
16
|
// ─── Constants ────────────────────────────────────────────────────────────────
|
|
15
17
|
|
|
18
|
+
describe("infra error classification", () => {
|
|
19
|
+
test("ENOBUFS is treated as infrastructure exhaustion", () => {
|
|
20
|
+
assert.equal(INFRA_ERROR_CODES.has("ENOBUFS"), true);
|
|
21
|
+
assert.equal(isInfrastructureError(Object.assign(new Error("spawnSync git ENOBUFS"), { code: "ENOBUFS" })), "ENOBUFS");
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
|
|
16
25
|
describe("infra-errors cooldown constants", () => {
|
|
17
26
|
test("COOLDOWN_FALLBACK_WAIT_MS is a positive number greater than the 30s rate-limit backoff", () => {
|
|
18
27
|
assert.ok(typeof COOLDOWN_FALLBACK_WAIT_MS === "number");
|
|
@@ -446,6 +446,26 @@ node_modules/
|
|
|
446
446
|
const strandedIssues = detect.issues.filter(i => i.code === "stranded_lock_directory");
|
|
447
447
|
assert.deepStrictEqual(strandedIssues.length, 0, "live lock holder: stranded_lock_directory NOT detected");
|
|
448
448
|
});
|
|
449
|
+
|
|
450
|
+
test('stranded_lock_directory still reports when worker lookup fails', async () => {
|
|
451
|
+
const dir = createMinimalProject();
|
|
452
|
+
cleanups.push(dir);
|
|
453
|
+
|
|
454
|
+
const lockDir = join(dir, ".gsd.lock");
|
|
455
|
+
mkdirSync(lockDir, { recursive: true });
|
|
456
|
+
const { openDatabase, _getAdapter, closeDatabase } = await import("../../gsd-db.ts");
|
|
457
|
+
openDatabase(join(dir, ".gsd", "gsd.db"));
|
|
458
|
+
const db = _getAdapter()!;
|
|
459
|
+
db.exec("DROP TABLE workers");
|
|
460
|
+
|
|
461
|
+
try {
|
|
462
|
+
const detect = await runGSDDoctor(dir);
|
|
463
|
+
const strandedIssues = detect.issues.filter(i => i.code === "stranded_lock_directory");
|
|
464
|
+
assert.ok(strandedIssues.length > 0, "reports stranded lock directory even when active worker lookup fails");
|
|
465
|
+
} finally {
|
|
466
|
+
closeDatabase();
|
|
467
|
+
}
|
|
468
|
+
});
|
|
449
469
|
} else {
|
|
450
470
|
}
|
|
451
471
|
|
|
@@ -5,7 +5,7 @@ import assert from 'node:assert/strict';
|
|
|
5
5
|
import { mkdtempSync, mkdirSync, writeFileSync, rmSync, existsSync, symlinkSync, readFileSync } from "node:fs";
|
|
6
6
|
import { join, dirname } from "node:path";
|
|
7
7
|
import { tmpdir } from "node:os";
|
|
8
|
-
import { execSync } from "node:child_process";
|
|
8
|
+
import { execFileSync, execSync } from "node:child_process";
|
|
9
9
|
|
|
10
10
|
import {
|
|
11
11
|
inferCommitType,
|
|
@@ -371,6 +371,18 @@ describe('git-service', async () => {
|
|
|
371
371
|
return dir;
|
|
372
372
|
}
|
|
373
373
|
|
|
374
|
+
function gitRun(args: string[], cwd: string): string {
|
|
375
|
+
return execFileSync("git", args, {
|
|
376
|
+
cwd,
|
|
377
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
378
|
+
encoding: "utf-8",
|
|
379
|
+
env: {
|
|
380
|
+
...process.env,
|
|
381
|
+
GIT_ALLOW_PROTOCOL: "file",
|
|
382
|
+
},
|
|
383
|
+
}).trim();
|
|
384
|
+
}
|
|
385
|
+
|
|
374
386
|
// ─── GitServiceImpl: smart staging ─────────────────────────────────────
|
|
375
387
|
|
|
376
388
|
test('GitServiceImpl: smart staging', () => {
|
|
@@ -413,6 +425,96 @@ describe('git-service', async () => {
|
|
|
413
425
|
rmSync(repo, { recursive: true, force: true });
|
|
414
426
|
});
|
|
415
427
|
|
|
428
|
+
test('GitServiceImpl: task autoCommit skips keyFiles inside submodules', () => {
|
|
429
|
+
const repo = initTempRepo();
|
|
430
|
+
const subSrc = mkdtempSync(join(tmpdir(), "gsd-git-submodule-src-"));
|
|
431
|
+
|
|
432
|
+
try {
|
|
433
|
+
gitRun(["init", "-b", "main"], subSrc);
|
|
434
|
+
gitRun(["config", "user.name", "Pi Test"], subSrc);
|
|
435
|
+
gitRun(["config", "user.email", "pi@example.com"], subSrc);
|
|
436
|
+
createFile(subSrc, "tracked.txt", "initial\n");
|
|
437
|
+
gitRun(["add", "-A"], subSrc);
|
|
438
|
+
gitRun(["commit", "-m", "init submodule"], subSrc);
|
|
439
|
+
|
|
440
|
+
gitRun(["-c", "protocol.file.allow=always", "submodule", "add", `file://${subSrc}`, "sub"], repo);
|
|
441
|
+
gitRun(["commit", "-m", "add submodule"], repo);
|
|
442
|
+
|
|
443
|
+
createFile(repo, "sub/copied.txt", "copied from source\n");
|
|
444
|
+
createFile(repo, "src/feature.ts", "export const feature = true;\n");
|
|
445
|
+
createFile(repo, "src/unrelated.ts", "export const unrelated = true;\n");
|
|
446
|
+
|
|
447
|
+
const svc = new GitServiceImpl(repo);
|
|
448
|
+
const taskContext: TaskCommitContext = {
|
|
449
|
+
taskId: "S01/T01",
|
|
450
|
+
taskDisplayId: "T01",
|
|
451
|
+
taskTitle: "fix submodule staging",
|
|
452
|
+
milestoneId: "M001",
|
|
453
|
+
milestoneTitle: "Submodule auto commit",
|
|
454
|
+
sliceId: "S01",
|
|
455
|
+
sliceTitle: "Commit scoped files",
|
|
456
|
+
oneLiner: "Fixed auto commit when key files include submodule paths",
|
|
457
|
+
keyFiles: ["sub/copied.txt", "src/feature.ts"],
|
|
458
|
+
};
|
|
459
|
+
|
|
460
|
+
const result = svc.autoCommit("execute-task", "M001/S01/T01", [], taskContext);
|
|
461
|
+
|
|
462
|
+
assert.ok(result !== null, "autoCommit should commit non-submodule changes");
|
|
463
|
+
const committed = gitRun(["show", "--name-only", "--format=", "HEAD"], repo);
|
|
464
|
+
assert.ok(committed.includes("src/feature.ts"), "non-submodule keyFile is committed");
|
|
465
|
+
assert.ok(!committed.includes("sub/copied.txt"), "submodule inner keyFile is not pathspec-staged");
|
|
466
|
+
assert.ok(!committed.includes("src/unrelated.ts"), "scoped staging does not fall back to smartStage");
|
|
467
|
+
} finally {
|
|
468
|
+
rmSync(repo, { recursive: true, force: true });
|
|
469
|
+
rmSync(subSrc, { recursive: true, force: true });
|
|
470
|
+
}
|
|
471
|
+
});
|
|
472
|
+
|
|
473
|
+
test('GitServiceImpl: all keyFiles inside submodules falls back to smartStage', () => {
|
|
474
|
+
const repo = initTempRepo();
|
|
475
|
+
const subSrc = mkdtempSync(join(tmpdir(), "gsd-git-all-submodule-src-"));
|
|
476
|
+
|
|
477
|
+
try {
|
|
478
|
+
gitRun(["init", "-b", "main"], subSrc);
|
|
479
|
+
gitRun(["config", "user.name", "Pi Test"], subSrc);
|
|
480
|
+
gitRun(["config", "user.email", "pi@example.com"], subSrc);
|
|
481
|
+
createFile(subSrc, "tracked.txt", "initial\n");
|
|
482
|
+
gitRun(["add", "-A"], subSrc);
|
|
483
|
+
gitRun(["commit", "-m", "init submodule"], subSrc);
|
|
484
|
+
|
|
485
|
+
gitRun(["-c", "protocol.file.allow=always", "submodule", "add", `file://${subSrc}`, "sub"], repo);
|
|
486
|
+
gitRun(["commit", "-m", "add submodule"], repo);
|
|
487
|
+
|
|
488
|
+
createFile(repo, "sub/file1.txt", "inside submodule\n");
|
|
489
|
+
createFile(repo, "sub/file2.txt", "also inside\n");
|
|
490
|
+
createFile(repo, "src/real.ts", "export const real = true;\n");
|
|
491
|
+
|
|
492
|
+
const svc = new GitServiceImpl(repo);
|
|
493
|
+
const taskContext: TaskCommitContext = {
|
|
494
|
+
taskId: "S01/T02",
|
|
495
|
+
taskDisplayId: "T02",
|
|
496
|
+
taskTitle: "all keyFiles inside submodule",
|
|
497
|
+
milestoneId: "M001",
|
|
498
|
+
milestoneTitle: "Submodule auto commit",
|
|
499
|
+
sliceId: "S01",
|
|
500
|
+
sliceTitle: "Commit scoped files",
|
|
501
|
+
oneLiner: "Fell back when all key files are inside submodules",
|
|
502
|
+
keyFiles: ["sub", "sub/file1.txt", "sub/file2.txt"],
|
|
503
|
+
};
|
|
504
|
+
|
|
505
|
+
const result = svc.autoCommit("execute-task", "M001/S01/T02", [], taskContext);
|
|
506
|
+
|
|
507
|
+
assert.ok(result !== null, "autoCommit falls back to smartStage when all keyFiles are filtered");
|
|
508
|
+
const committed = gitRun(["show", "--name-only", "--format=", "HEAD"], repo);
|
|
509
|
+
assert.ok(!committed.includes("sub/file1.txt"), "submodule keyFile is not committed");
|
|
510
|
+
assert.ok(!committed.includes("sub/file2.txt"), "submodule keyFile is not committed");
|
|
511
|
+
assert.ok(committed.includes("src/real.ts"), "smartStage fallback commits other dirty files");
|
|
512
|
+
} finally {
|
|
513
|
+
rmSync(repo, { recursive: true, force: true });
|
|
514
|
+
rmSync(subSrc, { recursive: true, force: true });
|
|
515
|
+
}
|
|
516
|
+
});
|
|
517
|
+
|
|
416
518
|
// ─── GitServiceImpl: smart staging excludes tracked runtime files ──────
|
|
417
519
|
|
|
418
520
|
test('GitServiceImpl: smart staging excludes tracked runtime files', () => {
|