pi-harness-runtime 1.1.440 → 1.1.441
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/harness/e2e/auto-test-loop.ts +2 -0
- package/harness/e2e/browser-scrapers/base-browser-scraper.ts +2 -0
- package/harness/e2e/browser-scrapers/chrome-profile-manager.ts +2 -0
- package/harness/e2e/browser-scrapers/codex-browser-scraper.ts +2 -0
- package/harness/e2e/tools-detector.ts +2 -0
- package/harness/key-loader.ts +2 -0
- package/harness/langchain/checkpointer.ts +2 -0
- package/harness/langchain/cron-cli.ts +2 -0
- package/harness/langchain/graph.ts +2 -0
- package/harness/notification-center.ts +2 -0
- package/harness/secret-provider.ts +2 -0
- package/index.ts +2 -0
- package/package.json +7 -1
- package/packages/a2a-adapter/package.json +1 -1
- package/packages/agent-policy/dist/extension.d.ts.map +1 -1
- package/packages/agent-policy/dist/extension.js +2 -0
- package/packages/agent-policy/dist/extension.js.map +1 -1
- package/packages/agent-policy/package.json +1 -1
- package/packages/agent-policy/src/extension.ts +2 -0
- package/packages/architecture-generator/package.json +1 -1
- package/packages/auth/dist/minimax-browser-auth.d.ts.map +1 -1
- package/packages/auth/dist/minimax-browser-auth.js +23 -1
- package/packages/auth/dist/minimax-browser-auth.js.map +1 -1
- package/packages/auth/package.json +1 -1
- package/packages/auth/src/minimax-browser-auth.ts +30 -5
- package/packages/autonomous-refactor/package.json +1 -1
- package/packages/autonomous-runtime/dist/inbox.d.ts.map +1 -1
- package/packages/autonomous-runtime/dist/inbox.js +2 -0
- package/packages/autonomous-runtime/dist/inbox.js.map +1 -1
- package/packages/autonomous-runtime/package.json +1 -1
- package/packages/autonomous-runtime/src/inbox.ts +2 -0
- package/packages/cache-strategy/package.json +1 -1
- package/packages/capability-registry/package.json +1 -1
- package/packages/checkpoint/package.json +1 -1
- package/packages/cli-plugin-sdk/package.json +1 -1
- package/packages/clipboard/dist/src/clipboard.d.ts.map +1 -1
- package/packages/clipboard/dist/src/clipboard.js +2 -0
- package/packages/clipboard/dist/src/clipboard.js.map +1 -1
- package/packages/clipboard/dist/src/copy-sync.d.ts.map +1 -1
- package/packages/clipboard/dist/src/copy-sync.js +2 -0
- package/packages/clipboard/dist/src/copy-sync.js.map +1 -1
- package/packages/clipboard/dist/src/gist-relay.d.ts.map +1 -1
- package/packages/clipboard/dist/src/gist-relay.js +2 -0
- package/packages/clipboard/dist/src/gist-relay.js.map +1 -1
- package/packages/clipboard/package.json +1 -1
- package/packages/clipboard/src/clipboard.ts +2 -0
- package/packages/clipboard/src/copy-sync.ts +2 -0
- package/packages/clipboard/src/gist-relay.ts +2 -0
- package/packages/clipboard-plugin/package.json +1 -1
- package/packages/code-generation/package.json +1 -1
- package/packages/code-review/package.json +1 -1
- package/packages/codex-adapter/package.json +1 -1
- package/packages/codex-watcher/package.json +1 -1
- package/packages/config-capture/package.json +1 -1
- package/packages/connection-runtime/package.json +1 -1
- package/packages/context-compiler/package.json +1 -1
- package/packages/context-discovery/package.json +1 -1
- package/packages/context-manager/package.json +1 -1
- package/packages/contracts/dist/delegation-store.js +1 -4
- package/packages/contracts/dist/workspace-env.js +28 -1
- package/packages/contracts/package.json +1 -1
- package/packages/contracts/src/delegation-store.ts +9 -4
- package/packages/contracts/src/workspace-env.ts +29 -4
- package/packages/cookie-sanitizer/package.json +1 -1
- package/packages/cost-optimizer/package.json +1 -1
- package/packages/dependency-analyzer/package.json +1 -1
- package/packages/django-plugin/package.json +1 -1
- package/packages/doc-generator/package.json +1 -1
- package/packages/durable-review/package.json +1 -1
- package/packages/e2e-tester/package.json +1 -1
- package/packages/evaluation-engine/package.json +1 -1
- package/packages/evaluation-runner/package.json +1 -1
- package/packages/event-bus/package.json +1 -1
- package/packages/event-sink/package.json +1 -1
- package/packages/event-store/dist/src/store.d.ts.map +1 -1
- package/packages/event-store/dist/src/store.js +2 -0
- package/packages/event-store/dist/src/store.js.map +1 -1
- package/packages/event-store/package.json +1 -1
- package/packages/event-store/src/store.ts +3 -0
- package/packages/experience-replay/package.json +1 -1
- package/packages/feedback-collector/package.json +1 -1
- package/packages/file-copy-helper/package.json +1 -1
- package/packages/framework-detector/package.json +1 -1
- package/packages/framework-plugin-sdk/package.json +1 -1
- package/packages/frappe-plugin/package.json +1 -1
- package/packages/generic-web-plugin/dist/analyzer.d.ts.map +1 -1
- package/packages/generic-web-plugin/dist/analyzer.js +2 -0
- package/packages/generic-web-plugin/dist/analyzer.js.map +1 -1
- package/packages/generic-web-plugin/package.json +1 -1
- package/packages/generic-web-plugin/src/analyzer.ts +3 -0
- package/packages/health-monitor/package.json +1 -1
- package/packages/intent-analyzer/package.json +1 -1
- package/packages/jev-judge/package.json +1 -1
- package/packages/knowledge-graph/package.json +1 -1
- package/packages/knowledge-retrieval/dist/mcp-client.d.ts.map +1 -1
- package/packages/knowledge-retrieval/dist/mcp-client.js +0 -1
- package/packages/knowledge-retrieval/dist/mcp-client.js.map +1 -1
- package/packages/knowledge-retrieval/package.json +1 -4
- package/packages/knowledge-retrieval/src/mcp-client.ts +0 -1
- package/packages/laravel-plugin/package.json +1 -1
- package/packages/learning-engine/package.json +1 -1
- package/packages/logging/package.json +1 -1
- package/packages/mcp-adapter/dist/server.d.ts.map +1 -1
- package/packages/mcp-adapter/dist/server.js +2 -0
- package/packages/mcp-adapter/dist/server.js.map +1 -1
- package/packages/mcp-adapter/package.json +1 -1
- package/packages/mcp-adapter/src/server.ts +3 -0
- package/packages/memory-engine/package.json +1 -1
- package/packages/milestone-manager/package.json +1 -1
- package/packages/model-registry/package.json +1 -1
- package/packages/nextjs-plugin/package.json +1 -1
- package/packages/notification/package.json +1 -1
- package/packages/observability/package.json +1 -1
- package/packages/okf-indexer/package.json +1 -1
- package/packages/paperclip-integration/dist/index.d.ts.map +1 -1
- package/packages/paperclip-integration/dist/index.js +2 -0
- package/packages/paperclip-integration/dist/index.js.map +1 -1
- package/packages/paperclip-integration/package.json +1 -1
- package/packages/paperclip-integration/src/index.ts +2 -0
- package/packages/performance-optimizer/package.json +1 -1
- package/packages/permission-mode/package.json +1 -1
- package/packages/privilege-broker/dist/audit.d.ts.map +1 -1
- package/packages/privilege-broker/dist/audit.js +2 -0
- package/packages/privilege-broker/dist/audit.js.map +1 -1
- package/packages/privilege-broker/package.json +1 -1
- package/packages/privilege-broker/src/audit.ts +2 -0
- package/packages/project-analyzer/package.json +1 -1
- package/packages/project-bootstrap/package.json +1 -1
- package/packages/projection-engine/package.json +1 -1
- package/packages/prompt-compiler/dist/compiler.d.ts.map +1 -1
- package/packages/prompt-compiler/dist/compiler.js +2 -0
- package/packages/prompt-compiler/dist/compiler.js.map +1 -1
- package/packages/prompt-compiler/package.json +1 -1
- package/packages/prompt-compiler/src/compiler.ts +2 -0
- package/packages/prompt-versioning/package.json +1 -1
- package/packages/provider-adapter-sdk/package.json +1 -1
- package/packages/provider-router/package.json +1 -1
- package/packages/provider-selector/package.json +1 -1
- package/packages/providers/package.json +1 -1
- package/packages/qdrant-skills/package.json +1 -1
- package/packages/quota-manager/package.json +1 -1
- package/packages/rate-limiter/package.json +1 -1
- package/packages/react-vite-plugin/package.json +1 -1
- package/packages/relay/package.json +1 -1
- package/packages/release-manager/package.json +1 -1
- package/packages/requirement-compiler/package.json +1 -1
- package/packages/runtime/package.json +1 -1
- package/packages/scheduler/package.json +1 -1
- package/packages/scheduler-adapter/package.json +1 -1
- package/packages/session/package.json +1 -1
- package/packages/session-api/package.json +1 -1
- package/packages/session-export/package.json +1 -1
- package/packages/shared-context/package.json +1 -1
- package/packages/skill-mcp-client/dist/client.d.ts.map +1 -1
- package/packages/skill-mcp-client/dist/client.js +0 -1
- package/packages/skill-mcp-client/dist/client.js.map +1 -1
- package/packages/skill-mcp-client/package.json +1 -4
- package/packages/skill-mcp-client/src/client.ts +0 -1
- package/packages/skill-registry/package.json +1 -1
- package/packages/skills/dist/parser.d.ts.map +1 -1
- package/packages/skills/dist/parser.js +2 -0
- package/packages/skills/dist/parser.js.map +1 -1
- package/packages/skills/dist/skill-versioning.d.ts.map +1 -1
- package/packages/skills/dist/skill-versioning.js +2 -0
- package/packages/skills/dist/skill-versioning.js.map +1 -1
- package/packages/skills/package.json +1 -1
- package/packages/skills/src/parser.ts +3 -0
- package/packages/skills/src/skill-versioning.ts +2 -0
- package/packages/sprint-planner/package.json +1 -1
- package/packages/subscription-engine/package.json +1 -1
- package/packages/task-compiler/package.json +1 -1
- package/packages/tencentdb-memory/package.json +1 -1
- package/packages/tencentdb-sync/package.json +1 -1
- package/packages/test-data-generator/package.json +1 -1
- package/packages/test-generator/package.json +1 -1
- package/packages/todo-bd-sync/package.json +1 -1
- package/packages/token-estimation/package.json +1 -1
- package/packages/token-optimizer/package.json +1 -1
- package/packages/tooling-preference/package.json +1 -1
- package/packages/trajectory/package.json +1 -1
- package/packages/tui/package.json +1 -1
- package/packages/two-phase-review/package.json +1 -1
- package/packages/types/package.json +1 -1
- package/packages/voice-api/package.json +1 -1
- package/packages/webmcp-tester/dist/index.js +0 -2
- package/packages/webmcp-tester/package.json +1 -1
- package/packages/webmcp-tester/src/index.ts +0 -3
- package/packages/wiki/package.json +1 -1
- package/packages/workflow-events/package.json +1 -1
- package/packages/workspace-scanner/package.json +1 -1
- package/packages/worktree/package.json +1 -1
- package/packages/write-review/dist/trigger.d.ts.map +1 -1
- package/packages/write-review/dist/trigger.js +1 -2
- package/packages/write-review/dist/trigger.js.map +1 -1
- package/packages/write-review/package.json +1 -1
- package/packages/write-review/src/trigger.ts +1 -2
- package/scripts/lib/runtime-imports.ts +189 -3
- package/scripts/telegram-webhook-server.ts +2 -0
- package/scripts/verify-package-contents.ts +148 -1
- package/harness/e2e/tools-detector.test.ts +0 -155
- package/harness/glm-quota-countdown.test.ts +0 -323
- package/harness/langchain/agents.test.ts +0 -39
- package/harness/langchain/checkpointer.test.ts +0 -243
- package/harness/langchain/daemon.test.ts +0 -459
- package/harness/langchain/model-router.test.ts +0 -191
- package/harness/langchain/ping-pong-middleware.test.ts +0 -69
- package/harness/langchain/scoreboard.test.ts +0 -267
- package/harness/langchain/status-line.test.ts +0 -106
- package/harness/langchain/surge.test.ts +0 -467
- package/harness/langchain/widget.test.ts +0 -251
- package/harness/skill-sync.test.ts +0 -57
- package/harness/ssh-detach-interceptor.test.ts +0 -263
- package/harness/ssh-hang-recovery.test.ts +0 -86
- package/packages/a2a-adapter/test/a2a.test.ts +0 -151
- package/packages/agent-policy/test/interlock.test.ts +0 -101
- package/packages/agent-policy/test/policy-retention.test.ts +0 -380
- package/packages/agent-policy/test/policy.test.ts +0 -387
- package/packages/auth/test/auth.test.ts +0 -238
- package/packages/autonomous-refactor/test/refactor.test.ts +0 -202
- package/packages/autonomous-runtime/test/types.test.ts +0 -95
- package/packages/cache-strategy/test/cache.test.ts +0 -137
- package/packages/capability-registry/test/registry.test.ts +0 -204
- package/packages/checkpoint/test/engine.test.ts +0 -265
- package/packages/cli-plugin-sdk/test/cli.test.ts +0 -45
- package/packages/code-generation/test/generator.test.ts +0 -238
- package/packages/code-review/test/engine.test.ts +0 -302
- package/packages/codex-adapter/test/provider.test.ts +0 -142
- package/packages/codex-watcher/test/watch.test.ts +0 -453
- package/packages/context-compiler/test/context-compiler.test.ts +0 -746
- package/packages/context-manager/test/context.test.ts +0 -198
- package/packages/contracts/test/delegation.test.ts +0 -350
- package/packages/contracts/test/workspace-env.test.ts +0 -802
- package/packages/cookie-sanitizer/test/infer.test.ts +0 -110
- package/packages/cookie-sanitizer/test/normalize.test.ts +0 -113
- package/packages/cookie-sanitizer/test/parse.test.ts +0 -204
- package/packages/cookie-sanitizer/test/sync.test.ts +0 -237
- package/packages/cookie-sanitizer/test/watcher.test.ts +0 -27
- package/packages/cost-optimizer/test/cost-optimizer.test.ts +0 -438
- package/packages/dependency-analyzer/test/analyzer.test.ts +0 -49
- package/packages/django-plugin/test/analyzer.test.ts +0 -195
- package/packages/doc-generator/test/docs.test.ts +0 -168
- package/packages/durable-review/test/acceptance.test.ts +0 -357
- package/packages/durable-review/test/smoke.test.ts +0 -107
- package/packages/evaluation-engine/test/engine.test.ts +0 -277
- package/packages/evaluation-runner/test/runner.test.ts +0 -168
- package/packages/event-bus/test/bus.test.ts +0 -100
- package/packages/event-store/test/store.test.ts +0 -115
- package/packages/experience-replay/test/replay.test.ts +0 -267
- package/packages/feedback-collector/test/collector.test.ts +0 -142
- package/packages/framework-detector/test/detector.test.ts +0 -75
- package/packages/framework-plugin-sdk/test/manager.test.ts +0 -320
- package/packages/frappe-plugin/test/analyzer.test.ts +0 -250
- package/packages/generic-web-plugin/test/analyzer.test.ts +0 -134
- package/packages/health-monitor/test/health.test.ts +0 -231
- package/packages/intent-analyzer/test/analyzer.test.ts +0 -72
- package/packages/intent-analyzer/test/ping-pong.test.ts +0 -96
- package/packages/jev-judge/tests/auto-continue-context.test.ts +0 -280
- package/packages/jev-judge/tests/continuation-controller.test.ts +0 -1396
- package/packages/jev-judge/tests/jev-provider-chain.test.ts +0 -536
- package/packages/jev-judge/tests/outcome-application.test.ts +0 -132
- package/packages/jev-judge/tests/question-risk.test.ts +0 -129
- package/packages/jev-judge/tests/typesafe-provider.test.ts +0 -640
- package/packages/jev-judge/tests/validation-ledger.test.ts +0 -181
- package/packages/jev-judge/tests/validation-plan.test.ts +0 -170
- package/packages/jev-judge/tests/validation-tie-breaker.test.ts +0 -88
- package/packages/laravel-plugin/test/analyzer.test.ts +0 -220
- package/packages/learning-engine/test/engine.test.ts +0 -331
- package/packages/logging/test/buffer.test.ts +0 -44
- package/packages/logging/test/classification.test.ts +0 -137
- package/packages/logging/test/config.test.ts +0 -97
- package/packages/logging/test/fanout.test.ts +0 -186
- package/packages/logging/test/identity-transport.test.ts +0 -197
- package/packages/logging/test/incidents.test.ts +0 -404
- package/packages/logging/test/ingest-schema.test.ts +0 -184
- package/packages/logging/test/integration.test.ts +0 -140
- package/packages/logging/test/log-http.test.ts +0 -246
- package/packages/logging/test/redact.test.ts +0 -109
- package/packages/logging/test/sampler.test.ts +0 -57
- package/packages/logging/test/server.test.ts +0 -444
- package/packages/logging/test/shipper.test.ts +0 -152
- package/packages/logging/test/spool.test.ts +0 -96
- package/packages/mcp-adapter/test/server.test.ts +0 -91
- package/packages/memory-engine/test/engine.test.ts +0 -456
- package/packages/model-registry/test/registry.test.ts +0 -342
- package/packages/nextjs-plugin/test/analyzer.test.ts +0 -149
- package/packages/notification/test/approval-payload.test.ts +0 -269
- package/packages/notification/test/detail-format.test.ts +0 -106
- package/packages/notification/test/notification.test.ts +0 -375
- package/packages/notification/test/pending-question-lifecycle.test.ts +0 -195
- package/packages/notification/test/pending-question.test.ts +0 -331
- package/packages/notification/test/tooling-proposal-payload.test.ts +0 -212
- package/packages/observability/test/observability.test.ts +0 -1350
- package/packages/performance-optimizer/test/optimizer.test.ts +0 -267
- package/packages/project-analyzer/test/index.test.ts +0 -1719
- package/packages/prompt-compiler/test/prompt-compiler.test.ts +0 -813
- package/packages/prompt-versioning/test/versioning.test.ts +0 -112
- package/packages/provider-adapter-sdk/test/sdk.test.ts +0 -220
- package/packages/provider-router/test/provider-router.test.ts +0 -405
- package/packages/provider-selector/test/selector.test.ts +0 -192
- package/packages/providers/test/providers.test.ts +0 -225
- package/packages/qdrant-skills/test/collection-info.test.ts +0 -165
- package/packages/qdrant-skills/test/embedder-batch.test.ts +0 -184
- package/packages/qdrant-skills/test/embedder.test.ts +0 -97
- package/packages/quota-manager/test/quota.test.ts +0 -432
- package/packages/rate-limiter/test/limiter.test.ts +0 -128
- package/packages/react-vite-plugin/test/analyzer.test.ts +0 -139
- package/packages/relay/test/client.test.ts +0 -446
- package/packages/relay/test/relay-e2e.test.ts +0 -299
- package/packages/relay/test/relay-endpoint.test.ts +0 -278
- package/packages/release-manager/test/release.test.ts +0 -215
- package/packages/requirement-compiler/test/requirement-compiler.test.ts +0 -743
- package/packages/runtime/test/runtime-api.test.ts +0 -169
- package/packages/runtime/test/runtime.test.ts +0 -297
- package/packages/scheduler/test/scheduler.test.ts +0 -125
- package/packages/session/test/manager.test.ts +0 -233
- package/packages/shared-context/test/shared-context.test.ts +0 -114
- package/packages/skill-registry/test/registry.test.ts +0 -508
- package/packages/skills/test/init-skills.test.ts +0 -114
- package/packages/skills/test/remote-skills.test.ts +0 -360
- package/packages/skills/test/remote-source.test.ts +0 -248
- package/packages/skills/test/sanitize.test.ts +0 -250
- package/packages/skills/test/vector-indexing.test.ts +0 -205
- package/packages/skills/test/vector-schema.test.ts +0 -180
- package/packages/skills/test/vector-threshold.test.ts +0 -108
- package/packages/sprint-planner/test/planner.test.ts +0 -187
- package/packages/task-compiler/test/task-compiler.test.ts +0 -628
- package/packages/test-data-generator/test/generator.test.ts +0 -265
- package/packages/test-generator/test/generator.test.ts +0 -156
- package/packages/token-estimation/test/token-estimation.test.ts +0 -207
- package/packages/token-optimizer/test/optimizer.test.ts +0 -141
- package/packages/tooling-preference/tests/changed-files.test.ts +0 -124
- package/packages/tooling-preference/tests/detect.test.ts +0 -188
- package/packages/tooling-preference/tests/proposal.test.ts +0 -107
- package/packages/tooling-preference/tests/quality-check.test.ts +0 -272
- package/packages/tooling-preference/tests/registry.test.ts +0 -51
- package/packages/tooling-preference/tests/store.test.ts +0 -99
- package/packages/trajectory/test/store.test.ts +0 -250
- package/packages/tui/test/harness-footer.test.ts +0 -559
- package/packages/tui/test/harness-header.test.ts +0 -590
- package/packages/two-phase-review/test/classify.test.ts +0 -102
- package/packages/two-phase-review/test/helpers.ts +0 -72
- package/packages/two-phase-review/test/rules.test.ts +0 -150
- package/packages/two-phase-review/test/runtime.test.ts +0 -362
- package/packages/two-phase-review/test/scope.test.ts +0 -186
- package/packages/two-phase-review/test/signals.test.ts +0 -183
- package/packages/two-phase-review/test/state.test.ts +0 -201
- package/packages/wiki/test/basic.test.ts +0 -242
- package/packages/workspace-scanner/test/scanner.test.ts +0 -43
- package/packages/worktree/test/worktree.test.ts +0 -163
|
@@ -1,628 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Task Compiler - Tests
|
|
3
|
-
*
|
|
4
|
-
* Tests cover all 8 acceptance criteria from RFC-0044:
|
|
5
|
-
* 1. Standard engineering flow produces correct task sequence.
|
|
6
|
-
* 2. Cyclic dependencies fail with CYCLIC_DEPENDENCY.
|
|
7
|
-
* 3. Exclusive file overlap serializes or fails.
|
|
8
|
-
* 4. Every acceptance criterion maps to a task.
|
|
9
|
-
* 5. Build/migrate/commit remain prohibited by default.
|
|
10
|
-
* 6. E2E task is inserted for browser workflows.
|
|
11
|
-
* 7. Provider preference is advisory (not hard dependency).
|
|
12
|
-
* 8. Graph ordering is deterministic.
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
import assert from "node:assert";
|
|
16
|
-
import { describe, it } from "node:test";
|
|
17
|
-
import { compileTasks } from "../src/index.js";
|
|
18
|
-
import type {
|
|
19
|
-
CompiledRequirement,
|
|
20
|
-
ProjectProfile,
|
|
21
|
-
TaskCompileInput,
|
|
22
|
-
} from "../src/types.js";
|
|
23
|
-
import { TaskCompilerError, TaskCompilerErrorCode } from "../src/types.js";
|
|
24
|
-
|
|
25
|
-
// --- Test utilities -----------------------------------------------------
|
|
26
|
-
|
|
27
|
-
function makeRequirement(
|
|
28
|
-
text: string,
|
|
29
|
-
overrides?: Partial<CompiledRequirement>,
|
|
30
|
-
): CompiledRequirement {
|
|
31
|
-
return {
|
|
32
|
-
id: "REQ-001",
|
|
33
|
-
title: "Test Requirement",
|
|
34
|
-
problemStatement: text,
|
|
35
|
-
goals: [{ id: "goal-1", description: text }],
|
|
36
|
-
constraints: [],
|
|
37
|
-
acceptanceCriteria: [{ id: "AC-001", outcome: ["goal achieved"] }],
|
|
38
|
-
riskTags: [],
|
|
39
|
-
...overrides,
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function makeProject(overrides?: Partial<ProjectProfile>): ProjectProfile {
|
|
44
|
-
return {
|
|
45
|
-
projectPath: "/project",
|
|
46
|
-
projectName: "test-project",
|
|
47
|
-
frameworks: [],
|
|
48
|
-
testCapabilities: [],
|
|
49
|
-
commands: {},
|
|
50
|
-
rules: [],
|
|
51
|
-
...overrides,
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
async function compile(text: string, project?: ProjectProfile) {
|
|
56
|
-
return compileTasks({
|
|
57
|
-
requirement: makeRequirement(text),
|
|
58
|
-
project: project ?? makeProject(),
|
|
59
|
-
jobId: "JOB-001",
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// --- Test 1: Standard engineering flow ---------------------------------
|
|
64
|
-
|
|
65
|
-
describe("Standard engineering flow", () => {
|
|
66
|
-
it("produces analysis → implementation → test → review pipeline", async () => {
|
|
67
|
-
const result = await compile("Build a user login feature");
|
|
68
|
-
const types = result.tasks.map((t) => t.type);
|
|
69
|
-
assert.ok(types.length >= 4, "Should have at least 4 stages");
|
|
70
|
-
// Implementation should come before test
|
|
71
|
-
const implIdx = types.indexOf("implementation");
|
|
72
|
-
const testIdx = types.indexOf("test");
|
|
73
|
-
const reviewIdx = types.indexOf("review");
|
|
74
|
-
assert.ok(implIdx >= 0, "Should have implementation task");
|
|
75
|
-
assert.ok(testIdx >= 0, "Should have test task");
|
|
76
|
-
assert.ok(reviewIdx >= 0, "Should have review task");
|
|
77
|
-
assert.ok(implIdx < testIdx, "Implementation should come before test");
|
|
78
|
-
assert.ok(testIdx < reviewIdx, "Test should come before review");
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
it("inserts design stage for large requirements", async () => {
|
|
82
|
-
const result = await compile(
|
|
83
|
-
"Implement a comprehensive multi-module authentication and authorization system with RBAC, OAuth2, and session management across distributed microservices",
|
|
84
|
-
);
|
|
85
|
-
const types = result.tasks.map((t) => t.type);
|
|
86
|
-
assert.ok(
|
|
87
|
-
types.includes("design"),
|
|
88
|
-
"Should include design stage for large requirements",
|
|
89
|
-
);
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
it("each task has measurable completion outputs", async () => {
|
|
93
|
-
const result = await compile("Add user registration form");
|
|
94
|
-
for (const task of result.tasks) {
|
|
95
|
-
assert.ok(
|
|
96
|
-
task.expectedOutputs.length > 0,
|
|
97
|
-
`Task ${task.id} should have expected outputs`,
|
|
98
|
-
);
|
|
99
|
-
const hasRequired = task.expectedOutputs.some((o) => o.required);
|
|
100
|
-
assert.ok(
|
|
101
|
-
hasRequired,
|
|
102
|
-
`Task ${task.id} should have at least one required output`,
|
|
103
|
-
);
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
// --- Test 2: Cycle detection --------------------------------------------
|
|
109
|
-
|
|
110
|
-
describe("Cyclic dependencies fail", () => {
|
|
111
|
-
it("throws CYCLIC_DEPENDENCY when cycle detected", async () => {
|
|
112
|
-
// Test assertNoCycles directly with a graph that has A→B→C→A
|
|
113
|
-
const { assertNoCycles } = await import("../src/validate.js");
|
|
114
|
-
const cyclicGraph = {
|
|
115
|
-
jobId: "JOB",
|
|
116
|
-
tasks: [
|
|
117
|
-
{
|
|
118
|
-
id: "task-A",
|
|
119
|
-
type: "implementation" as const,
|
|
120
|
-
title: "Task A",
|
|
121
|
-
objective: "Task A",
|
|
122
|
-
dependencies: ["task-C"],
|
|
123
|
-
priority: 1,
|
|
124
|
-
fileOwnership: {
|
|
125
|
-
taskId: "task-A",
|
|
126
|
-
mode: "exclusive" as const,
|
|
127
|
-
include: [],
|
|
128
|
-
exclude: [],
|
|
129
|
-
},
|
|
130
|
-
filesInScope: [],
|
|
131
|
-
estimatedComplexity: 1 as const,
|
|
132
|
-
expectedOutputs: [],
|
|
133
|
-
prohibitedCommands: [],
|
|
134
|
-
permittedCommands: [],
|
|
135
|
-
requiredCapabilities: [],
|
|
136
|
-
acceptanceCriteria: [],
|
|
137
|
-
jobId: "JOB",
|
|
138
|
-
},
|
|
139
|
-
{
|
|
140
|
-
id: "task-B",
|
|
141
|
-
type: "implementation" as const,
|
|
142
|
-
title: "Task B",
|
|
143
|
-
objective: "Task B",
|
|
144
|
-
dependencies: ["task-A"],
|
|
145
|
-
priority: 2,
|
|
146
|
-
fileOwnership: {
|
|
147
|
-
taskId: "task-B",
|
|
148
|
-
mode: "exclusive" as const,
|
|
149
|
-
include: [],
|
|
150
|
-
exclude: [],
|
|
151
|
-
},
|
|
152
|
-
filesInScope: [],
|
|
153
|
-
estimatedComplexity: 1 as const,
|
|
154
|
-
expectedOutputs: [],
|
|
155
|
-
prohibitedCommands: [],
|
|
156
|
-
permittedCommands: [],
|
|
157
|
-
requiredCapabilities: [],
|
|
158
|
-
acceptanceCriteria: [],
|
|
159
|
-
jobId: "JOB",
|
|
160
|
-
},
|
|
161
|
-
{
|
|
162
|
-
id: "task-C",
|
|
163
|
-
type: "implementation" as const,
|
|
164
|
-
title: "Task C",
|
|
165
|
-
objective: "Task C",
|
|
166
|
-
dependencies: ["task-B"],
|
|
167
|
-
priority: 3,
|
|
168
|
-
fileOwnership: {
|
|
169
|
-
taskId: "task-C",
|
|
170
|
-
mode: "exclusive" as const,
|
|
171
|
-
include: [],
|
|
172
|
-
exclude: [],
|
|
173
|
-
},
|
|
174
|
-
filesInScope: [],
|
|
175
|
-
estimatedComplexity: 1 as const,
|
|
176
|
-
expectedOutputs: [],
|
|
177
|
-
prohibitedCommands: [],
|
|
178
|
-
permittedCommands: [],
|
|
179
|
-
requiredCapabilities: [],
|
|
180
|
-
acceptanceCriteria: [],
|
|
181
|
-
jobId: "JOB",
|
|
182
|
-
},
|
|
183
|
-
],
|
|
184
|
-
roots: ["task-A"],
|
|
185
|
-
terminalTasks: ["task-C"],
|
|
186
|
-
topologicalOrder: [],
|
|
187
|
-
};
|
|
188
|
-
assert.throws(
|
|
189
|
-
() => assertNoCycles(cyclicGraph),
|
|
190
|
-
(err: unknown) => {
|
|
191
|
-
if (err instanceof TaskCompilerError) {
|
|
192
|
-
assert.strictEqual(
|
|
193
|
-
err.code,
|
|
194
|
-
TaskCompilerErrorCode.CYCLIC_DEPENDENCY,
|
|
195
|
-
"Should throw CYCLIC_DEPENDENCY",
|
|
196
|
-
);
|
|
197
|
-
const details = err.details as { cyclicTasks?: string[] } | undefined;
|
|
198
|
-
assert.ok(
|
|
199
|
-
details?.cyclicTasks && details.cyclicTasks.length > 0,
|
|
200
|
-
"Should report cyclic tasks",
|
|
201
|
-
);
|
|
202
|
-
return true;
|
|
203
|
-
}
|
|
204
|
-
return false;
|
|
205
|
-
},
|
|
206
|
-
);
|
|
207
|
-
});
|
|
208
|
-
|
|
209
|
-
it("empty objective throws EMPTY_OBJECTIVE when no goals", async () => {
|
|
210
|
-
// An empty requirement with no problem statement and no goals
|
|
211
|
-
// triggers EMPTY_OBJECTIVE because decomposeRequirement produces no candidates
|
|
212
|
-
const req: CompiledRequirement = {
|
|
213
|
-
id: "REQ-EMPTY",
|
|
214
|
-
title: "",
|
|
215
|
-
problemStatement: " ", // whitespace-only = effectively empty
|
|
216
|
-
goals: [{ id: "g0", description: " " }], // whitespace-only goal
|
|
217
|
-
constraints: [],
|
|
218
|
-
acceptanceCriteria: [],
|
|
219
|
-
riskTags: [],
|
|
220
|
-
};
|
|
221
|
-
await assert.rejects(
|
|
222
|
-
async () =>
|
|
223
|
-
compileTasks({
|
|
224
|
-
requirement: req,
|
|
225
|
-
project: makeProject(),
|
|
226
|
-
jobId: "JOB-EMPTY",
|
|
227
|
-
}),
|
|
228
|
-
(err: unknown) => {
|
|
229
|
-
if (err instanceof TaskCompilerError) {
|
|
230
|
-
assert.ok(
|
|
231
|
-
err.code === TaskCompilerErrorCode.EMPTY_OBJECTIVE ||
|
|
232
|
-
err.code === TaskCompilerErrorCode.FILE_OVERLAP_CONFLICT,
|
|
233
|
-
`Expected error, got ${err.code}`,
|
|
234
|
-
);
|
|
235
|
-
return true;
|
|
236
|
-
}
|
|
237
|
-
return false;
|
|
238
|
-
},
|
|
239
|
-
);
|
|
240
|
-
});
|
|
241
|
-
});
|
|
242
|
-
|
|
243
|
-
// --- Test 3: File ownership overlap -------------------------------------
|
|
244
|
-
|
|
245
|
-
describe("File ownership overlap", () => {
|
|
246
|
-
it("parallel exclusive tasks on same files throw error", async () => {
|
|
247
|
-
// Directly test assertNoExclusiveFileOverlap with truly parallel exclusive tasks
|
|
248
|
-
const { assertNoExclusiveFileOverlap } = await import("../src/validate.js");
|
|
249
|
-
const overlapGraph = {
|
|
250
|
-
jobId: "JOB",
|
|
251
|
-
tasks: [
|
|
252
|
-
{
|
|
253
|
-
id: "impl-A",
|
|
254
|
-
type: "implementation" as const,
|
|
255
|
-
title: "Impl A",
|
|
256
|
-
objective: "Implement feature A",
|
|
257
|
-
dependencies: [], // parallel to impl-B
|
|
258
|
-
priority: 1,
|
|
259
|
-
fileOwnership: {
|
|
260
|
-
taskId: "impl-A",
|
|
261
|
-
mode: "exclusive" as const,
|
|
262
|
-
include: ["/project/src/**"],
|
|
263
|
-
exclude: [],
|
|
264
|
-
},
|
|
265
|
-
filesInScope: [],
|
|
266
|
-
estimatedComplexity: 1 as const,
|
|
267
|
-
expectedOutputs: [
|
|
268
|
-
{
|
|
269
|
-
kind: "file" as const,
|
|
270
|
-
description: "File a.ts",
|
|
271
|
-
path: "/project/src/a.ts",
|
|
272
|
-
required: true,
|
|
273
|
-
},
|
|
274
|
-
],
|
|
275
|
-
prohibitedCommands: [],
|
|
276
|
-
permittedCommands: [],
|
|
277
|
-
requiredCapabilities: [],
|
|
278
|
-
acceptanceCriteria: [],
|
|
279
|
-
jobId: "JOB",
|
|
280
|
-
},
|
|
281
|
-
{
|
|
282
|
-
id: "impl-B",
|
|
283
|
-
type: "implementation" as const,
|
|
284
|
-
title: "Impl B",
|
|
285
|
-
objective: "Implement feature B",
|
|
286
|
-
dependencies: [], // parallel to impl-A
|
|
287
|
-
priority: 1,
|
|
288
|
-
fileOwnership: {
|
|
289
|
-
taskId: "impl-B",
|
|
290
|
-
mode: "exclusive" as const,
|
|
291
|
-
include: ["/project/src/**"], // same file scope
|
|
292
|
-
exclude: [],
|
|
293
|
-
},
|
|
294
|
-
filesInScope: [],
|
|
295
|
-
estimatedComplexity: 1 as const,
|
|
296
|
-
expectedOutputs: [
|
|
297
|
-
{
|
|
298
|
-
kind: "file" as const,
|
|
299
|
-
description: "File b.ts",
|
|
300
|
-
path: "/project/src/b.ts",
|
|
301
|
-
required: true,
|
|
302
|
-
},
|
|
303
|
-
],
|
|
304
|
-
prohibitedCommands: [],
|
|
305
|
-
permittedCommands: [],
|
|
306
|
-
requiredCapabilities: [],
|
|
307
|
-
acceptanceCriteria: [],
|
|
308
|
-
jobId: "JOB",
|
|
309
|
-
},
|
|
310
|
-
],
|
|
311
|
-
roots: ["impl-A", "impl-B"],
|
|
312
|
-
terminalTasks: ["impl-A", "impl-B"],
|
|
313
|
-
topologicalOrder: [],
|
|
314
|
-
};
|
|
315
|
-
assert.throws(
|
|
316
|
-
() => assertNoExclusiveFileOverlap(overlapGraph),
|
|
317
|
-
(err: unknown) => {
|
|
318
|
-
if (err instanceof TaskCompilerError) {
|
|
319
|
-
assert.strictEqual(
|
|
320
|
-
err.code,
|
|
321
|
-
TaskCompilerErrorCode.FILE_OVERLAP_CONFLICT,
|
|
322
|
-
"Should throw FILE_OVERLAP_CONFLICT",
|
|
323
|
-
);
|
|
324
|
-
return true;
|
|
325
|
-
}
|
|
326
|
-
return false;
|
|
327
|
-
},
|
|
328
|
-
);
|
|
329
|
-
});
|
|
330
|
-
|
|
331
|
-
it("exclusive tasks get file ownership set correctly", async () => {
|
|
332
|
-
const result = await compile("Build a feature");
|
|
333
|
-
const implTasks = result.tasks.filter((t) => t.type === "implementation");
|
|
334
|
-
for (const task of implTasks) {
|
|
335
|
-
assert.strictEqual(
|
|
336
|
-
task.fileOwnership.mode,
|
|
337
|
-
"exclusive",
|
|
338
|
-
`Implementation task ${task.id} should have exclusive ownership`,
|
|
339
|
-
);
|
|
340
|
-
}
|
|
341
|
-
const analysisTasks = result.tasks.filter((t) => t.type === "analysis");
|
|
342
|
-
for (const task of analysisTasks) {
|
|
343
|
-
assert.strictEqual(
|
|
344
|
-
task.fileOwnership.mode,
|
|
345
|
-
"shared_read",
|
|
346
|
-
`Analysis task ${task.id} should have shared_read ownership`,
|
|
347
|
-
);
|
|
348
|
-
}
|
|
349
|
-
});
|
|
350
|
-
});
|
|
351
|
-
|
|
352
|
-
// --- Test 4: Acceptance criterion mapping -------------------------------
|
|
353
|
-
|
|
354
|
-
describe("Acceptance criterion mapping", () => {
|
|
355
|
-
it("every acceptance criterion is assigned to at least one task", async () => {
|
|
356
|
-
const acs = [
|
|
357
|
-
{ id: "AC-001", outcome: ["User can register"] },
|
|
358
|
-
{ id: "AC-002", outcome: ["User receives email"] },
|
|
359
|
-
{ id: "AC-003", outcome: ["Session is created"] },
|
|
360
|
-
];
|
|
361
|
-
const req: CompiledRequirement = {
|
|
362
|
-
id: "REQ-MAP",
|
|
363
|
-
title: "User Registration",
|
|
364
|
-
problemStatement: "Implement user registration flow",
|
|
365
|
-
goals: [{ id: "g1", description: "Implement registration" }],
|
|
366
|
-
constraints: [],
|
|
367
|
-
acceptanceCriteria: acs,
|
|
368
|
-
riskTags: [],
|
|
369
|
-
};
|
|
370
|
-
const result = await compileTasks({
|
|
371
|
-
requirement: req,
|
|
372
|
-
project: makeProject(),
|
|
373
|
-
jobId: "JOB-MAP",
|
|
374
|
-
});
|
|
375
|
-
const assigned = new Set<string>();
|
|
376
|
-
for (const task of result.tasks) {
|
|
377
|
-
for (const cid of task.acceptanceCriteria) {
|
|
378
|
-
assigned.add(cid);
|
|
379
|
-
}
|
|
380
|
-
}
|
|
381
|
-
for (const ac of acs) {
|
|
382
|
-
assert.ok(
|
|
383
|
-
assigned.has(ac.id),
|
|
384
|
-
`AC ${ac.id} should be assigned to at least one task`,
|
|
385
|
-
);
|
|
386
|
-
}
|
|
387
|
-
});
|
|
388
|
-
|
|
389
|
-
it("every task with acceptance criteria has required verification output", async () => {
|
|
390
|
-
const result = await compile("Build feature with ACs", makeProject());
|
|
391
|
-
for (const task of result.tasks) {
|
|
392
|
-
if (task.acceptanceCriteria.length > 0) {
|
|
393
|
-
const requiredOutputs = task.expectedOutputs.filter((o) => o.required);
|
|
394
|
-
assert.ok(
|
|
395
|
-
requiredOutputs.length > 0,
|
|
396
|
-
`Task ${task.id} with ${task.acceptanceCriteria.length} ACs should have required verification`,
|
|
397
|
-
);
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
});
|
|
401
|
-
});
|
|
402
|
-
|
|
403
|
-
// --- Test 5: Command policy -------------------------------------------
|
|
404
|
-
|
|
405
|
-
describe("Build/migrate/commit restrictions", () => {
|
|
406
|
-
it("git commit is prohibited by default", async () => {
|
|
407
|
-
const result = await compile("Add login feature");
|
|
408
|
-
for (const task of result.tasks) {
|
|
409
|
-
assert.ok(
|
|
410
|
-
task.prohibitedCommands.some((c) => c.includes("git commit")),
|
|
411
|
-
`Task ${task.id} should prohibit git commit`,
|
|
412
|
-
);
|
|
413
|
-
}
|
|
414
|
-
});
|
|
415
|
-
|
|
416
|
-
it("bench build and migrate are prohibited by default", async () => {
|
|
417
|
-
const result = await compile("Build login feature");
|
|
418
|
-
const allProhibited = result.tasks.flatMap((t) => t.prohibitedCommands);
|
|
419
|
-
assert.ok(
|
|
420
|
-
allProhibited.some((c) => c.includes("bench build")),
|
|
421
|
-
"Should prohibit bench build",
|
|
422
|
-
);
|
|
423
|
-
assert.ok(
|
|
424
|
-
allProhibited.some((c) => c.includes("bench migrate")),
|
|
425
|
-
"Should prohibit bench migrate",
|
|
426
|
-
);
|
|
427
|
-
});
|
|
428
|
-
|
|
429
|
-
it("test tasks are permitted to run test commands", async () => {
|
|
430
|
-
const result = await compile("Build feature with tests", makeProject());
|
|
431
|
-
const testTasks = result.tasks.filter((t) => t.type === "test");
|
|
432
|
-
if (testTasks.length > 0) {
|
|
433
|
-
for (const task of testTasks) {
|
|
434
|
-
assert.ok(
|
|
435
|
-
task.permittedCommands.some(
|
|
436
|
-
(c) =>
|
|
437
|
-
c.includes("test") || c.includes("pytest") || c.includes("jest"),
|
|
438
|
-
),
|
|
439
|
-
`Test task ${task.id} should be permitted to run test commands`,
|
|
440
|
-
);
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
});
|
|
444
|
-
});
|
|
445
|
-
|
|
446
|
-
// --- Test 6: E2E insertion -----------------------------------------
|
|
447
|
-
|
|
448
|
-
describe("E2E task insertion", () => {
|
|
449
|
-
it("E2E task is NOT inserted for non-browser workflows", async () => {
|
|
450
|
-
const result = await compile("Backend API feature", makeProject());
|
|
451
|
-
const e2eTasks = result.tasks.filter((t) => t.type === "e2e_test");
|
|
452
|
-
assert.strictEqual(
|
|
453
|
-
e2eTasks.length,
|
|
454
|
-
0,
|
|
455
|
-
"No E2E task for non-browser projects",
|
|
456
|
-
);
|
|
457
|
-
});
|
|
458
|
-
|
|
459
|
-
it("E2E task IS inserted for Playwright projects", async () => {
|
|
460
|
-
const result = await compileTasks({
|
|
461
|
-
requirement: makeRequirement("Build user dashboard"),
|
|
462
|
-
project: makeProject({
|
|
463
|
-
frameworks: [{ name: "Playwright", confidence: 0.9 }],
|
|
464
|
-
testCapabilities: [],
|
|
465
|
-
}),
|
|
466
|
-
jobId: "JOB-E2E",
|
|
467
|
-
});
|
|
468
|
-
const e2eTasks = result.tasks.filter((t) => t.type === "e2e_test");
|
|
469
|
-
assert.ok(
|
|
470
|
-
e2eTasks.length > 0,
|
|
471
|
-
"Should have E2E task for Playwright project",
|
|
472
|
-
);
|
|
473
|
-
// E2E should depend on tests
|
|
474
|
-
const e2eDeps = e2eTasks.flatMap((t) => t.dependencies);
|
|
475
|
-
const hasTestDep = e2eDeps.some((d) => d.includes("test"));
|
|
476
|
-
assert.ok(hasTestDep, "E2E task should depend on unit test task");
|
|
477
|
-
});
|
|
478
|
-
|
|
479
|
-
it("E2E task is NOT inserted when insertE2E is false", async () => {
|
|
480
|
-
const result = await compileTasks({
|
|
481
|
-
requirement: makeRequirement("Build dashboard"),
|
|
482
|
-
project: makeProject({
|
|
483
|
-
frameworks: [{ name: "Playwright", confidence: 0.9 }],
|
|
484
|
-
}),
|
|
485
|
-
jobId: "JOB-NOE2E",
|
|
486
|
-
insertE2E: false,
|
|
487
|
-
});
|
|
488
|
-
const e2eTasks = result.tasks.filter((t) => t.type === "e2e_test");
|
|
489
|
-
assert.strictEqual(e2eTasks.length, 0, "No E2E when insertE2E=false");
|
|
490
|
-
});
|
|
491
|
-
});
|
|
492
|
-
|
|
493
|
-
// --- Test 7: Advisory provider hints ---------------------------------
|
|
494
|
-
|
|
495
|
-
describe("Provider preference is advisory", () => {
|
|
496
|
-
it("implementation tasks have preferred provider hint", async () => {
|
|
497
|
-
const result = await compile("Build feature");
|
|
498
|
-
const implTasks = result.tasks.filter((t) => t.type === "implementation");
|
|
499
|
-
if (implTasks.length > 0) {
|
|
500
|
-
// Provider hint should be set (advisory)
|
|
501
|
-
// The Provider Router makes the final decision
|
|
502
|
-
for (const task of implTasks) {
|
|
503
|
-
assert.ok(
|
|
504
|
-
task.requiredCapabilities.length > 0,
|
|
505
|
-
`Impl task ${task.id} should have required capabilities`,
|
|
506
|
-
);
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
|
-
});
|
|
510
|
-
|
|
511
|
-
it("E2E tasks require playwright capability", async () => {
|
|
512
|
-
const result = await compileTasks({
|
|
513
|
-
requirement: makeRequirement("Build dashboard"),
|
|
514
|
-
project: makeProject({
|
|
515
|
-
frameworks: [{ name: "Playwright", confidence: 0.9 }],
|
|
516
|
-
}),
|
|
517
|
-
jobId: "JOB-E2E-CAP",
|
|
518
|
-
});
|
|
519
|
-
const e2eTasks = result.tasks.filter((t) => t.type === "e2e_test");
|
|
520
|
-
if (e2eTasks.length > 0) {
|
|
521
|
-
assert.ok(
|
|
522
|
-
e2eTasks[0]?.requiredCapabilities.includes("e2e"),
|
|
523
|
-
"E2E task should require e2e capability",
|
|
524
|
-
);
|
|
525
|
-
}
|
|
526
|
-
});
|
|
527
|
-
|
|
528
|
-
it("review tasks require review capability", async () => {
|
|
529
|
-
const result = await compile("Build feature");
|
|
530
|
-
const reviewTasks = result.tasks.filter((t) => t.type === "review");
|
|
531
|
-
if (reviewTasks.length > 0) {
|
|
532
|
-
assert.ok(
|
|
533
|
-
reviewTasks[0]?.requiredCapabilities.includes("review"),
|
|
534
|
-
"Review task should require review capability",
|
|
535
|
-
);
|
|
536
|
-
}
|
|
537
|
-
});
|
|
538
|
-
});
|
|
539
|
-
|
|
540
|
-
// --- Test 8: Deterministic topology ---------------------------------
|
|
541
|
-
|
|
542
|
-
describe("Graph ordering is deterministic", () => {
|
|
543
|
-
it("same input produces same topological order across multiple calls", async () => {
|
|
544
|
-
const input: TaskCompileInput = {
|
|
545
|
-
requirement: makeRequirement(
|
|
546
|
-
"Implement user authentication and profile management system with OAuth2 and JWT tokens",
|
|
547
|
-
),
|
|
548
|
-
project: makeProject(),
|
|
549
|
-
jobId: "JOB-DET",
|
|
550
|
-
};
|
|
551
|
-
|
|
552
|
-
const result1 = await compileTasks(input);
|
|
553
|
-
const result2 = await compileTasks(input);
|
|
554
|
-
const result3 = await compileTasks(input);
|
|
555
|
-
|
|
556
|
-
assert.deepStrictEqual(
|
|
557
|
-
result1.topologicalOrder,
|
|
558
|
-
result2.topologicalOrder,
|
|
559
|
-
"Topological order should be deterministic (call 1 vs 2)",
|
|
560
|
-
);
|
|
561
|
-
assert.deepStrictEqual(
|
|
562
|
-
result2.topologicalOrder,
|
|
563
|
-
result3.topologicalOrder,
|
|
564
|
-
"Topological order should be deterministic (call 2 vs 3)",
|
|
565
|
-
);
|
|
566
|
-
});
|
|
567
|
-
|
|
568
|
-
it("all tasks appear exactly once in topological order", async () => {
|
|
569
|
-
const result = await compile("Build feature");
|
|
570
|
-
const seen = new Set<string>();
|
|
571
|
-
for (const id of result.topologicalOrder) {
|
|
572
|
-
assert.ok(!seen.has(id), `Task ${id} appears twice in topological order`);
|
|
573
|
-
seen.add(id);
|
|
574
|
-
}
|
|
575
|
-
assert.strictEqual(
|
|
576
|
-
seen.size,
|
|
577
|
-
result.tasks.length,
|
|
578
|
-
"Every task should appear exactly once",
|
|
579
|
-
);
|
|
580
|
-
});
|
|
581
|
-
|
|
582
|
-
it("graph is acyclic (all roots precede dependents)", async () => {
|
|
583
|
-
const result = await compile("Build feature");
|
|
584
|
-
|
|
585
|
-
// Verify: for every dependency, the dep appears before the task in order
|
|
586
|
-
for (const task of result.tasks) {
|
|
587
|
-
const depIndex = task.dependencies.map((d) =>
|
|
588
|
-
result.topologicalOrder.indexOf(d),
|
|
589
|
-
);
|
|
590
|
-
const taskIndex = result.topologicalOrder.indexOf(task.id);
|
|
591
|
-
for (const di of depIndex) {
|
|
592
|
-
assert.ok(
|
|
593
|
-
di < taskIndex,
|
|
594
|
-
`Dependency ${task.dependencies[0]} (idx=${di}) should precede ${task.id} (idx=${taskIndex})`,
|
|
595
|
-
);
|
|
596
|
-
}
|
|
597
|
-
}
|
|
598
|
-
});
|
|
599
|
-
|
|
600
|
-
it("roots have no dependencies", async () => {
|
|
601
|
-
const result = await compile("Build feature");
|
|
602
|
-
for (const rootId of result.roots) {
|
|
603
|
-
const task = result.tasks.find((t) => t.id === rootId);
|
|
604
|
-
assert.ok(task, `Root task ${rootId} should exist`);
|
|
605
|
-
assert.strictEqual(
|
|
606
|
-
task?.dependencies.length,
|
|
607
|
-
0,
|
|
608
|
-
`Root task ${rootId} should have no dependencies`,
|
|
609
|
-
);
|
|
610
|
-
}
|
|
611
|
-
});
|
|
612
|
-
});
|
|
613
|
-
|
|
614
|
-
// --- Additional tests: Error cases --------------------------------------
|
|
615
|
-
|
|
616
|
-
describe("TaskCompilerError", () => {
|
|
617
|
-
it("TaskCompilerError has correct properties", () => {
|
|
618
|
-
const error = new TaskCompilerError(
|
|
619
|
-
TaskCompilerErrorCode.NO_VERIFICATION,
|
|
620
|
-
"Test error",
|
|
621
|
-
{ taskIds: ["task-1"] },
|
|
622
|
-
);
|
|
623
|
-
assert.strictEqual(error.name, "TaskCompilerError");
|
|
624
|
-
assert.strictEqual(error.code, TaskCompilerErrorCode.NO_VERIFICATION);
|
|
625
|
-
assert.strictEqual(error.message, "Test error");
|
|
626
|
-
assert.deepStrictEqual(error.details, { taskIds: ["task-1"] });
|
|
627
|
-
});
|
|
628
|
-
});
|