@quolu/lattice 0.82.0 → 0.84.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/README.ja.md +7 -6
- package/README.md +1 -1
- package/bin/lattice-bridge-supervisor.mjs +10 -0
- package/bin/lattice-dashboard.mjs +3 -18
- package/bin/lattice-mcp.mjs +6 -3
- package/bin/lattice.mjs +30 -23
- package/docs/schemas/lattice.plan_create_input.v4.schema.json +5 -11
- package/docs/schemas/lattice.plan_create_input.v5.schema.json +362 -0
- package/docs/schemas/lattice.plan_revise_input.v1.schema.json +38 -11
- package/package.json +2 -1
- package/sensor/dist/db/index.d.ts +1 -0
- package/sensor/dist/db/index.d.ts.map +1 -1
- package/sensor/dist/db/index.js +13 -0
- package/sensor/dist/db/index.js.map +1 -1
- package/sensor/dist/index.d.ts.map +1 -1
- package/sensor/dist/index.js +12 -2
- package/sensor/dist/index.js.map +1 -1
- package/sensor/dist/mcp/answer-freshness.js +1 -1
- package/sensor/dist/mcp/answer-freshness.js.map +1 -1
- package/sensor/dist/mcp/daemon-paths.d.ts +6 -0
- package/sensor/dist/mcp/daemon-paths.d.ts.map +1 -1
- package/sensor/dist/mcp/daemon-paths.js +7 -1
- package/sensor/dist/mcp/daemon-paths.js.map +1 -1
- package/sensor/dist/mcp/engine.d.ts +11 -0
- package/sensor/dist/mcp/engine.d.ts.map +1 -1
- package/sensor/dist/mcp/engine.js +83 -4
- package/sensor/dist/mcp/engine.js.map +1 -1
- package/sensor/dist/mcp/index-repair.d.ts +7 -0
- package/sensor/dist/mcp/index-repair.d.ts.map +1 -0
- package/sensor/dist/mcp/index-repair.js +93 -0
- package/sensor/dist/mcp/index-repair.js.map +1 -0
- package/sensor/dist/mcp/index.d.ts.map +1 -1
- package/sensor/dist/mcp/index.js +12 -7
- package/sensor/dist/mcp/index.js.map +1 -1
- package/sensor/dist/mcp/tools.d.ts +4 -0
- package/sensor/dist/mcp/tools.d.ts.map +1 -1
- package/sensor/dist/mcp/tools.js +29 -9
- package/sensor/dist/mcp/tools.js.map +1 -1
- package/src/bridge-hub-server.mjs +46 -9
- package/src/cli-help.mjs +10 -8
- package/src/cli-refusal-guidance.mjs +354 -0
- package/src/dashboard-delivery.mjs +2 -1
- package/src/dashboard-lifecycle-journal.mjs +42 -20
- package/src/hooks-cli.mjs +30 -6
- package/src/plan-backchain.mjs +95 -41
- package/src/plan-revise.mjs +274 -72
- package/src/project-cli.mjs +301 -163
- package/src/project-identity.mjs +14 -0
- package/src/runtime-cli.mjs +38 -29
- package/src/runtime-control-store.mjs +22 -1
- package/src/runtime-decision-verifier.mjs +27 -8
- package/src/runtime-engine.mjs +34 -5
- package/src/runtime-hold-recompile.mjs +19 -15
- package/src/runtime-kept-worktree.mjs +136 -0
- package/src/runtime-lifecycle-lock.mjs +118 -30
- package/src/runtime-managed-supervisor.mjs +10 -10
- package/src/runtime-pull-intake.mjs +90 -44
- package/src/store-lock.mjs +142 -57
- package/src/todo-authoring-input.mjs +211 -2
- package/src/todo-cli.mjs +554 -200
- package/src/todo-contracts.mjs +22 -6
- package/src/todo-dashboard-registry.mjs +35 -6
- package/src/todo-gantt-display.mjs +259 -0
- package/src/todo-gantt-html-independence.mjs +10 -3
- package/src/todo-gantt-html-shared.mjs +16 -1
- package/src/todo-gantt-html.mjs +74 -53
- package/src/todo-gantt-layout.mjs +137 -59
- package/src/todo-gantt-live.mjs +6 -3
- package/src/todo-independence-guidance.mjs +4 -26
- package/src/todo-note-store.mjs +6 -3
- package/src/todo-readiness.mjs +83 -20
- package/src/todo-revision.mjs +156 -8
- package/src/todo-split.mjs +6 -3
- package/src/todo-status.mjs +141 -54
- package/src/todo-store-cache.mjs +1 -1
- package/src/todo-store-view.mjs +20 -2
- package/src/todo-store.mjs +562 -444
package/src/plan-backchain.mjs
CHANGED
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
readTodoStore, TodoStoreError,
|
|
12
12
|
} from './todo-store.mjs';
|
|
13
13
|
import { gitSync } from './git-process.mjs';
|
|
14
|
-
import { readAuthoringJsonFile } from './todo-authoring-input.mjs';
|
|
14
|
+
import { completeCreateInput, readAuthoringJsonFile } from './todo-authoring-input.mjs';
|
|
15
15
|
import {
|
|
16
16
|
explainPhaseTodoRevision, phaseTodoRevisionPlanVersion, validatePhaseTodoRevision,
|
|
17
17
|
} from './todo-revision.mjs';
|
|
@@ -101,9 +101,12 @@ export function validatePlanBackchain(chain, authoring) {
|
|
|
101
101
|
if (features.has(feature.feature_id)) fail('feature_duplicate', `/features/${index}/feature_id`);
|
|
102
102
|
features.set(feature.feature_id, feature);
|
|
103
103
|
}
|
|
104
|
+
// 意味の検査(u03p A85)は止めずにfindingsへ集める。形・digest・同一性の検査だけが拒否する。
|
|
105
|
+
const found = [];
|
|
106
|
+
const finding = (reason, pointer, detail = {}) => found.push({ reason, pointer, ...detail });
|
|
104
107
|
for (const [index, feature] of chain.features.entries()) {
|
|
105
108
|
for (const id of feature.requires_feature_ids) {
|
|
106
|
-
if (!features.has(id))
|
|
109
|
+
if (!features.has(id)) finding('required_feature_missing', `/features/${index}/requires_feature_ids`, {
|
|
107
110
|
feature_id: feature.feature_id, required_feature_id: id,
|
|
108
111
|
});
|
|
109
112
|
}
|
|
@@ -111,33 +114,44 @@ export function validatePlanBackchain(chain, authoring) {
|
|
|
111
114
|
const authored = registeredTasks(authoring);
|
|
112
115
|
if (chain.project_id !== authoring.project_id || chain.plan_key !== authoring.plan_key
|
|
113
116
|
|| chain.plan_version !== authoring.plan_version) fail('authoring_identity_mismatch', '/authoring_ref');
|
|
114
|
-
if (!Array.isArray(chain.tasks)
|
|
115
|
-
fail('task_coverage_missing', '/tasks');
|
|
116
|
-
}
|
|
117
|
+
if (!Array.isArray(chain.tasks)) fail('tasks_invalid', '/tasks');
|
|
117
118
|
const authoredIds = new Set(authored.map(({ task_id: id }) => id));
|
|
118
119
|
const taskMap = new Map();
|
|
119
120
|
for (const [index, task] of chain.tasks.entries()) {
|
|
120
121
|
if (!exactRecord(task, ['task_id', 'requires_feature_ids', 'provides_feature_ids'])
|
|
121
|
-
|| !isTodoIdentifier(task.task_id) || !
|
|
122
|
-
|| !identifiers(task.
|
|
123
|
-
|| !identifiers(task.provides_feature_ids, { nonempty: true })) {
|
|
122
|
+
|| !isTodoIdentifier(task.task_id) || !identifiers(task.requires_feature_ids)
|
|
123
|
+
|| !identifiers(task.provides_feature_ids)) {
|
|
124
124
|
fail('task_invalid', `/tasks/${index}`);
|
|
125
125
|
}
|
|
126
|
-
if (
|
|
126
|
+
if (!authoredIds.has(task.task_id)) {
|
|
127
|
+
finding('task_invalid', `/tasks/${index}`, { task_id: task.task_id, cause: 'task_not_authored' });
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
if (task.provides_feature_ids.length === 0) {
|
|
131
|
+
finding('task_invalid', `/tasks/${index}`, { task_id: task.task_id, cause: 'provides_empty' });
|
|
132
|
+
}
|
|
133
|
+
if (taskMap.has(task.task_id)) {
|
|
134
|
+
finding('task_duplicate', `/tasks/${index}/task_id`, { task_id: task.task_id });
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
127
137
|
taskMap.set(task.task_id, task);
|
|
128
138
|
}
|
|
139
|
+
for (const id of [...authoredIds].filter((candidate) => !taskMap.has(candidate))) {
|
|
140
|
+
finding('task_coverage_missing', '/tasks', { task_id: id });
|
|
141
|
+
}
|
|
129
142
|
for (const [index, task] of chain.tasks.entries()) {
|
|
143
|
+
if (taskMap.get(task.task_id) !== task) continue;
|
|
130
144
|
for (const id of task.provides_feature_ids) {
|
|
131
145
|
const feature = features.get(id);
|
|
132
146
|
if (feature?.provider.kind !== 'task' || feature.provider.task_id !== task.task_id) {
|
|
133
|
-
|
|
147
|
+
finding('task_output_provider_mismatch', `/tasks/${index}/provides_feature_ids`, { feature_id: id });
|
|
134
148
|
}
|
|
135
149
|
}
|
|
136
150
|
const supplied = new Set(task.provides_feature_ids);
|
|
137
151
|
const needed = [...new Set(task.provides_feature_ids.flatMap((id) =>
|
|
138
|
-
features.get(id)
|
|
152
|
+
(features.get(id)?.requires_feature_ids ?? []).filter((required) => !supplied.has(required))))];
|
|
139
153
|
if (needed.some((id) => !task.requires_feature_ids.includes(id))) {
|
|
140
|
-
|
|
154
|
+
finding('task_inputs_incomplete', `/tasks/${index}/requires_feature_ids`, {
|
|
141
155
|
expected: needed.sort(), actual: task.requires_feature_ids,
|
|
142
156
|
});
|
|
143
157
|
}
|
|
@@ -146,7 +160,7 @@ export function validatePlanBackchain(chain, authoring) {
|
|
|
146
160
|
if (feature.provider.kind !== 'task') continue;
|
|
147
161
|
const task = taskMap.get(feature.provider.task_id);
|
|
148
162
|
if (task === undefined || !task.provides_feature_ids.includes(feature.feature_id)) {
|
|
149
|
-
|
|
163
|
+
finding('feature_provider_missing', `/features/${feature.feature_id}/provider`, {
|
|
150
164
|
feature_id: feature.feature_id,
|
|
151
165
|
});
|
|
152
166
|
}
|
|
@@ -154,42 +168,61 @@ export function validatePlanBackchain(chain, authoring) {
|
|
|
154
168
|
const reached = new Set();
|
|
155
169
|
const visiting = new Set();
|
|
156
170
|
const visit = (id) => {
|
|
157
|
-
if (!features.has(id))
|
|
158
|
-
|
|
171
|
+
if (!features.has(id)) {
|
|
172
|
+
finding('required_feature_missing', '/goal/required_feature_ids', { feature_id: id });
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
if (visiting.has(id)) {
|
|
176
|
+
finding('feature_cycle', `/features/${id}/requires_feature_ids`);
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
159
179
|
if (reached.has(id)) return;
|
|
160
180
|
visiting.add(id);
|
|
161
181
|
const feature = features.get(id);
|
|
162
182
|
for (const required of feature.requires_feature_ids) visit(required);
|
|
163
183
|
if (feature.provider.kind === 'task') {
|
|
164
|
-
for (const required of taskMap.get(feature.provider.task_id)
|
|
184
|
+
for (const required of taskMap.get(feature.provider.task_id)?.requires_feature_ids ?? []) visit(required);
|
|
165
185
|
}
|
|
166
186
|
visiting.delete(id);
|
|
167
187
|
reached.add(id);
|
|
168
188
|
};
|
|
169
189
|
for (const id of chain.goal.required_feature_ids) visit(id);
|
|
170
190
|
if (reached.size !== features.size) {
|
|
171
|
-
|
|
191
|
+
finding('orphan_feature', '/features', {
|
|
172
192
|
feature_ids: [...features.keys()].filter((id) => !reached.has(id)).sort(),
|
|
173
193
|
});
|
|
174
194
|
}
|
|
175
195
|
const edges = new Set(authoring.hard_dependencies.map(({ from, to }) =>
|
|
176
196
|
`${from.project_id}/${from.plan_key}/${from.task_id}->${to.project_id}/${to.plan_key}/${to.task_id}`));
|
|
177
197
|
for (const [index, task] of chain.tasks.entries()) {
|
|
198
|
+
if (taskMap.get(task.task_id) !== task) continue;
|
|
178
199
|
for (const id of task.requires_feature_ids) {
|
|
179
200
|
const feature = features.get(id);
|
|
180
|
-
if (feature === undefined)
|
|
181
|
-
feature_id: id
|
|
182
|
-
|
|
201
|
+
if (feature === undefined) {
|
|
202
|
+
finding('task_input_missing', `/tasks/${index}/requires_feature_ids`, { feature_id: id });
|
|
203
|
+
continue;
|
|
204
|
+
}
|
|
183
205
|
if (feature.provider.kind !== 'task') continue;
|
|
184
206
|
const sourceId = feature.provider.task_id;
|
|
185
|
-
if (sourceId === task.task_id)
|
|
207
|
+
if (sourceId === task.task_id) {
|
|
208
|
+
finding('task_requires_own_output', `/tasks/${index}/requires_feature_ids`);
|
|
209
|
+
continue;
|
|
210
|
+
}
|
|
186
211
|
const edge = `${chain.project_id}/${chain.plan_key}/${sourceId}->${chain.project_id}/${chain.plan_key}/${task.task_id}`;
|
|
187
|
-
if (!edges.has(edge))
|
|
212
|
+
if (!edges.has(edge)) finding('dependency_missing', `/tasks/${index}/requires_feature_ids`, {
|
|
188
213
|
feature_id: id, from_task_id: sourceId, to_task_id: task.task_id,
|
|
189
214
|
});
|
|
190
215
|
}
|
|
191
216
|
}
|
|
192
|
-
return { features, tasks: taskMap };
|
|
217
|
+
return { features, tasks: taskMap, findings: sortFindings(found) };
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/** 決定的な順序(pointer, reason, 正準JSON)で並べ、同一の指摘は1件にする。 */
|
|
221
|
+
function sortFindings(list) {
|
|
222
|
+
const keyed = new Map(list.map((entry) => [canonicalizeTodoArtifact(entry), entry]));
|
|
223
|
+
return [...keyed.entries()].sort(([left, a], [right, b]) =>
|
|
224
|
+
a.pointer.localeCompare(b.pointer) || a.reason.localeCompare(b.reason)
|
|
225
|
+
|| (left < right ? -1 : left > right ? 1 : 0)).map(([, entry]) => entry);
|
|
193
226
|
}
|
|
194
227
|
|
|
195
228
|
/** 作業者に下流の用途まで渡す。文の生成は入力済みの定義を転記するだけ。 */
|
|
@@ -204,6 +237,7 @@ export function backchainTaskMemo(chain, taskId) {
|
|
|
204
237
|
'必要とする機能:',
|
|
205
238
|
...task.requires_feature_ids.map((id) => {
|
|
206
239
|
const feature = features.get(id);
|
|
240
|
+
if (feature === undefined) return `- ${id}: (機能の定義が無い)`;
|
|
207
241
|
const provider = feature.provider.kind === 'task'
|
|
208
242
|
? `工程 ${feature.provider.task_id}`
|
|
209
243
|
: feature.provider.kind === 'existing'
|
|
@@ -214,6 +248,7 @@ export function backchainTaskMemo(chain, taskId) {
|
|
|
214
248
|
'作る機能:',
|
|
215
249
|
...task.provides_feature_ids.map((id) => {
|
|
216
250
|
const feature = features.get(id);
|
|
251
|
+
if (feature === undefined) return `- ${id}: (機能の定義が無い)`;
|
|
217
252
|
const consumers = chain.tasks.filter((other) => other.requires_feature_ids.includes(id))
|
|
218
253
|
.map(({ task_id: consumerId }) => consumerId).sort();
|
|
219
254
|
return `- ${id}: ${feature.capability}。受入条件: ${feature.acceptance}。後続: ${consumers.join(', ') || '最終成果'}`;
|
|
@@ -290,13 +325,13 @@ export async function readTaskBackchainContext({ repoRoot, plan, taskId }) {
|
|
|
290
325
|
const downstream = chain.tasks.filter((other) => other.task_id !== taskId
|
|
291
326
|
&& other.requires_feature_ids.some((id) => task.provides_feature_ids.includes(id)))
|
|
292
327
|
.map(({ task_id: id }) => id).sort();
|
|
293
|
-
const required = task.requires_feature_ids.map((id) => features.get(id));
|
|
328
|
+
const required = task.requires_feature_ids.map((id) => features.get(id)).filter(Boolean);
|
|
294
329
|
return {
|
|
295
330
|
schema: 'lattice.todo_feature_context.v1',
|
|
296
331
|
plan_key: chain.plan_key, plan_version: chain.plan_version,
|
|
297
332
|
goal: chain.goal,
|
|
298
333
|
requires: required,
|
|
299
|
-
provides: task.provides_feature_ids.map((id) => features.get(id)),
|
|
334
|
+
provides: task.provides_feature_ids.map((id) => features.get(id)).filter(Boolean),
|
|
300
335
|
downstream_task_ids: downstream,
|
|
301
336
|
unknown_feature_ids: required.filter(({ provider }) => provider.kind === 'unknown')
|
|
302
337
|
.map(({ feature_id: id }) => id),
|
|
@@ -342,11 +377,27 @@ async function verifyExistingFeatureReferences(repoRoot, chain) {
|
|
|
342
377
|
}
|
|
343
378
|
}
|
|
344
379
|
|
|
345
|
-
|
|
380
|
+
const DONE_CONDITION_PLAN_SCHEMA = 'lattice.todo_plan.v8';
|
|
381
|
+
|
|
382
|
+
/**
|
|
383
|
+
* authoring(create入力またはplan本体)から後継planの種を作る。
|
|
384
|
+
* 作る版: v5入力か先行planがv8ならv8(v8→v7へ戻さない)、それ以外はv7。
|
|
385
|
+
* v8でdone_conditionを書いていないtask(v4入力)は、先行planの同じtaskの値を引き継ぐ
|
|
386
|
+
* (書き換えも消去もしていないので意味を変えない)。新規taskはnull。
|
|
387
|
+
*/
|
|
388
|
+
export function planSeed(authoring, predecessorPlanDigest, predecessorPlan = null) {
|
|
389
|
+
const v8 = authoring.schema === 'lattice.plan_create_input.v5'
|
|
390
|
+
|| authoring.schema === DONE_CONDITION_PLAN_SCHEMA
|
|
391
|
+
|| predecessorPlan?.schema === DONE_CONDITION_PLAN_SCHEMA;
|
|
392
|
+
const inherited = new Map(predecessorPlan?.schema === DONE_CONDITION_PLAN_SCHEMA
|
|
393
|
+
? predecessorPlan.tasks.map(({ task_id: id, done_condition: value }) => [id, value]) : []);
|
|
346
394
|
return {
|
|
347
|
-
schema: 'lattice.todo_plan.v7', project_id: authoring.project_id,
|
|
395
|
+
schema: v8 ? DONE_CONDITION_PLAN_SCHEMA : 'lattice.todo_plan.v7', project_id: authoring.project_id,
|
|
348
396
|
plan_key: authoring.plan_key, predecessor_plan_digest: predecessorPlanDigest,
|
|
349
|
-
tasks: authoring.tasks
|
|
397
|
+
tasks: v8 ? authoring.tasks.map((task) => ({ ...task,
|
|
398
|
+
done_condition: Object.hasOwn(task, 'done_condition')
|
|
399
|
+
? task.done_condition : inherited.get(task.task_id) ?? null })) : authoring.tasks,
|
|
400
|
+
phases: authoring.phases,
|
|
350
401
|
hard_dependencies: authoring.hard_dependencies, joins: authoring.joins,
|
|
351
402
|
phase_accept_dependencies: authoring.phase_accept_dependencies,
|
|
352
403
|
};
|
|
@@ -364,7 +415,7 @@ function taskSignature(chain, taskId) {
|
|
|
364
415
|
return canonicalizeTodoArtifact({
|
|
365
416
|
requires_feature_ids: task.requires_feature_ids,
|
|
366
417
|
provides_feature_ids: task.provides_feature_ids,
|
|
367
|
-
features: ids.map((id) => byId.get(id)),
|
|
418
|
+
features: ids.map((id) => byId.get(id) ?? null),
|
|
368
419
|
});
|
|
369
420
|
}
|
|
370
421
|
|
|
@@ -433,8 +484,8 @@ export function compilePhaseMigration(previousPlan, desiredSeed, taskMigration)
|
|
|
433
484
|
];
|
|
434
485
|
}
|
|
435
486
|
|
|
436
|
-
async function compileBackchainRevision({ repoRoot, member, chain, authoring }) {
|
|
437
|
-
if (
|
|
487
|
+
export async function compileBackchainRevision({ repoRoot, member, chain, authoring }) {
|
|
488
|
+
if (!['lattice.todo_plan.v7', DONE_CONDITION_PLAN_SCHEMA].includes(member.plan.schema)) {
|
|
438
489
|
fail('predecessor_plan_schema_unsupported', '/plan_key', {
|
|
439
490
|
actual: member.plan.schema, next_action: 'author_a_new_backchain_plan',
|
|
440
491
|
});
|
|
@@ -447,7 +498,7 @@ async function compileBackchainRevision({ repoRoot, member, chain, authoring })
|
|
|
447
498
|
journal_head_digest: member.journal.events.at(-1).event_digest,
|
|
448
499
|
plan_version: member.plan.plan_version,
|
|
449
500
|
};
|
|
450
|
-
const seed = planSeed(amended, predecessor.plan_digest);
|
|
501
|
+
const seed = planSeed(amended, predecessor.plan_digest, member.plan);
|
|
451
502
|
const taskMigration = compileTaskMigration(member.plan, previousChain, seed, chain);
|
|
452
503
|
const phaseMigration = compilePhaseMigration(member.plan, seed, taskMigration);
|
|
453
504
|
const version = phaseTodoRevisionPlanVersion({
|
|
@@ -458,7 +509,7 @@ async function compileBackchainRevision({ repoRoot, member, chain, authoring })
|
|
|
458
509
|
const successorChain = { ...chain, plan_version: version, chain_digest: '' };
|
|
459
510
|
successorChain.chain_digest = todoSelfDigest(successorChain, 'chain_digest');
|
|
460
511
|
const desiredPlan = buildTodoPlan({ ...seed, plan_version: version });
|
|
461
|
-
validatePlanBackchain(successorChain, {
|
|
512
|
+
const { findings } = validatePlanBackchain(successorChain, {
|
|
462
513
|
schema: CREATE_SCHEMA, project_id: desiredPlan.project_id,
|
|
463
514
|
plan_key: desiredPlan.plan_key, plan_version: desiredPlan.plan_version,
|
|
464
515
|
tasks: desiredPlan.tasks, hard_dependencies: desiredPlan.hard_dependencies,
|
|
@@ -473,16 +524,17 @@ async function compileBackchainRevision({ repoRoot, member, chain, authoring })
|
|
|
473
524
|
if (!validatePhaseTodoRevision(revision)) {
|
|
474
525
|
fail('revision_invalid', '/revision', { diagnosis: explainPhaseTodoRevision(revision) });
|
|
475
526
|
}
|
|
476
|
-
return revision;
|
|
527
|
+
return { revision, findings };
|
|
477
528
|
}
|
|
478
529
|
|
|
479
530
|
async function activeIntentUnchanged({ repoRoot, member, chain, authoring }) {
|
|
480
|
-
if (
|
|
531
|
+
if (!['lattice.todo_plan.v7', DONE_CONDITION_PLAN_SCHEMA].includes(member.plan.schema)) return false;
|
|
481
532
|
const binding = await readPlanBackchainBinding({ repoRoot, plan: member.plan });
|
|
482
533
|
if (binding === null || featureGraphDigest(binding.chain) !== featureGraphDigest(chain)) return false;
|
|
483
534
|
const amended = attachBackchainMemos(chain, authoring, { previousChain: binding.chain });
|
|
484
|
-
|
|
485
|
-
|
|
535
|
+
const seed = planSeed(amended, null, member.plan);
|
|
536
|
+
return seed.schema === member.plan.schema && canonicalizeTodoArtifact({
|
|
537
|
+
tasks: seed.tasks, phases: amended.phases,
|
|
486
538
|
hard_dependencies: amended.hard_dependencies, joins: amended.joins,
|
|
487
539
|
phase_accept_dependencies: amended.phase_accept_dependencies,
|
|
488
540
|
}) === canonicalizeTodoArtifact({
|
|
@@ -521,10 +573,10 @@ export async function rebindCarriedWork({ repoRoot, planKey, env,
|
|
|
521
573
|
export async function runPlanBackchain({ cwd, inputRef, stdout, dryRun = false, env = process.env }) {
|
|
522
574
|
const repoRoot = gitRoot(cwd);
|
|
523
575
|
const chain = await readAuthoringJsonFile(repoRoot, inputRef, { invalidCode: 'PLAN_BACKCHAIN_INVALID' });
|
|
524
|
-
const authoring = await readAuthoringJsonFile(repoRoot, chain.authoring_ref, {
|
|
576
|
+
const authoring = completeCreateInput(await readAuthoringJsonFile(repoRoot, chain.authoring_ref, {
|
|
525
577
|
invalidCode: 'PLAN_BACKCHAIN_INVALID',
|
|
526
|
-
});
|
|
527
|
-
validatePlanBackchain(chain, authoring);
|
|
578
|
+
}), { env, now: new Date() });
|
|
579
|
+
const { findings: featureChainFindings } = validatePlanBackchain(chain, authoring);
|
|
528
580
|
await verifyExistingFeatureReferences(repoRoot, chain);
|
|
529
581
|
let member = null;
|
|
530
582
|
let store = null;
|
|
@@ -543,7 +595,7 @@ export async function runPlanBackchain({ cwd, inputRef, stdout, dryRun = false,
|
|
|
543
595
|
repoRoot, member, chain, authoring,
|
|
544
596
|
});
|
|
545
597
|
const revision = member === null || unchanged ? null
|
|
546
|
-
: await compileBackchainRevision({ repoRoot, member, chain, authoring });
|
|
598
|
+
: (await compileBackchainRevision({ repoRoot, member, chain, authoring })).revision;
|
|
547
599
|
const amended = revision === null ? attachBackchainMemos(chain, authoring) : null;
|
|
548
600
|
if (!unchanged && revision === null) {
|
|
549
601
|
try { buildTodoPlan({ ...planSeed(amended, null), plan_version: chain.plan_version }); }
|
|
@@ -561,6 +613,7 @@ export async function runPlanBackchain({ cwd, inputRef, stdout, dryRun = false,
|
|
|
561
613
|
operation: unchanged ? 'unchanged' : revision !== null ? 'revise'
|
|
562
614
|
: store === null ? 'create' : 'add',
|
|
563
615
|
task_migration: revision?.task_migration ?? null,
|
|
616
|
+
feature_chain_findings: featureChainFindings,
|
|
564
617
|
result_digest: '',
|
|
565
618
|
};
|
|
566
619
|
checked.result_digest = todoSelfDigest(checked, 'result_digest');
|
|
@@ -616,6 +669,7 @@ export async function runPlanBackchain({ cwd, inputRef, stdout, dryRun = false,
|
|
|
616
669
|
unknown_feature_ids: unknownFeatureIds,
|
|
617
670
|
chain_digest: effectiveChain.chain_digest, authoring_result: created,
|
|
618
671
|
rebound_task_ids: reboundTaskIds,
|
|
672
|
+
feature_chain_findings: featureChainFindings,
|
|
619
673
|
operation: unchanged ? 'unchanged' : revision !== null ? 'revise'
|
|
620
674
|
: store === null ? 'create' : 'add',
|
|
621
675
|
journal_head_digest: finalMember.journal.events.at(-1).event_digest,
|