@oscaner-skills/cdd-engine 4.10.0 → 4.12.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/dist/contract/completion-criterion.js +19 -28
- package/dist/contract/doc.js +24 -0
- package/dist/contract/invariants.js +11 -8
- package/dist/contract/judge.js +45 -4
- package/dist/contract/project.js +12 -1
- package/dist/contract/task-block-grammar.js +3 -1
- package/dist/face/board-view.js +327 -138
- package/dist/face/cli.js +172 -63
- package/dist/face/gate.js +6 -3
- package/dist/face/lifecycle.js +191 -128
- package/dist/face/words.js +51 -0
- package/dist/infra/plan-source.js +359 -0
- package/dist/infra/runtime.js +20 -52
- package/dist/render/brief.js +34 -32
- package/dist/render/templates.js +63 -29
- package/dist/session/carrier-integrity.js +0 -8
- package/dist/session/dispatch-authority.js +1 -1
- package/dist/session/handoff-schema.js +135 -73
- package/dist/session/ledger.js +269 -104
- package/dist/session/pipeline.js +2 -2
- package/dist/session/preflight.js +65 -34
- package/dist/session/round-naming.js +138 -89
- package/dist/session/run.js +73 -74
- package/package.json +1 -1
|
@@ -3,15 +3,21 @@
|
|
|
3
3
|
// converge into ONE single-entry gate a work command consults before ANY child
|
|
4
4
|
// dispatch — the clean-tree hard gate (tree-clean → BLOCKED with the commit/discard
|
|
5
5
|
// guidance, the skill-side claim `engine entry gate: dirty → BLOCKED` finally made
|
|
6
|
-
// real), then the in-flight gate, the plan
|
|
7
|
-
// §3
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
//
|
|
6
|
+
// real), then the in-flight gate, the plan read's own structure refusal (the
|
|
7
|
+
// un-gated plan-carrier leg, P35 §2.3), the graph validate, the plan/ledger
|
|
8
|
+
// structure gate (`plan-ledger`, P21 §3.1/§6.4) and the doc-side gate
|
|
9
|
+
// (Contract.validate over the target doc). The dispatch's own phase — the wave
|
|
10
|
+
// face's gate and the doc/branch line's — is NOT judged here: it belongs to the ONE
|
|
11
|
+
// dispatch authority (`session/dispatch-authority.ts`, P27 §2), the seam's single
|
|
12
|
+
// consumer.
|
|
11
13
|
//
|
|
12
14
|
// Gate order (the design's pinned sequence, judgeable on every verdict):
|
|
13
|
-
// tree-clean → in-flight → graph → plan-ledger →
|
|
15
|
+
// tree-clean → in-flight → plan-carrier → graph → plan-ledger →
|
|
14
16
|
// (spec/plan faces) Contract.validate → dispatch
|
|
17
|
+
// The plan-carrier leg is the readable plan's OWN refusal (P35 §2.3): an UN-GATED
|
|
18
|
+
// judgment over `ctx.plan` — not a row of the doc-shape block — so the wave face
|
|
19
|
+
// (no doc target, `ctx.doc === null`) is judged too. It speaks the existing
|
|
20
|
+
// `doc-contract` gate id and reason token, so no token joins the table.
|
|
15
21
|
// The evidence/read-back gates stay at the dispatch child face (the seam never
|
|
16
22
|
// touches the round's produced artifacts — non-pre-flight by design).
|
|
17
23
|
//
|
|
@@ -25,7 +31,6 @@
|
|
|
25
31
|
//
|
|
26
32
|
// Module-level exports are types / the class — zero behavior-carrying bare
|
|
27
33
|
// functions (the plan's zero-bare-function discipline).
|
|
28
|
-
import { PlanDocType } from "../contract/doc.js";
|
|
29
34
|
import { FrontMatterExtractor } from "../contract/frontmatter.js";
|
|
30
35
|
import { LedgerTaskSetRule, NodeFs } from "../contract/invariants.js";
|
|
31
36
|
import { Contract } from "../contract/judge.js";
|
|
@@ -55,9 +60,9 @@ export class PreFlight {
|
|
|
55
60
|
this.#words = opts.words;
|
|
56
61
|
this.#fs = opts.fs ?? new NodeFs();
|
|
57
62
|
}
|
|
58
|
-
/** vet(ctx) — the single seam call: tree-clean → in-flight →
|
|
59
|
-
* → doc-contract. The first refused gate owns the verdict; the gates
|
|
60
|
-
* precede it (the judgeable order). */
|
|
63
|
+
/** vet(ctx) — the single seam call: tree-clean → in-flight → plan-carrier → graph
|
|
64
|
+
* → plan-ledger → doc-contract. The first refused gate owns the verdict; the gates
|
|
65
|
+
* that ran precede it (the judgeable order). */
|
|
61
66
|
async vet(ctx) {
|
|
62
67
|
const gates = [];
|
|
63
68
|
const checked = [];
|
|
@@ -89,24 +94,47 @@ export class PreFlight {
|
|
|
89
94
|
holding: inFlight,
|
|
90
95
|
}, gates, checked, this.#docOutcomeOf(ctx), { kind: "no-ledger-facts" });
|
|
91
96
|
}
|
|
92
|
-
// 3.
|
|
97
|
+
// 3. plan-carrier — the plan READ's own structure judgment (P35 §2.3): every face
|
|
98
|
+
// that carries a plan read (wave / plan / branch) asks the value whether the
|
|
99
|
+
// document it read may be dispatched. The source is `ctx.plan`, never `ctx.doc`
|
|
100
|
+
// — the wave face reaches this point with no doc target at all. The `io` cause
|
|
101
|
+
// never asks this leg: the scene stops at the usage seam before any workspace
|
|
102
|
+
// key exists, so only `syntax` and the `spec-absent` orphan arrive here.
|
|
103
|
+
if (ctx.type === "wave" || ctx.type === "plan" || ctx.type === "branch") {
|
|
104
|
+
const refusal = ctx.plan.refusal(this.#words);
|
|
105
|
+
if (refusal !== null) {
|
|
106
|
+
// The plan face's own gate set already holds `doc-contract`, so its refusal
|
|
107
|
+
// accounts for the gate it PLANNED to run; the wave / branch faces never
|
|
108
|
+
// planned it and must not claim they did.
|
|
109
|
+
if (ctx.type === "plan") {
|
|
110
|
+
gates.push("doc-contract");
|
|
111
|
+
checked.push("doc-contract");
|
|
112
|
+
}
|
|
113
|
+
return this.#refusal({ ok: false, gate: refusal.gate, reason: refusal.reason, message: refusal.message }, gates, checked, this.#docOutcomeOf(ctx), { kind: "no-ledger-facts" });
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
// 4. graph — the wave/plan faces' structural gate, on a READY plan only: a
|
|
117
|
+
// non-ready read never enters the gate plan, so the row is neither pushed nor
|
|
118
|
+
// reported (`checked`'s byte set stays the healthy one).
|
|
93
119
|
let graph = null;
|
|
94
|
-
if ((ctx.type === "wave" || ctx.type === "plan") && ctx.
|
|
120
|
+
if ((ctx.type === "wave" || ctx.type === "plan") && ctx.plan.kind === "ready") {
|
|
95
121
|
gates.push("graph");
|
|
96
122
|
checked.push("graph");
|
|
97
|
-
graph =
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
123
|
+
graph = ctx.plan.graph();
|
|
124
|
+
if (graph !== null) {
|
|
125
|
+
const issues = graph.validate();
|
|
126
|
+
if (issues.length > 0) {
|
|
127
|
+
return this.#refusal({
|
|
128
|
+
ok: false,
|
|
129
|
+
gate: "graph",
|
|
130
|
+
reason: "graph",
|
|
131
|
+
message: this.#words.preflightWords().graph.replace("{count}", String(issues.length)),
|
|
132
|
+
details: issues.map((issue) => `${issue.kind}@T${issue.task}: ${issue.message}`),
|
|
133
|
+
}, gates, checked, this.#docOutcomeOf(ctx), { kind: "no-ledger-facts" });
|
|
134
|
+
}
|
|
107
135
|
}
|
|
108
136
|
}
|
|
109
|
-
//
|
|
137
|
+
// 5. plan-ledger — the ledger-scope rules (P21 §3.1/§6.4). Plan / wave / branch
|
|
110
138
|
// dispatches run it; the doc-scope rules never do (two scopes, two entries).
|
|
111
139
|
// A missing fact bundle is NOT a refusal: the rows render `skipped`.
|
|
112
140
|
let ledgerOutcome = { kind: "no-ledger-facts" };
|
|
@@ -133,7 +161,7 @@ export class PreFlight {
|
|
|
133
161
|
}
|
|
134
162
|
}
|
|
135
163
|
}
|
|
136
|
-
//
|
|
164
|
+
// 6. doc-contract — the doc shapes' structural gate (the doc-scope rules).
|
|
137
165
|
// The four document shapes (`phase-spec` · `overall` · `plan` · `single-spec`)
|
|
138
166
|
// are judged by the SAME gate: the document's declared `doc-type:` picks the
|
|
139
167
|
// contract, never the command's `--type` spelling.
|
|
@@ -308,26 +336,29 @@ export class PreFlight {
|
|
|
308
336
|
}
|
|
309
337
|
return rows;
|
|
310
338
|
}
|
|
311
|
-
/** The ledger fact bundle of one dispatch — built from the ledger, the plan
|
|
312
|
-
* and the plan's topological layers. Null when either fact source is absent
|
|
313
|
-
*
|
|
339
|
+
/** The ledger fact bundle of one dispatch — built from the ledger, the plan read
|
|
340
|
+
* and the plan's topological layers. Null when either fact source is absent (the
|
|
341
|
+
* gate then renders `skipped (no ledger facts)`). */
|
|
314
342
|
#ledgerFactsOf(ctx, graph) {
|
|
315
343
|
const ledger = ctx.ledger;
|
|
316
|
-
|
|
344
|
+
const doc = ctx.plan.doc();
|
|
345
|
+
if (ledger === null || doc === null)
|
|
317
346
|
return null;
|
|
318
|
-
const
|
|
319
|
-
const
|
|
320
|
-
const layers = (graph ?? new TaskGraph(parsed)).batches();
|
|
347
|
+
const planTasks = doc.taskBlocks.map((block) => block.id);
|
|
348
|
+
const layers = (graph ?? ctx.plan.graph() ?? new TaskGraph(doc)).batches();
|
|
321
349
|
const data = ledger.readProgress();
|
|
322
350
|
const recorded = this.#recordedTasksOf(data);
|
|
323
351
|
const closed = ledger.closedWaves();
|
|
324
|
-
const
|
|
352
|
+
const waves = (data?.waves ?? [])
|
|
325
353
|
.map((row) => this.#taskIdsOf(row.wave))
|
|
326
|
-
.filter((ids) => ids.length > 0
|
|
354
|
+
.filter((ids) => ids.length > 0);
|
|
355
|
+
const closedWaves = waves.filter((ids) => ids.every((id) => closed.has(id)));
|
|
356
|
+
const openWaves = waves.filter((ids) => ids.some((id) => !closed.has(id)));
|
|
327
357
|
return {
|
|
328
358
|
planTasks,
|
|
329
359
|
recordedTasks: recorded,
|
|
330
360
|
closedWaves,
|
|
361
|
+
openWaves,
|
|
331
362
|
// The wave rows' closure-time plan-task snapshots (P21 §5.1) — read from the
|
|
332
363
|
// SAME ledger face the wave gate's append judgment reads (zero second source).
|
|
333
364
|
snapshots: this.#snapshotsOf(data),
|
|
@@ -381,7 +412,7 @@ export class PreFlight {
|
|
|
381
412
|
return {
|
|
382
413
|
docKey: "plan",
|
|
383
414
|
path: ctx.doc?.path ?? "",
|
|
384
|
-
content: ctx.
|
|
415
|
+
content: ctx.plan.text() ?? "",
|
|
385
416
|
root: ctx.repoRoot,
|
|
386
417
|
fs: this.#fs,
|
|
387
418
|
};
|
|
@@ -1,54 +1,120 @@
|
|
|
1
1
|
// packages/cdd-engine/src-next/session/round-naming.ts
|
|
2
|
-
//
|
|
3
|
-
// (report ·
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
// (the naming table is the single truth, never a second list); the FINAL name (P31
|
|
7
|
-
// §2.3) is that name with its suffix swapped, so the rule runs on the filled name.
|
|
2
|
+
// P34 T1 — the naming single source: ONE round identity renders every artifact name
|
|
3
|
+
// (draft · final · report · log · crash · evidence) through `renderName`, so a kind's
|
|
4
|
+
// spelling and its siblings' can never drift, and the reverse attribution
|
|
5
|
+
// (`Ledger#handoffOwner`) parses back exactly the identity this face renders.
|
|
8
6
|
//
|
|
9
|
-
//
|
|
7
|
+
// The identity is a triple: the LINE (`tasks-{tasks}` · `branch` · the doc word), the
|
|
8
|
+
// OP (`implement` · `review` · `fix` — branch-review rides the review family), the
|
|
9
|
+
// CYCLE and the ATTEMPT. Every kind shares one stem, so the carrier's draft, its
|
|
10
|
+
// final beside it, the round's report, log, crash record and test-evidence file all
|
|
11
|
+
// name the same round. The attempt rides the stem as `-a{n}` and is omitted on the
|
|
12
|
+
// first attempt; a cycle-less identity (an inferred params with no round) omits the
|
|
13
|
+
// cycle segment too, never a `-undefined` token.
|
|
14
|
+
//
|
|
15
|
+
// Module-level exports are types / the class — zero behavior-carrying bare functions.
|
|
16
|
+
// One module-level value: the compiled carrier predicate below (`CARRIER`).
|
|
17
|
+
var _a;
|
|
10
18
|
import { TargetFaceTable, targetFaces } from "./faces.js";
|
|
19
|
+
/** The two carrier-name shapes this engine MINTS — the draft and its final twin.
|
|
20
|
+
* Both accept the `-a{n}` attempt segment and the final's `.c{cycle}` suffix; every
|
|
21
|
+
* other artifact (report · log · crash · evidence) is deliberately outside the
|
|
22
|
+
* predicate, so the seal sweep can never touch it. The legacy cycle-less implement
|
|
23
|
+
* spelling (`tasks-{tasks}-implement.json`) stays accepted for the drafts a
|
|
24
|
+
* pre-P34 engine left on disk.
|
|
25
|
+
*
|
|
26
|
+
* Module scope, not a `static readonly #CARRIER` field: tsc down-levels a static
|
|
27
|
+
* field initializer that reads the class's own private static member into a temp
|
|
28
|
+
* (`static #CARRIER = _a.#carrierPattern()`) assigned only AFTER the class body, so
|
|
29
|
+
* the module threw `Receiver must be class RoundNaming` at import. Reading a plain
|
|
30
|
+
* const keeps the pattern out of that transform's reach.
|
|
31
|
+
*
|
|
32
|
+
* A wave line takes the wave-only `tasks-` spine, every other line word takes the
|
|
33
|
+
* round-bearing ops; the op set and the line words come from the ONE target-face
|
|
34
|
+
* table, so neither is re-spelled here. The `.c{cycle}` final suffix hangs off the
|
|
35
|
+
* CYCLE-BEARING alternatives alone — a cycle-less identity has no cycle to suffix, so
|
|
36
|
+
* `tasks-1-implement.c1.json` is a shape the renderer can never mint. */
|
|
37
|
+
const carrierPattern = () => {
|
|
38
|
+
const lines = Object.keys(targetFaces).filter((word) => word !== "wave");
|
|
39
|
+
const attempt = "(?:-a\\d+)?";
|
|
40
|
+
const final = "(?:\\.c\\d+)?";
|
|
41
|
+
const cycleBearing = [
|
|
42
|
+
"tasks-.+?-implement-\\d+",
|
|
43
|
+
"tasks-.+?-(?:review|fix)-\\d+",
|
|
44
|
+
`(?:${lines.join("|")})-(?:review|fix)-\\d+`,
|
|
45
|
+
].join("|");
|
|
46
|
+
// The legacy cycle-less implement draft: a draft on disk, never a final and never
|
|
47
|
+
// an attempt — this engine mints neither on a cycle-less identity.
|
|
48
|
+
const legacy = "tasks-.+?-implement";
|
|
49
|
+
return new RegExp(`^(?:(?:${cycleBearing})${attempt}${final}|${legacy})\\.json$`);
|
|
50
|
+
};
|
|
51
|
+
const CARRIER = carrierPattern();
|
|
11
52
|
/**
|
|
12
53
|
* RoundNaming — the one home of a round's prescribed artifact names. A frame's
|
|
13
|
-
* report / evidence /
|
|
14
|
-
* write-back and read-back, the
|
|
15
|
-
* artifacts by the same rule — one fact, one
|
|
16
|
-
* workspace the names resolve against.
|
|
54
|
+
* report / log / crash / evidence / carrier names derive here, so every consumer
|
|
55
|
+
* (the lifecycle's write-back and read-back, the ledger's carrier persist, the dry-run
|
|
56
|
+
* preview, the seal sweep) names the same artifacts by the same rule — one fact, one
|
|
57
|
+
* place. The class holds only the workspace the names resolve against.
|
|
17
58
|
*/
|
|
18
59
|
export class RoundNaming {
|
|
19
60
|
#workspace;
|
|
20
61
|
constructor(workspace) {
|
|
21
62
|
this.#workspace = workspace;
|
|
22
63
|
}
|
|
23
|
-
/** The
|
|
24
|
-
* (`
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
64
|
+
/** The identity of one (op, type, params) triple — the ONE adapter from the
|
|
65
|
+
* params-carrying surface (`Ledger#handoffName`, the seal legs) onto the renderer. */
|
|
66
|
+
static artifactOf(op, type, params) {
|
|
67
|
+
return {
|
|
68
|
+
line: _a.lineOf(type, params),
|
|
69
|
+
op,
|
|
70
|
+
cycle: params.round,
|
|
71
|
+
attempt: params.attempt,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
/** The line word of a (type, params) pair — the wave line's `tasks-{tasks}` spine,
|
|
75
|
+
* every other type its own word. */
|
|
76
|
+
static lineOf(type, params) {
|
|
77
|
+
return type === "wave" ? `tasks-${params.tasks ?? ""}` : type;
|
|
78
|
+
}
|
|
79
|
+
/** Render one round identity as one artifact name — the ONE naming rule. The four
|
|
80
|
+
* segments (`line` · `op` · cycle · attempt) join in this order for every kind, so
|
|
81
|
+
* a kind only picks its own prefix/suffix around the shared stem. A `final` has no
|
|
82
|
+
* cycle to key on when the identity carries none: it renders the draft name back,
|
|
83
|
+
* never a malformed `.cundefined` suffix. The stem's cycle segment is omitted for a
|
|
84
|
+
* cycle-less identity; its attempt segment is omitted on the first attempt (an
|
|
85
|
+
* `-a1` never appears). */
|
|
86
|
+
static renderName(artifact, kind) {
|
|
87
|
+
const cycle = artifact.cycle === undefined || artifact.cycle === "" ? "" : `-${artifact.cycle}`;
|
|
88
|
+
const attempt = artifact.attempt === undefined || artifact.attempt <= 1 ? "" : `-a${artifact.attempt}`;
|
|
89
|
+
const stem = `${artifact.line}-${artifact.op}${cycle}${attempt}`;
|
|
90
|
+
switch (kind) {
|
|
91
|
+
case "draft":
|
|
92
|
+
return `${stem}.json`;
|
|
93
|
+
case "final":
|
|
94
|
+
return artifact.cycle === undefined || artifact.cycle === ""
|
|
95
|
+
? `${stem}.json`
|
|
96
|
+
: `${stem}.c${artifact.cycle}.json`;
|
|
97
|
+
case "report":
|
|
98
|
+
return `${stem}-report.md`;
|
|
99
|
+
case "log":
|
|
100
|
+
return `${stem}.log`;
|
|
101
|
+
case "crash":
|
|
102
|
+
return `crash-${stem}.json`;
|
|
103
|
+
case "evidence":
|
|
104
|
+
return `${stem}-test-evidence.json`;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
/** The carrier-name predicate's compiled pattern — a wave line takes the wave-only
|
|
108
|
+
* `tasks-` spine, every other line word takes the round-bearing ops. The op set and
|
|
109
|
+
* the line words come from the ONE target-face table, so neither is re-spelled here.
|
|
110
|
+
* Only `implement` has a cycle-less spelling (the pre-P34 draft on disk); `review`
|
|
111
|
+
* and `fix` always carry their cycle, so a `tasks-1-review.json` is no carrier at all.
|
|
112
|
+
* The `.c{cycle}` final suffix hangs off the CYCLE-BEARING alternatives alone — a
|
|
113
|
+
* cycle-less identity has no cycle to suffix, so `tasks-1-implement.c1.json` is a
|
|
114
|
+
* shape the renderer can never mint. */
|
|
115
|
+
/** The rendered name resolved against the workspace — the read/write syscall form. */
|
|
116
|
+
renderPath(artifact, kind) {
|
|
117
|
+
return this.#workspace.resolve(_a.renderName(artifact, kind));
|
|
52
118
|
}
|
|
53
119
|
/** Whether a workspace file name is one of the two carrier shapes this engine mints.
|
|
54
120
|
* Every neighbouring artifact — `progress.json` · `base.json` · the test-evidence
|
|
@@ -57,17 +123,18 @@ export class RoundNaming {
|
|
|
57
123
|
* judgment reads a NAME and nothing else, so the seal sweep (`CarrierSeal`) applies
|
|
58
124
|
* the same predicate without holding a workspace. */
|
|
59
125
|
static isCarrierName(name) {
|
|
60
|
-
return
|
|
126
|
+
return CARRIER.test(name);
|
|
61
127
|
}
|
|
62
128
|
/** The handoff-family op of a frame — branch-review rides the review family. The
|
|
63
|
-
* artifact
|
|
129
|
+
* artifact names embed this op, so the mapping is a naming fact owned here (the
|
|
64
130
|
* lifecycle's op read delegates, never a second copy of the rule). */
|
|
65
131
|
op(frame) {
|
|
66
132
|
return frame.phase === "branch-review" ? "review" : frame.phase;
|
|
67
133
|
}
|
|
68
134
|
/** The engine-rendered brief path of a wave's task group —
|
|
69
135
|
* `tasks-{tasks}-brief.md` (the implement dispatch's read input; its producer is
|
|
70
|
-
* `CliGate#renderBrief`).
|
|
136
|
+
* `CliGate#renderBrief`). The brief is the dispatch's INPUT, not a round artifact:
|
|
137
|
+
* it carries no cycle or attempt. */
|
|
71
138
|
brief(tasks) {
|
|
72
139
|
return this.#workspace.resolve(this.briefName(tasks));
|
|
73
140
|
}
|
|
@@ -76,13 +143,9 @@ export class RoundNaming {
|
|
|
76
143
|
briefName(tasks) {
|
|
77
144
|
return `tasks-${tasks}-brief.md`;
|
|
78
145
|
}
|
|
79
|
-
/** The prescribed report path of a round — the
|
|
80
|
-
* `{type}-{op}-{round}-report.md` stem, the wave/branch line's
|
|
81
|
-
* `{family}-{op}{-round}-report.md` (the implement round carries no round token:
|
|
82
|
-
* the line keys the implement round alone). */
|
|
146
|
+
/** The prescribed report path of a round — the shared stem with `-report.md`. */
|
|
83
147
|
report(frame) {
|
|
84
|
-
|
|
85
|
-
return this.#workspace.resolve(`${this.#stem(this.op(frame), frame.type, params)}-report.md`);
|
|
148
|
+
return this.renderPath(this.#artifact(frame), "report");
|
|
86
149
|
}
|
|
87
150
|
/** The prescribed test-evidence path of a round — "" off the evidence rounds (the doc
|
|
88
151
|
* lines and the review rounds prescribe no evidence file). */
|
|
@@ -90,23 +153,15 @@ export class RoundNaming {
|
|
|
90
153
|
const name = this.evidenceName(frame);
|
|
91
154
|
return name === "" ? "" : this.#workspace.resolve(name);
|
|
92
155
|
}
|
|
93
|
-
/** The test-evidence file NAME of a work frame — the
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
* — the doc shapes (phase-spec · overall · plan · single-spec) prescribe none. */
|
|
156
|
+
/** The test-evidence file NAME of a work frame — the shared stem with
|
|
157
|
+
* `-test-evidence.json`. "" off the evidence rounds — the doc shapes (phase-spec ·
|
|
158
|
+
* overall · plan · single-spec) and the review phase prescribe none. */
|
|
97
159
|
evidenceName(frame) {
|
|
98
160
|
if (TargetFaceTable.isDocShape(frame.type))
|
|
99
161
|
return "";
|
|
100
162
|
if (frame.phase !== "implement" && frame.phase !== "fix")
|
|
101
163
|
return "";
|
|
102
|
-
|
|
103
|
-
const line = key === "" ? this.prefix(frame) : `${this.prefix(frame)}-${key}`;
|
|
104
|
-
return `${line}-test-evidence.json`;
|
|
105
|
-
}
|
|
106
|
-
/** The evidence file's family prefix — `tasks` for the wave families, `branch`
|
|
107
|
-
* for the branch line (never the misleading tasks- spine). */
|
|
108
|
-
prefix(frame) {
|
|
109
|
-
return frame.type === "wave" ? "tasks" : "branch";
|
|
164
|
+
return _a.renderName(this.#artifact(frame), "evidence");
|
|
110
165
|
}
|
|
111
166
|
/** The attempt number a dispatch of one op/cycle would take — the max attempt
|
|
112
167
|
* already on record for that identity plus one (1 when the cycle was never
|
|
@@ -121,41 +176,35 @@ export class RoundNaming {
|
|
|
121
176
|
}
|
|
122
177
|
return latest + 1;
|
|
123
178
|
}
|
|
124
|
-
/** The per-round log file NAME of a round — the
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
-
*
|
|
179
|
+
/** The per-round log file NAME of a round — the shared stem with `.log`, carrying
|
|
180
|
+
* `-a{attempt}` when the dispatch is a re-attempt (so attempt 1's log is never
|
|
181
|
+
* overwritten). The attempt is allocated by `attemptOf` and passed in, never
|
|
182
|
+
* extrapolated here. */
|
|
128
183
|
logName(op, type, params, attempt) {
|
|
129
|
-
const
|
|
130
|
-
return
|
|
131
|
-
}
|
|
132
|
-
/** The
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
* the round-less family), so the report and its log can never diverge. */
|
|
136
|
-
#stem(op, type, params) {
|
|
137
|
-
if (TargetFaceTable.isDocShape(type))
|
|
138
|
-
return `${type}-${op}-${params.round}`;
|
|
139
|
-
const family = type === "wave" ? `tasks-${params.tasks ?? ""}` : "branch";
|
|
140
|
-
const suffix = op === "implement" ? "" : `-${params.round}`;
|
|
141
|
-
return `${family}-${op}${suffix}`;
|
|
142
|
-
}
|
|
143
|
-
/** The crash record's workspace-relative name — `crash-{line}-{op}-{round}.json`.
|
|
144
|
-
* The `line` derives from the frame's ONE identity (wave → `tasks-{tasks}`;
|
|
145
|
-
* branch / the doc shapes → the line-type constant), the `op` keeps the verb
|
|
146
|
-
* (`RoundNaming.op`: branch-review rides the review family) — so a wave's
|
|
147
|
-
* implement-2 and review-2 crash records never overwrite each other. */
|
|
184
|
+
const artifact = _a.artifactOf(op, type, { ...params, attempt });
|
|
185
|
+
return _a.renderName(artifact, "log");
|
|
186
|
+
}
|
|
187
|
+
/** The crash record's workspace-relative name — the shared stem with its own
|
|
188
|
+
* `crash-` prefix, so a wave's implement and review round crash records never
|
|
189
|
+
* overwrite each other. */
|
|
148
190
|
crashName(frame) {
|
|
149
|
-
return
|
|
191
|
+
return _a.renderName(this.#artifact(frame), "crash");
|
|
150
192
|
}
|
|
151
193
|
/** The crash record's on-disk path — the same derivation as `crashName` (one
|
|
152
194
|
* name, one rule; the read and write faces agree by construction). */
|
|
153
195
|
crashPath(frame) {
|
|
154
196
|
return this.#workspace.resolve(this.crashName(frame));
|
|
155
197
|
}
|
|
156
|
-
/** A frame's
|
|
157
|
-
*
|
|
158
|
-
|
|
159
|
-
|
|
198
|
+
/** A frame's naming identity — the ONE adapter from the frame onto the renderer.
|
|
199
|
+
* `op` defaults to the frame's own (`op()`), and the attempt falls back to the
|
|
200
|
+
* params' cell so a caller that only carried it there still names its round. */
|
|
201
|
+
#artifact(frame, op = this.op(frame)) {
|
|
202
|
+
return {
|
|
203
|
+
line: _a.lineOf(frame.type, frame.params),
|
|
204
|
+
op,
|
|
205
|
+
cycle: frame.round,
|
|
206
|
+
attempt: frame.attempt ?? frame.params.attempt,
|
|
207
|
+
};
|
|
160
208
|
}
|
|
161
209
|
}
|
|
210
|
+
_a = RoundNaming;
|