@oscaner-skills/cdd-engine 3.0.0 → 3.1.0
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/{src-next/bin.ts → dist/bin.js} +18 -21
- package/dist/contract/declare.js +998 -0
- package/dist/contract/doc.js +565 -0
- package/dist/contract/frontmatter.js +209 -0
- package/dist/contract/home-extractors.js +379 -0
- package/dist/contract/invariants.js +1030 -0
- package/dist/contract/judge.js +109 -0
- package/dist/contract/lint.js +206 -0
- package/dist/contract/project.js +371 -0
- package/dist/contract/skill-anatomy.js +156 -0
- package/dist/contract/translate.js +85 -0
- package/dist/face/artifacts.js +189 -0
- package/dist/face/board-view.js +522 -0
- package/dist/face/capsule.js +149 -0
- package/dist/face/cli.js +893 -0
- package/dist/face/declare.js +241 -0
- package/dist/face/gate.js +158 -0
- package/dist/face/graph-view.js +66 -0
- package/dist/face/host.js +211 -0
- package/dist/face/lifecycle.js +702 -0
- package/dist/face/preview.js +136 -0
- package/dist/face/projection.js +259 -0
- package/dist/face/route-render.js +162 -0
- package/dist/face/termination.js +504 -0
- package/dist/face/words.js +258 -0
- package/{src-next/infra/config.ts → dist/infra/config.js} +19 -24
- package/{src-next/infra/doc-roots.ts → dist/infra/doc-roots.js} +3 -13
- package/dist/infra/git.js +37 -0
- package/dist/infra/process.js +22 -0
- package/{src-next/infra/root.ts → dist/infra/root.js} +25 -36
- package/dist/infra/runtime.js +85 -0
- package/dist/infra/workspace.js +276 -0
- package/dist/render/brief.js +82 -0
- package/dist/render/issue-body.js +129 -0
- package/dist/render/skeleton.js +434 -0
- package/dist/render/templates.js +520 -0
- package/dist/session/faces.js +38 -0
- package/dist/session/graph.js +309 -0
- package/dist/session/handoff-schema.js +295 -0
- package/dist/session/ledger.js +762 -0
- package/dist/session/next.js +211 -0
- package/dist/session/preflight.js +194 -0
- package/dist/session/round-naming.js +73 -0
- package/dist/session/run.js +453 -0
- package/dist/session/state.js +8 -0
- package/dist/session/wave.js +92 -0
- package/package.json +5 -5
- package/src-next/__tests__/bin.test.ts +0 -128
- package/src-next/__tests__/dead-decl.guard.test.ts +0 -39
- package/src-next/__tests__/floor.guard.test.ts +0 -69
- package/src-next/__tests__/issue-body.guard.test.ts +0 -66
- package/src-next/__tests__/phase-suffix.guard.test.ts +0 -72
- package/src-next/__tests__/smoke.integration.test.ts +0 -185
- package/src-next/__tests__/support/strip-comments.ts +0 -99
- package/src-next/__tests__/zero-dep.test.ts +0 -94
- package/src-next/contract/__tests__/__snapshots__/project.schema.overall-spec.snap +0 -256
- package/src-next/contract/__tests__/__snapshots__/project.schema.phase-spec.snap +0 -165
- package/src-next/contract/__tests__/__snapshots__/project.schema.plan.snap +0 -190
- package/src-next/contract/__tests__/__snapshots__/project.schema.single-spec.snap +0 -106
- package/src-next/contract/__tests__/__snapshots__/project.shape.overall-spec.snap +0 -240
- package/src-next/contract/__tests__/__snapshots__/project.shape.phase-spec.snap +0 -165
- package/src-next/contract/__tests__/__snapshots__/project.shape.plan.snap +0 -190
- package/src-next/contract/__tests__/__snapshots__/project.shape.single-spec.snap +0 -100
- package/src-next/contract/__tests__/declare.test.ts +0 -481
- package/src-next/contract/__tests__/doc.test.ts +0 -527
- package/src-next/contract/__tests__/dockey.guard.test.ts +0 -58
- package/src-next/contract/__tests__/edge-conditions.guard.test.ts +0 -81
- package/src-next/contract/__tests__/frontmatter.test.ts +0 -164
- package/src-next/contract/__tests__/judge.test.ts +0 -1111
- package/src-next/contract/__tests__/lint.test.ts +0 -324
- package/src-next/contract/__tests__/project.test.ts +0 -460
- package/src-next/contract/__tests__/structure-pin.test.ts +0 -186
- package/src-next/contract/__tests__/translate.test.ts +0 -96
- package/src-next/contract/declare.ts +0 -1071
- package/src-next/contract/doc.ts +0 -816
- package/src-next/contract/frontmatter.ts +0 -233
- package/src-next/contract/home-extractors.ts +0 -397
- package/src-next/contract/invariants.ts +0 -1413
- package/src-next/contract/judge.ts +0 -151
- package/src-next/contract/lint.ts +0 -239
- package/src-next/contract/project.ts +0 -656
- package/src-next/contract/skill-anatomy.ts +0 -301
- package/src-next/contract/translate.ts +0 -113
- package/src-next/face/__tests__/board-view.test.ts +0 -1151
- package/src-next/face/__tests__/capsule.test.ts +0 -300
- package/src-next/face/__tests__/channel-closure.guard.test.ts +0 -129
- package/src-next/face/__tests__/cli.test.ts +0 -4897
- package/src-next/face/__tests__/face.test.ts +0 -289
- package/src-next/face/__tests__/graph-view.test.ts +0 -61
- package/src-next/face/__tests__/host.test.ts +0 -24
- package/src-next/face/__tests__/install-rows.guard.test.ts +0 -58
- package/src-next/face/__tests__/negation.ts +0 -6
- package/src-next/face/__tests__/preview.test.ts +0 -374
- package/src-next/face/__tests__/projection.test.ts +0 -303
- package/src-next/face/__tests__/repo-root.guard.test.ts +0 -120
- package/src-next/face/__tests__/termination.test.ts +0 -650
- package/src-next/face/__tests__/words.guard.test.ts +0 -93
- package/src-next/face/artifacts.ts +0 -248
- package/src-next/face/board-view.ts +0 -652
- package/src-next/face/capsule.ts +0 -163
- package/src-next/face/cli.ts +0 -1028
- package/src-next/face/declare.ts +0 -323
- package/src-next/face/gate.ts +0 -171
- package/src-next/face/graph-view.ts +0 -74
- package/src-next/face/host.ts +0 -302
- package/src-next/face/lifecycle.ts +0 -725
- package/src-next/face/preview.ts +0 -151
- package/src-next/face/projection.ts +0 -285
- package/src-next/face/route-render.ts +0 -185
- package/src-next/face/termination.ts +0 -573
- package/src-next/face/words.ts +0 -314
- package/src-next/infra/__tests__/infra.test.ts +0 -333
- package/src-next/infra/__tests__/root.test.ts +0 -56
- package/src-next/infra/git.ts +0 -39
- package/src-next/infra/process.ts +0 -34
- package/src-next/infra/runtime.ts +0 -132
- package/src-next/infra/workspace.ts +0 -322
- package/src-next/render/__tests__/render.test.ts +0 -550
- package/src-next/render/__tests__/skeleton.test.ts +0 -684
- package/src-next/render/brief.ts +0 -121
- package/src-next/render/issue-body.ts +0 -162
- package/src-next/render/skeleton.ts +0 -502
- package/src-next/render/templates.ts +0 -645
- package/src-next/session/__tests__/graph.test.ts +0 -277
- package/src-next/session/__tests__/handoff-plane.guard.test.ts +0 -48
- package/src-next/session/__tests__/handoff-schema.test.ts +0 -310
- package/src-next/session/__tests__/ledger.test.ts +0 -745
- package/src-next/session/__tests__/next.test.ts +0 -460
- package/src-next/session/__tests__/preflight.test.ts +0 -545
- package/src-next/session/__tests__/round-naming.test.ts +0 -142
- package/src-next/session/__tests__/run.test.ts +0 -1026
- package/src-next/session/__tests__/wave-line-phase.guard.test.ts +0 -49
- package/src-next/session/__tests__/wave.test.ts +0 -476
- package/src-next/session/faces.ts +0 -110
- package/src-next/session/graph.ts +0 -411
- package/src-next/session/handoff-schema.ts +0 -373
- package/src-next/session/ledger.ts +0 -1076
- package/src-next/session/next.ts +0 -293
- package/src-next/session/preflight.ts +0 -271
- package/src-next/session/round-naming.ts +0 -84
- package/src-next/session/run.ts +0 -610
- package/src-next/session/state.ts +0 -30
- package/src-next/session/wave.ts +0 -139
|
@@ -1,460 +0,0 @@
|
|
|
1
|
-
// packages/cdd-engine/src-next/session/__tests__/next.test.ts
|
|
2
|
-
// T7 NextStepRouter suite (design spec §3.2 · v1.20 the closure single verdict) — the C5
|
|
3
|
-
// decision table:
|
|
4
|
-
// · review zero findings → close(state) — readyBatch empty → done, else next-wave;
|
|
5
|
-
// · review findings non-empty (any severity) → the one-way fix hop;
|
|
6
|
-
// · fix blocker>0 → a re-review hop (the live tree, no commit identity);
|
|
7
|
-
// · fix blocker==0 (warn/nit only or clean) → close(state) — the unified closure, never
|
|
8
|
-
// the retired `none`;
|
|
9
|
-
// · the review-cycle soft cap → the "BLOCKED: review-cycle-cap" suggestion (outranks the
|
|
10
|
-
// blocker row); REVIEW_CYCLE_CAP + the suggestion wording are the pinned constants;
|
|
11
|
-
// · the fix-route readback suffix — FIX_READBACK_SUFFIX — the declared single-source
|
|
12
|
-
// wording the capsule appends to the fix hop's `next:` render (verbatim, by reference);
|
|
13
|
-
// · BLOCKED/TIMEOUT → null (no next line — the failure face), every phase;
|
|
14
|
-
// · implement → the group's review (the live tree); branch-review → closure / fix;
|
|
15
|
-
// · the `none` route kind is RETIRED (closure renders done / next-wave), and a
|
|
16
|
-
// completed non-failed round producing null is a hard error on the dispatch face.
|
|
17
|
-
// The type assertions at the bottom pin the public surface compile-time (the brief's
|
|
18
|
-
// type-check checkable) — they fail under tsc if the exported signatures drift.
|
|
19
|
-
|
|
20
|
-
import { describe, expect, it } from "vitest";
|
|
21
|
-
import { Capsule } from "../../face/capsule.ts";
|
|
22
|
-
import { CommandTreeBuilder } from "../../face/projection.ts";
|
|
23
|
-
import { Words } from "../../face/words.ts";
|
|
24
|
-
import type { Round, RoundPhase } from "../ledger.ts";
|
|
25
|
-
import type { Route } from "../next.ts";
|
|
26
|
-
import {
|
|
27
|
-
FIX_READBACK_SUFFIX,
|
|
28
|
-
NextStepRouter,
|
|
29
|
-
PIPELINE_NEXT,
|
|
30
|
-
type PipelineFaceReport,
|
|
31
|
-
REVIEW_CYCLE_CAP,
|
|
32
|
-
SOFT_CAP_SUGGESTION,
|
|
33
|
-
} from "../next.ts";
|
|
34
|
-
import type { ExecutionState } from "../state.ts";
|
|
35
|
-
|
|
36
|
-
/** A minimal execution-state stub — the router reads only readyBatch(). */
|
|
37
|
-
const state = (ready: readonly number[]): ExecutionState => ({
|
|
38
|
-
doneTasks: () => new Set(),
|
|
39
|
-
readyBatch: () => [...ready],
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
/** A review finding literal shorthand. */
|
|
43
|
-
const finding = (
|
|
44
|
-
severity: "blocker" | "warn" | "nit",
|
|
45
|
-
summary = "",
|
|
46
|
-
): {
|
|
47
|
-
severity: "blocker" | "warn" | "nit";
|
|
48
|
-
summary: string;
|
|
49
|
-
} => ({ severity, summary });
|
|
50
|
-
|
|
51
|
-
/** A round carrier shorthand — the mandated fields default; the case overrides. */
|
|
52
|
-
const round = (over: { phase: RoundPhase } & Partial<Omit<Round, "phase">>): Round => ({
|
|
53
|
-
findings: [],
|
|
54
|
-
consecutiveS1: 0,
|
|
55
|
-
...over,
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
const router = new NextStepRouter();
|
|
59
|
-
|
|
60
|
-
describe("review rounds — zero findings flows the next wave on or closes the run (close)", () => {
|
|
61
|
-
it("zero findings + a ready batch → the next wave (close() — the ready task ids)", () => {
|
|
62
|
-
expect(router.next(state([3]), round({ phase: "review" }))).toEqual({
|
|
63
|
-
kind: "next-wave",
|
|
64
|
-
tasks: "3",
|
|
65
|
-
});
|
|
66
|
-
expect(router.next(state([4, 5]), round({ phase: "review" }))).toEqual({
|
|
67
|
-
kind: "next-wave",
|
|
68
|
-
tasks: "4,5",
|
|
69
|
-
});
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
it("zero findings + an exhausted run → done (the v1.20 terminal word, never `none`)", () => {
|
|
73
|
-
expect(router.next(state([]), round({ phase: "review" }))).toEqual({ kind: "done" });
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
it("any findings (blocker or warn/nit) → the one-way fix hop carrying the review handoff", () => {
|
|
77
|
-
const findings: Round["findings"] = [finding("warn", "drift")];
|
|
78
|
-
expect(
|
|
79
|
-
router.next(
|
|
80
|
-
state([]),
|
|
81
|
-
round({ phase: "review", findings, reviewsPath: "tasks-7,9-review-1.json" }),
|
|
82
|
-
),
|
|
83
|
-
).toEqual({ kind: "fix", reviews: "tasks-7,9-review-1.json" });
|
|
84
|
-
|
|
85
|
-
const blockers: Round["findings"] = [finding("blocker", "defect")];
|
|
86
|
-
expect(router.next(state([]), round({ phase: "review", findings: blockers }))).toEqual({
|
|
87
|
-
kind: "fix",
|
|
88
|
-
findings: undefined,
|
|
89
|
-
});
|
|
90
|
-
});
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
describe("fix rounds — the re-review / closure decision point (C5-1, close())", () => {
|
|
94
|
-
it("input blockers remain → a re-review hop (the live tree, no commit identity)", () => {
|
|
95
|
-
expect(
|
|
96
|
-
router.next(state([]), round({ phase: "fix", findings: [finding("blocker", "remaining")] })),
|
|
97
|
-
).toEqual({ kind: "review" });
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
it("warn/nit only → done (closure via close() — the #278 REVIEW_FIX state, no re-review preview)", () => {
|
|
101
|
-
expect(
|
|
102
|
-
router.next(state([]), round({ phase: "fix", findings: [finding("warn"), finding("nit")] })),
|
|
103
|
-
).toEqual({ kind: "done" });
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
it("zero findings → done (close() with an exhausted run)", () => {
|
|
107
|
-
expect(router.next(state([]), round({ phase: "fix" }))).toEqual({ kind: "done" });
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
it("a blocker-free fix with a ready batch → next-wave (the close() routing-table row)", () => {
|
|
111
|
-
expect(router.next(state([7]), round({ phase: "fix", findings: [finding("warn")] }))).toEqual({
|
|
112
|
-
kind: "next-wave",
|
|
113
|
-
tasks: "7",
|
|
114
|
-
});
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
it("the soft cap outranks the blocker row — a capped run defers to the user", () => {
|
|
118
|
-
expect(
|
|
119
|
-
router.next(
|
|
120
|
-
state([]),
|
|
121
|
-
round({
|
|
122
|
-
phase: "fix",
|
|
123
|
-
findings: [finding("blocker")],
|
|
124
|
-
consecutiveS1: REVIEW_CYCLE_CAP,
|
|
125
|
-
}),
|
|
126
|
-
),
|
|
127
|
-
).toEqual({ kind: "soft-cap", message: SOFT_CAP_SUGGESTION });
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
it("below the cap, blockers still route the re-review", () => {
|
|
131
|
-
expect(
|
|
132
|
-
router.next(
|
|
133
|
-
state([]),
|
|
134
|
-
round({ phase: "fix", findings: [finding("blocker")], consecutiveS1: 2 }),
|
|
135
|
-
)!.kind,
|
|
136
|
-
).toBe("review");
|
|
137
|
-
});
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
describe("implement / branch-review — the lifecycle rows", () => {
|
|
141
|
-
it("implement completes → the group's review (the live tree)", () => {
|
|
142
|
-
expect(router.next(state([]), round({ phase: "implement" }))).toEqual({ kind: "review" });
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
it("branch-review zero findings → done (close()); findings → the fix hop", () => {
|
|
146
|
-
expect(router.next(state([]), round({ phase: "branch-review" }))).toEqual({ kind: "done" });
|
|
147
|
-
expect(
|
|
148
|
-
router.next(state([]), round({ phase: "branch-review", findings: [finding("nit")] }))!.kind,
|
|
149
|
-
).toBe("fix");
|
|
150
|
-
});
|
|
151
|
-
});
|
|
152
|
-
|
|
153
|
-
describe("the failure face — BLOCKED/TIMEOUT produce no next line", () => {
|
|
154
|
-
it("a BLOCKED review round → null", () => {
|
|
155
|
-
expect(router.next(state([]), round({ phase: "review", status: "BLOCKED" }))).toBeNull();
|
|
156
|
-
});
|
|
157
|
-
it("a BLOCKED fix round → null (the fix itself BLOCKED keeps the no-next face)", () => {
|
|
158
|
-
expect(
|
|
159
|
-
router.next(
|
|
160
|
-
state([]),
|
|
161
|
-
round({ phase: "fix", status: "BLOCKED", findings: [finding("blocker")] }),
|
|
162
|
-
),
|
|
163
|
-
).toBeNull();
|
|
164
|
-
});
|
|
165
|
-
it("a TIMEOUT round → null", () => {
|
|
166
|
-
expect(router.next(state([]), round({ phase: "implement", status: "TIMEOUT" }))).toBeNull();
|
|
167
|
-
});
|
|
168
|
-
});
|
|
169
|
-
|
|
170
|
-
describe("the pinned surface — Route/soft-cap constants (the brief's type-check checkable)", () => {
|
|
171
|
-
it("the soft-cap constant is the literal 20 and the wording is stable", () => {
|
|
172
|
-
expect(REVIEW_CYCLE_CAP).toBe(20);
|
|
173
|
-
expect(SOFT_CAP_SUGGESTION).toBe("BLOCKED: review-cycle-cap — user adjudicates");
|
|
174
|
-
});
|
|
175
|
-
|
|
176
|
-
it("the fix-route readback suffix is the declared single-source wording", () => {
|
|
177
|
-
expect(FIX_READBACK_SUFFIX).toBe(
|
|
178
|
-
"(confirm the findings · if a finding needs a ruling, record the ruling in the findings file)",
|
|
179
|
-
);
|
|
180
|
-
});
|
|
181
|
-
|
|
182
|
-
it("the readback suffix keeps its literal type at compile time", () => {
|
|
183
|
-
// Compile-time pin — fails under `tsc --noEmit` if the constant's declared type
|
|
184
|
-
// drifts from the render the capsule appends verbatim (exact suffix wording).
|
|
185
|
-
const suffix: "(confirm the findings · if a finding needs a ruling, record the ruling in the findings file)" =
|
|
186
|
-
FIX_READBACK_SUFFIX;
|
|
187
|
-
expect(suffix).toBe(FIX_READBACK_SUFFIX);
|
|
188
|
-
});
|
|
189
|
-
|
|
190
|
-
it("the soft-cap constants keep their literal types at compile time", () => {
|
|
191
|
-
// Compile-time pins — this file fails under `tsc --noEmit` if either constant's
|
|
192
|
-
// declared type drifts from the decision table's domain (cap == 20, verbatim wording).
|
|
193
|
-
const cap: 20 = REVIEW_CYCLE_CAP;
|
|
194
|
-
const wording: "BLOCKED: review-cycle-cap — user adjudicates" = SOFT_CAP_SUGGESTION;
|
|
195
|
-
expect({ cap, wording }).toEqual({
|
|
196
|
-
cap: 20,
|
|
197
|
-
wording: "BLOCKED: review-cycle-cap — user adjudicates",
|
|
198
|
-
});
|
|
199
|
-
});
|
|
200
|
-
|
|
201
|
-
it("the router is the single next-generation face — the exported signature is pinned", () => {
|
|
202
|
-
const surface: (state: ExecutionState, ref: Round) => Route | null = (s, r) =>
|
|
203
|
-
router.next(s, r);
|
|
204
|
-
expect(surface(state([]), round({ phase: "review" }))).toEqual({ kind: "done" });
|
|
205
|
-
});
|
|
206
|
-
|
|
207
|
-
it("the close() routing table — every closure point renders done | next-wave, never `none`", () => {
|
|
208
|
-
// review approved → exhausted done / ready next-wave
|
|
209
|
-
expect(router.next(state([]), round({ phase: "review" }))).toEqual({ kind: "done" });
|
|
210
|
-
expect(router.next(state([2]), round({ phase: "review" }))).toEqual({
|
|
211
|
-
kind: "next-wave",
|
|
212
|
-
tasks: "2",
|
|
213
|
-
});
|
|
214
|
-
// fix clean (warn/nit) → done / next-wave — the fix closure is a close(), never `none`
|
|
215
|
-
expect(router.next(state([]), round({ phase: "fix", findings: [finding("nit")] }))).toEqual({
|
|
216
|
-
kind: "done",
|
|
217
|
-
});
|
|
218
|
-
expect(router.next(state([2]), round({ phase: "fix", findings: [finding("warn")] }))).toEqual({
|
|
219
|
-
kind: "next-wave",
|
|
220
|
-
tasks: "2",
|
|
221
|
-
});
|
|
222
|
-
// branch-review clean → done
|
|
223
|
-
expect(router.next(state([]), round({ phase: "branch-review" }))).toEqual({ kind: "done" });
|
|
224
|
-
});
|
|
225
|
-
});
|
|
226
|
-
|
|
227
|
-
describe("the severity-combination space — every blocker/warn/nit MIX rides the same three-type routing (v1.29)", () => {
|
|
228
|
-
// The full 2^3 severity mix space (empty through all-three) — the C5 table judges
|
|
229
|
-
// severity only by the blocker/non-blocker axis: a review with ANY findings (any
|
|
230
|
-
// mix) routes the one-way fix hop; a fix with ANY blocker in its input re-reviews;
|
|
231
|
-
// a blocker-free fix (warn/nit in any mix) closes (next-wave when another wave is
|
|
232
|
-
// ready, done when the run is exhausted).
|
|
233
|
-
const MIXES: readonly (readonly ("blocker" | "warn" | "nit")[])[] = [
|
|
234
|
-
[],
|
|
235
|
-
["warn"],
|
|
236
|
-
["nit"],
|
|
237
|
-
["warn", "nit"],
|
|
238
|
-
["blocker"],
|
|
239
|
-
["blocker", "warn"],
|
|
240
|
-
["blocker", "nit"],
|
|
241
|
-
["blocker", "warn", "nit"],
|
|
242
|
-
];
|
|
243
|
-
|
|
244
|
-
it.each(MIXES.map((mix) => [mix]))(
|
|
245
|
-
"review findings %j — any mix routes fix (or close when empty)",
|
|
246
|
-
(mix) => {
|
|
247
|
-
const findings = mix.map((severity) => finding(severity));
|
|
248
|
-
const route = router.next(state([3]), round({ phase: "review", findings }));
|
|
249
|
-
if (mix.length === 0) {
|
|
250
|
-
expect(route).toEqual({ kind: "next-wave", tasks: "3" });
|
|
251
|
-
expect(router.next(state([]), round({ phase: "review", findings }))).toEqual({
|
|
252
|
-
kind: "done",
|
|
253
|
-
});
|
|
254
|
-
} else {
|
|
255
|
-
expect(route!.kind).toBe("fix"); // the one-way hop holding the review handoff
|
|
256
|
-
}
|
|
257
|
-
},
|
|
258
|
-
);
|
|
259
|
-
|
|
260
|
-
it.each(MIXES.map((mix) => [mix]))(
|
|
261
|
-
"fix findings %j — blocker-any mix re-reviews; warn/nit-only closes",
|
|
262
|
-
(mix) => {
|
|
263
|
-
const findings = mix.map((severity) => finding(severity));
|
|
264
|
-
const fix = round({ phase: "fix", findings });
|
|
265
|
-
if (mix.includes("blocker")) {
|
|
266
|
-
expect(router.next(state([3]), fix)).toEqual({ kind: "review" });
|
|
267
|
-
} else {
|
|
268
|
-
expect(router.next(state([3]), fix)).toEqual({ kind: "next-wave", tasks: "3" });
|
|
269
|
-
expect(router.next(state([]), fix)).toEqual({ kind: "done" });
|
|
270
|
-
}
|
|
271
|
-
},
|
|
272
|
-
);
|
|
273
|
-
|
|
274
|
-
it.each(MIXES.filter((mix) => mix.includes("warn") && mix.includes("nit")).map((mix) => [mix]))(
|
|
275
|
-
"a re-review round carrying %j rides the SAME review table — the re-review has no severity exemption",
|
|
276
|
-
(mix) => {
|
|
277
|
-
const findings = mix.map((severity) => finding(severity));
|
|
278
|
-
// re-review = a review round at a new ref — the C5 table applies verbatim
|
|
279
|
-
const route = router.next(state([3]), round({ phase: "review", findings }));
|
|
280
|
-
expect(route!.kind).toBe("fix");
|
|
281
|
-
},
|
|
282
|
-
);
|
|
283
|
-
});
|
|
284
|
-
|
|
285
|
-
// ---------------------------------------------------------------------------
|
|
286
|
-
// P4.1 T4 — the route → literal → second-parse roundtrip: every router-route the C5
|
|
287
|
-
// table can emit renders a next literal whose argv parses with zero errors (the
|
|
288
|
-
// executable command reversal) · done is the bare terminal word, never fed.
|
|
289
|
-
// ---------------------------------------------------------------------------
|
|
290
|
-
|
|
291
|
-
describe("P4.1 T4 — the router's routes render parseable next literals (zero-error second parse)", () => {
|
|
292
|
-
/** The next text of a route rendered against a wave-frame target (the task face —
|
|
293
|
-
* the C5 table's real consumer), then the parseable argv (the readback suffix is
|
|
294
|
-
* prompt prose, never argv). */
|
|
295
|
-
function argvOf(route: Route): string[] {
|
|
296
|
-
const lines = new Capsule(new Words()).emit("APPROVED", "0", "/h.json", route, {
|
|
297
|
-
type: "wave",
|
|
298
|
-
id: "1,2",
|
|
299
|
-
plan: "docs/kairos/plans/p3.md",
|
|
300
|
-
});
|
|
301
|
-
const literal = lines[1]!.slice("next: ".length);
|
|
302
|
-
return literal
|
|
303
|
-
.replace(new RegExp(`\\s*\\(${FIX_READBACK_SUFFIX.slice(1, -1)}\\)$`), "")
|
|
304
|
-
.split(/\s+/);
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
it.each([
|
|
308
|
-
["implement wave", { kind: "next-wave", tasks: "1,2" } as Route],
|
|
309
|
-
["re-review", { kind: "review" } as Route],
|
|
310
|
-
["the one-way fix hop", { kind: "fix", reviews: "tasks-1-review-1.json" } as Route],
|
|
311
|
-
["closure", { kind: "done" } as Route],
|
|
312
|
-
] as const)("%s — the route's literal argv parses", (_label, route) => {
|
|
313
|
-
if (route.kind === "done") {
|
|
314
|
-
// the bare terminal word: never fed to parse (a bare `done` is not a command)
|
|
315
|
-
expect(() => new CommandTreeBuilder().program.parse(["done"], { from: "user" })).toThrow(
|
|
316
|
-
/unknown command 'done'/,
|
|
317
|
-
);
|
|
318
|
-
return;
|
|
319
|
-
}
|
|
320
|
-
expect(() =>
|
|
321
|
-
new CommandTreeBuilder().program.parse(argvOf(route), { from: "user" }),
|
|
322
|
-
).not.toThrow();
|
|
323
|
-
});
|
|
324
|
-
});
|
|
325
|
-
|
|
326
|
-
// ---------------------------------------------------------------------------
|
|
327
|
-
// D40 — ONE "next step" concept turned single-resolver + face-to-face handoff.
|
|
328
|
-
// ---------------------------------------------------------------------------
|
|
329
|
-
|
|
330
|
-
describe("D40 — the face-to-face handoff route + the single resolver", () => {
|
|
331
|
-
it("handoff() carries the pipeline entry for a doc-class — the ONE route kind", () => {
|
|
332
|
-
expect(NextStepRouter.handoff("phase-spec")).toEqual({
|
|
333
|
-
kind: "handoff",
|
|
334
|
-
entry: PIPELINE_NEXT["phase-spec"],
|
|
335
|
-
});
|
|
336
|
-
expect(NextStepRouter.handoff("branch")).toEqual({
|
|
337
|
-
kind: "handoff",
|
|
338
|
-
entry: PIPELINE_NEXT.branch,
|
|
339
|
-
});
|
|
340
|
-
});
|
|
341
|
-
|
|
342
|
-
it("resolve() passes an ACTIVE C5 hop through untouched (the line is not drained)", () => {
|
|
343
|
-
// The line's own C5 frontier decides next until it drains — a review/fix/next-wave
|
|
344
|
-
// route is the line's next step, never the face-to-face handoff.
|
|
345
|
-
expect(NextStepRouter.resolve({ kind: "review" }, "phase-spec")).toEqual({ kind: "review" });
|
|
346
|
-
expect(NextStepRouter.resolve({ kind: "next-wave", tasks: "3" }, "wave")).toEqual({
|
|
347
|
-
kind: "next-wave",
|
|
348
|
-
tasks: "3",
|
|
349
|
-
});
|
|
350
|
-
});
|
|
351
|
-
|
|
352
|
-
it("resolve() yields the face-to-face handoff when the line's C5 frontier drained (done)", () => {
|
|
353
|
-
expect(NextStepRouter.resolve({ kind: "done" }, "plan")).toEqual({
|
|
354
|
-
kind: "handoff",
|
|
355
|
-
entry: PIPELINE_NEXT.plan,
|
|
356
|
-
});
|
|
357
|
-
// a null C5 route (a not-yet-started frontier) also hands off to the next face.
|
|
358
|
-
expect(NextStepRouter.resolve(null, "branch")).toEqual({
|
|
359
|
-
kind: "handoff",
|
|
360
|
-
entry: PIPELINE_NEXT.branch,
|
|
361
|
-
});
|
|
362
|
-
});
|
|
363
|
-
|
|
364
|
-
it("resolve() with no face seam (null doc-class) renders the bare terminal `done`", () => {
|
|
365
|
-
// The overall line / a bare terminal: no pipeline seam carries it — the terminal word.
|
|
366
|
-
expect(NextStepRouter.resolve({ kind: "done" }, null)).toEqual({ kind: "done" });
|
|
367
|
-
expect(NextStepRouter.resolve(null, null)).toEqual({ kind: "done" });
|
|
368
|
-
});
|
|
369
|
-
});
|
|
370
|
-
|
|
371
|
-
// ---------------------------------------------------------------------------
|
|
372
|
-
// D40 / D26 — walk(): the ONE face-to-face traversal. The board reports the
|
|
373
|
-
// observed faces (keyed), the router decides the next step. This is the D26 guard
|
|
374
|
-
// for the board off-by-one: a just-closed spec hands off to the SPEC's exit
|
|
375
|
-
// (cdd-plan), never the absent plan's exit (cdd-dev).
|
|
376
|
-
// ---------------------------------------------------------------------------
|
|
377
|
-
|
|
378
|
-
describe("D40/D26 — walk(): the single face-to-face traversal", () => {
|
|
379
|
-
/** A face report with every face unentered/open by default (the caller overrides). */
|
|
380
|
-
const report = (over: Partial<PipelineFaceReport>): PipelineFaceReport => ({
|
|
381
|
-
"phase-spec": { closed: false, active: null, target: null },
|
|
382
|
-
plan: { closed: false, active: null, target: null },
|
|
383
|
-
wave: { closed: false, active: null, target: null },
|
|
384
|
-
branch: { closed: false, active: null, target: null },
|
|
385
|
-
...over,
|
|
386
|
-
});
|
|
387
|
-
const tSpec = { type: "spec", id: "docs/kairos/specs/p-design.md" } as const;
|
|
388
|
-
const tPlan = {
|
|
389
|
-
type: "plan",
|
|
390
|
-
id: "docs/kairos/plans/p.md",
|
|
391
|
-
plan: "docs/kairos/plans/p.md",
|
|
392
|
-
} as const;
|
|
393
|
-
|
|
394
|
-
it("a face with an active C5 hop renders that hop (the in-flight work wins)", () => {
|
|
395
|
-
const next = NextStepRouter.walk(
|
|
396
|
-
report({
|
|
397
|
-
"phase-spec": { closed: true, active: null, target: tSpec },
|
|
398
|
-
plan: { closed: false, active: { kind: "review" }, target: tPlan },
|
|
399
|
-
}),
|
|
400
|
-
);
|
|
401
|
-
expect(next.route).toEqual({ kind: "review" });
|
|
402
|
-
expect(next.target).toEqual(tPlan);
|
|
403
|
-
});
|
|
404
|
-
|
|
405
|
-
it("the off-by-one D26 guard — a just-closed spec + an ABSENT plan hands off to the SPEC's exit", () => {
|
|
406
|
-
// The board's frontier is the plan face, but it was never entered (no doc). The
|
|
407
|
-
// retired fork used the frontier LINE's key → plan's exit (cdd-dev). The walk uses
|
|
408
|
-
// the PRECEDING entered face's exit → the spec's (cdd-plan).
|
|
409
|
-
const next = NextStepRouter.walk(
|
|
410
|
-
report({ "phase-spec": { closed: true, active: null, target: tSpec } }),
|
|
411
|
-
);
|
|
412
|
-
expect(next.route).toEqual({ kind: "handoff", entry: PIPELINE_NEXT["phase-spec"] });
|
|
413
|
-
expect(next.target).toEqual(tSpec);
|
|
414
|
-
});
|
|
415
|
-
|
|
416
|
-
it("a frontier ENTERED but drained (a present doc, no active hop) renders its OWN exit", () => {
|
|
417
|
-
const next = NextStepRouter.walk(
|
|
418
|
-
report({
|
|
419
|
-
"phase-spec": { closed: true, active: null, target: tSpec },
|
|
420
|
-
plan: { closed: false, active: null, target: tPlan },
|
|
421
|
-
}),
|
|
422
|
-
);
|
|
423
|
-
expect(next.route).toEqual({ kind: "handoff", entry: PIPELINE_NEXT.plan });
|
|
424
|
-
expect(next.target).toEqual(tPlan);
|
|
425
|
-
});
|
|
426
|
-
|
|
427
|
-
it("no preceding entered face → the FIRST face's exit (the pipeline entrance)", () => {
|
|
428
|
-
const next = NextStepRouter.walk(report({}));
|
|
429
|
-
expect(next.route).toEqual({ kind: "handoff", entry: PIPELINE_NEXT["phase-spec"] });
|
|
430
|
-
});
|
|
431
|
-
|
|
432
|
-
it("every face closed → the LAST entered face's exit (the pipeline terminus)", () => {
|
|
433
|
-
const next = NextStepRouter.walk(
|
|
434
|
-
report({
|
|
435
|
-
"phase-spec": { closed: true, active: null, target: tSpec },
|
|
436
|
-
plan: { closed: true, active: null, target: tPlan },
|
|
437
|
-
wave: { closed: true, active: null, target: { type: "wave", id: "1", plan: tPlan.plan } },
|
|
438
|
-
branch: {
|
|
439
|
-
closed: true,
|
|
440
|
-
active: null,
|
|
441
|
-
target: { type: "branch", id: "branch", plan: tPlan.plan },
|
|
442
|
-
},
|
|
443
|
-
}),
|
|
444
|
-
);
|
|
445
|
-
expect(next.route).toEqual({ kind: "handoff", entry: PIPELINE_NEXT.branch });
|
|
446
|
-
});
|
|
447
|
-
|
|
448
|
-
it("every face closed with nothing entered → the bare terminal `done`", () => {
|
|
449
|
-
expect(
|
|
450
|
-
NextStepRouter.walk(
|
|
451
|
-
report({
|
|
452
|
-
"phase-spec": { closed: true, active: null, target: null },
|
|
453
|
-
plan: { closed: true, active: null, target: null },
|
|
454
|
-
wave: { closed: true, active: null, target: null },
|
|
455
|
-
branch: { closed: true, active: null, target: null },
|
|
456
|
-
}),
|
|
457
|
-
).route,
|
|
458
|
-
).toEqual({ kind: "done" });
|
|
459
|
-
});
|
|
460
|
-
});
|