@quolu/lattice 0.88.0 → 0.90.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 +5 -2
- package/README.md +7 -3
- package/package.json +1 -1
- package/src/cli-help.mjs +5 -0
- package/src/cli-refusal-guidance.mjs +11 -5
- package/src/todo-cli.mjs +165 -7
- package/src/todo-contracts.mjs +2 -0
- package/src/todo-independence-contracts.mjs +1 -1
- package/src/todo-independence-guidance.mjs +5 -0
- package/src/todo-notice-store.mjs +166 -0
- package/src/todo-notices.mjs +81 -0
- package/src/todo-readiness.mjs +18 -0
- package/src/todo-store-git-transaction.mjs +1 -0
- package/src/todo-store.mjs +90 -8
package/README.ja.md
CHANGED
|
@@ -156,12 +156,15 @@ lattice bridge status --json
|
|
|
156
156
|
## Release
|
|
157
157
|
|
|
158
158
|
Latticeのreleaseはこのrepoから行います。`package.json`と`CHANGELOG.md`を更新し、製品gateを通し、
|
|
159
|
-
release commitを既定branchへ着地・push
|
|
160
|
-
|
|
159
|
+
release commitを既定branchへ着地・pushします。そのpushでCIが成功すると`publish.yml`が自動で起動し、
|
|
160
|
+
試験済みの同じ木を検査の再実行なしで公開します(registryに未公開で`latest`より新しい版だけ)。
|
|
161
|
+
その後、同じ版の実installを確認します。`prepublishOnly`はdirty treeとremote既定branchへ未着地のcommitを
|
|
162
|
+
拒否します。`gh workflow run publish.yml`は、`main`先頭のCIが成功済みの時の手動再試行です。
|
|
161
163
|
|
|
162
164
|
```bash
|
|
163
165
|
npm run ci
|
|
164
166
|
npm run verify:release-commit
|
|
167
|
+
# 公開はCI成功後に自動で始まる。次は手動の再試行
|
|
165
168
|
gh workflow run publish.yml --repo kitepon/Lattice --ref main
|
|
166
169
|
npm install -g @quolu/lattice@<version>
|
|
167
170
|
lattice --version
|
package/README.md
CHANGED
|
@@ -324,13 +324,17 @@ AI登録の診断は`lattice setup status --json`。`--host <AI>`で対象を限
|
|
|
324
324
|
## Release
|
|
325
325
|
|
|
326
326
|
Maintainers release Lattice from this repository. Update `package.json` and `CHANGELOG.md`, pass the
|
|
327
|
-
product gate, land and push the release commit on the default branch
|
|
328
|
-
|
|
329
|
-
|
|
327
|
+
product gate, land and push the release commit on the default branch. When `CI` succeeds on that
|
|
328
|
+
push, `publish.yml` publishes the same tree without re-running the suite (only a version that is not on
|
|
329
|
+
the registry and newer than `latest`); then verify that version from the registry. `prepublishOnly`
|
|
330
|
+
rejects a dirty tree or a commit not landed on the remote default branch. `gh workflow run publish.yml`
|
|
331
|
+
remains the manual retry once `CI` is green on the `main` tip
|
|
332
|
+
([flow](https://github.com/kitepon/Lattice/blob/main/docs/architecture/dfd-release-publish.md)).
|
|
330
333
|
|
|
331
334
|
```bash
|
|
332
335
|
npm run ci
|
|
333
336
|
npm run verify:release-commit
|
|
337
|
+
# publication starts by itself after CI; this is the manual retry
|
|
334
338
|
gh workflow run publish.yml --repo kitepon/Lattice --ref main
|
|
335
339
|
npm install -g @quolu/lattice@<version>
|
|
336
340
|
lattice setup --json
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quolu/lattice",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.90.0",
|
|
4
4
|
"description": "Schedulability compiler for multi-agent development: observe real code boundaries, refactor the conflicting seam, recompile the plan for parallel execution",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Quo / クオ at kitepon.dev",
|
package/src/cli-help.mjs
CHANGED
|
@@ -87,6 +87,7 @@ Read commands:
|
|
|
87
87
|
status [--json]
|
|
88
88
|
show --plan <key> --task <id> --json # 個別ToDoと最新bounded note contextを追加操作なしで返す
|
|
89
89
|
note list --plan <key> [--task <id>] --json # note全履歴の診断面(通常read/startでは不要)
|
|
90
|
+
notice list [--lane <lane>] [--include-acked] [--json] # 着手できるようになった工程の知らせ(既定は未ackだけ。lane省略で全lane)
|
|
90
91
|
bindings [--plan <key>] [--json] # compile_binding付きTaskをTODO identityつきで投影する
|
|
91
92
|
display read [--json] # host表示用の工程表読取(lattice.todo_display_read_result.v1)。不整合でも断らずstateで返す
|
|
92
93
|
display source [--json] # 安い変更検知(lattice.todo_store_display_source.v1)。変わった時だけreadする
|
|
@@ -101,6 +102,7 @@ Read commands:
|
|
|
101
102
|
phase status --plan <key> [--json]
|
|
102
103
|
|
|
103
104
|
Write commands:
|
|
105
|
+
notice ack --lane <lane> --notice <id>[,<id>...] [--json] # 届けた知らせに印を付ける(閉じた知らせはclosedで返す)
|
|
104
106
|
repair-eol --json # Git checkoutでCRLF化された既存storeをcanonical LFへ戻し、EOL保護を追加する
|
|
105
107
|
dashboard adopt --json # 衝突したproject_idの配信元rootを現在repoへ明示的に移す
|
|
106
108
|
dashboard ensure --json # daemon生存保証の冪等入口(launchd等の周期実行向け)
|
|
@@ -299,6 +301,9 @@ const SUBCOMMAND_USAGE = Object.freeze({
|
|
|
299
301
|
'todo show': 'todo show --plan <key> --task <id> --json',
|
|
300
302
|
'todo note': 'todo note --plan <key> [--task <id>] (--message <text>|--input <file>) | list --plan <key> [--task <id>] --json',
|
|
301
303
|
'todo note list': 'todo note list --plan <key> [--task <id>] [--json]',
|
|
304
|
+
'todo notice': 'todo notice list [--lane <lane>] [--include-acked] [--json] | ack --lane <lane> --notice <id>[,<id>...] [--json]',
|
|
305
|
+
'todo notice list': 'todo notice list [--lane <lane>] [--include-acked] [--json] # lattice.todo_notice_list_result.v1',
|
|
306
|
+
'todo notice ack': 'todo notice ack --lane <lane> --notice <id>[,<id>...] [--json] # lattice.todo_notice_ack_result.v1 {acked, already, closed}',
|
|
302
307
|
'todo bindings': 'todo bindings [--plan <key>] [--json]',
|
|
303
308
|
'todo display': 'todo display read [--json] | source [--json] # host表示用の読取。不整合でも断らずstateで返す',
|
|
304
309
|
'todo display read': 'todo display read [--json] # lattice.todo_display_read_result.v1(state: verified|unverified|last_verified|unavailable)',
|
|
@@ -24,6 +24,11 @@ const run = (ctx, ...tail) => ['lattice', ctx.family ?? 'todo', ctx.command, ...
|
|
|
24
24
|
const schemaCommand = (ctx) => run(ctx, '--schema', '--json');
|
|
25
25
|
const showTask = (detail, ctx) => `lattice todo show --plan ${planOf(detail, ctx)} --task ${taskOf(detail, ctx)} --json`;
|
|
26
26
|
const startTask = (detail, ctx) => `lattice todo start --plan ${planOf(detail, ctx)} --task ${taskOf(detail, ctx)}`;
|
|
27
|
+
// The --message an enforced plan's done gate (ADR 0200 gate 4) accepts; the gate's own next_action uses it too.
|
|
28
|
+
export const ENFORCED_DONE_MESSAGE = '"<PR URL or merged commit sha>"';
|
|
29
|
+
// A done hint that the done gate accepts: on an enforced plan (ctx.enforcedPlans) it names the change, else `rest`.
|
|
30
|
+
const doneCommand = (planKey, taskId, ctx, rest = '') => `lattice todo done --plan ${planKey} --task ${taskId}${
|
|
31
|
+
strings(ctx.enforcedPlans).includes(planKey) ? ` --message ${ENFORCED_DONE_MESSAGE}` : rest}`;
|
|
27
32
|
// a12: name the blocking task (seat contract), falling back to the refused task's own detail.
|
|
28
33
|
const blocker = (detail) => (Array.isArray(detail.blocking_tasks) ? detail.blocking_tasks.find(record) : undefined);
|
|
29
34
|
// a18: the step that moves the blocker on depends on its status (a pending one is started first).
|
|
@@ -35,7 +40,7 @@ const unfinishedFirst = (detail, ctx) => {
|
|
|
35
40
|
return ({
|
|
36
41
|
pending: `Start ${name} first with \`lattice todo start ${on}\`, then record done on it`,
|
|
37
42
|
blocked: `Unblock ${name} with \`lattice todo unblock ${on}\`, then record done on it`,
|
|
38
|
-
})[first.status] ?? `Record done on ${name} first with
|
|
43
|
+
})[first.status] ?? `Record done on ${name} first with \`${doneCommand(first.plan_key, first.task_id, ctx, ' --message <text>')}\` (see \`lattice todo show ${on} --json\`)`;
|
|
39
44
|
};
|
|
40
45
|
// a36: a start without LATTICE_SEAT_ID is recorded under the OS user; after the seat sets its id that
|
|
41
46
|
// start looks like another seat's. Say so and give the seat contract's one-time fix.
|
|
@@ -46,7 +51,7 @@ const inProgressHolder = (detail, ctx, on) => {
|
|
|
46
51
|
return `It is in-progress under '${holder}', the name a start gets without LATTICE_SEAT_ID: most likely this seat's own`
|
|
47
52
|
+ ` start from before it set LATTICE_SEAT_ID. One-time fix (seat contract): with LATTICE_SEAT_ID unset, undo that start`
|
|
48
53
|
+ ` with \`lattice todo retract ${on} --reason <text>\` and start it again here, or finish it there first with`
|
|
49
|
-
+ `
|
|
54
|
+
+ ` \`${doneCommand(planOf(detail, ctx), taskOf(detail, ctx), ctx, ' --message <text>')}\`.`;
|
|
50
55
|
}
|
|
51
56
|
return `It is already in-progress under ${holder === null ? 'another seat' : `seat '${holder}'`}; see \`${showTask(detail, ctx)}\`.`
|
|
52
57
|
+ ` To move it to this seat run \`lattice todo start ${on} --rebind --reason <text>\`.`;
|
|
@@ -228,11 +233,12 @@ const REGISTRY = {
|
|
|
228
233
|
// a32: only a done task can be reopened; say the state and the step that fits it.
|
|
229
234
|
repair: (detail, ctx) => {
|
|
230
235
|
const on = `--plan ${planOf(detail, ctx)} --task ${taskOf(detail, ctx)}`;
|
|
236
|
+
const done = doneCommand(planOf(detail, ctx), taskOf(detail, ctx), ctx);
|
|
231
237
|
return `Only a done task can be reopened; ${planOf(detail, ctx)}/${taskOf(detail, ctx)} is ${detail.status ?? 'not done'}. ` + ({
|
|
232
238
|
// a35: retract undoes only an authored start; a reopened task has none.
|
|
233
239
|
'in-progress': detail.opened_by === 'start'
|
|
234
|
-
? `It is still open: finish it with
|
|
235
|
-
: `It is still open${openedByText(detail)}: finish it with
|
|
240
|
+
? `It is still open: finish it with \`${done}\`, or undo the start with \`lattice todo retract ${on} --reason <text>\`.`
|
|
241
|
+
: `It is still open${openedByText(detail)}: finish it with \`${done}\`.`,
|
|
236
242
|
pending: `It has not started: run \`lattice todo start ${on}\`.`,
|
|
237
243
|
blocked: `It is blocked: resume it with \`lattice todo unblock ${on}\`.`,
|
|
238
244
|
retired: `Retire is permanent, so it stays closed; see \`${showTask(detail, ctx)}\`.`,
|
|
@@ -265,7 +271,7 @@ const REGISTRY = {
|
|
|
265
271
|
// a35: say why there is nothing to retract and the step that closes the task instead.
|
|
266
272
|
repair: (detail, ctx) => `retract undoes only a start recorded by \`lattice todo start\`; `
|
|
267
273
|
+ `${planOf(detail, ctx)}/${taskOf(detail, ctx)} is in progress${openedByText(detail)}, so there is no start to undo. `
|
|
268
|
-
+ `Finish it with
|
|
274
|
+
+ `Finish it with \`${doneCommand(planOf(detail, ctx), taskOf(detail, ctx), ctx)}\`.`,
|
|
269
275
|
},
|
|
270
276
|
reopen_has_started_successor: {
|
|
271
277
|
repair: (detail, ctx) => `A successor of ${taskOf(detail, ctx)} has already started: to reopen it anyway run \`lattice todo reopen --plan ${planOf(detail, ctx)} --task ${taskOf(detail, ctx)} --reason <text> --override-reason <text>\`.`,
|
package/src/todo-cli.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { retireStateConflict, validateProspectiveEvent } from './todo-readiness.mjs';
|
|
2
2
|
import { cliCommandKind } from './cli-command-kind.mjs';
|
|
3
3
|
import { cliFailureClass } from './cli-failure-class.mjs';
|
|
4
|
-
import { FLAG_PLACEHOLDER, publicRefusalCode, withRefusalGuidance } from './cli-refusal-guidance.mjs';
|
|
4
|
+
import { ENFORCED_DONE_MESSAGE, FLAG_PLACEHOLDER, publicRefusalCode, withRefusalGuidance } from './cli-refusal-guidance.mjs';
|
|
5
5
|
import { readTaskBackchainContext } from './plan-backchain.mjs';
|
|
6
6
|
import { auditPendingNextCommands, phaseAuditRequired } from './todo-audit-pending.mjs';
|
|
7
7
|
import { gitSync } from './git-process.mjs';
|
|
@@ -154,6 +154,7 @@ import {
|
|
|
154
154
|
} from './todo-independence.mjs';
|
|
155
155
|
import {
|
|
156
156
|
selectIndependenceGuidance,
|
|
157
|
+
todoIndependenceGuidance,
|
|
157
158
|
selectWitnessScaffoldGuidance,
|
|
158
159
|
selectSeamProposalGuidance,
|
|
159
160
|
scopeExpansionRecommendations,
|
|
@@ -168,6 +169,8 @@ import {
|
|
|
168
169
|
} from './seam-proposal-contracts.mjs';
|
|
169
170
|
import { compileSeamProposalArtifact, declaredConcernSymbols } from './seam-proposal.mjs';
|
|
170
171
|
import { collectSensorEvidence } from './sensor-adapter.mjs';
|
|
172
|
+
import { newTodoNotices, projectTodoNotices } from './todo-notices.mjs';
|
|
173
|
+
import { ackTodoNotices, readAllTodoNoticeAcks, readTodoNoticeAcks } from './todo-notice-store.mjs';
|
|
171
174
|
import { collectTodoIndependenceAuthoritativeObservation } from './todo-independence-authoritative-observation.mjs';
|
|
172
175
|
import { applySeamProposal } from './seam-apply.mjs';
|
|
173
176
|
import { todoPlanPrecedences } from './seam-verification.mjs';
|
|
@@ -265,6 +268,16 @@ function guidanceContext(argv, env = {}) {
|
|
|
265
268
|
};
|
|
266
269
|
}
|
|
267
270
|
|
|
271
|
+
/** Enforced plans, so a refusal's done hint names the change their done gate needs; none when the store is unreadable. */
|
|
272
|
+
async function enforcedPlanKeys(cwd) {
|
|
273
|
+
try {
|
|
274
|
+
const { members } = await readTodoStore({ repoRoot: resolveRepoRoot(cwd) });
|
|
275
|
+
return members.filter((member) => member.coordination?.mode === 'enforced').map(({ descriptor }) => descriptor.plan_key);
|
|
276
|
+
} catch {
|
|
277
|
+
return [];
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
|
|
268
281
|
/**
|
|
269
282
|
* An error that reached here is, by definition, one none of the typed
|
|
270
283
|
* TodoStoreError/TypeError branches recognized — the one case where the
|
|
@@ -292,7 +305,7 @@ const TODO_COMMAND_NAMES = Object.freeze([
|
|
|
292
305
|
'status', 'show', 'note', 'bindings', 'display', 'independence', 'structure', 'seam-profile', 'seam-proposal',
|
|
293
306
|
'verify', 'repair-eol', 'snapshot', 'gantt', 'dashboard', 'phase', 'migrate', 'start', 'block',
|
|
294
307
|
'unblock', 'retire', 'done', 'reopen', 'evidence', 'split', 'revise', 'revise-phase', 'revise-set',
|
|
295
|
-
'retract', 'dependency', 'add',
|
|
308
|
+
'retract', 'dependency', 'add', 'notice',
|
|
296
309
|
]);
|
|
297
310
|
|
|
298
311
|
function typedArgumentFailure(stderr, code, message, detail, context = {}) {
|
|
@@ -351,6 +364,8 @@ const TODO_FLAG_SPECS = Object.freeze({
|
|
|
351
364
|
'independence witness declare': Object.freeze({
|
|
352
365
|
known: ['plan', 'task', 'owns', 'reads', 'writes'], required: ['plan', 'task'] }),
|
|
353
366
|
show: Object.freeze({ known: ['plan', 'task', 'json'], required: ['plan', 'task'], booleans: ['json'] }),
|
|
367
|
+
'notice list': Object.freeze({ known: ['lane', 'include-acked', 'json'], required: [], booleans: ['include-acked', 'json'] }),
|
|
368
|
+
'notice ack': Object.freeze({ known: ['lane', 'notice', 'json'], required: ['lane', 'notice'], booleans: ['json'] }),
|
|
354
369
|
'note list': Object.freeze({ known: ['plan', 'task', 'json'], required: ['plan'], booleans: ['json'] }),
|
|
355
370
|
'phase status': Object.freeze({ known: ['plan', 'json'], required: ['plan'], booleans: ['json'] }),
|
|
356
371
|
structure: Object.freeze({ known: ['plan', 'json'], required: [], booleans: ['json'] }),
|
|
@@ -1273,6 +1288,20 @@ async function startAdvisory({ repoRoot, store, projection, planKey, taskId }) {
|
|
|
1273
1288
|
// 調整方式の宣言(ob03)。未宣言はnullで、「まだ選んでいない」を意味する。
|
|
1274
1289
|
const coordinationMode = store.members
|
|
1275
1290
|
.find(({ descriptor }) => descriptor.plan_key === planKey)?.coordination?.mode ?? null;
|
|
1291
|
+
if (artifact === null && unusable === null && await declaredWithoutHead({ repoRoot, planKey, taskId })) {
|
|
1292
|
+
// declare-without-git: the row is recorded but a Store root with no commit cannot be observed.
|
|
1293
|
+
// Declared, never "safe": coverage says so and gate 1 lets the declared task start.
|
|
1294
|
+
return {
|
|
1295
|
+
coverage: 'declared_unobserved',
|
|
1296
|
+
drift_intersecting: null,
|
|
1297
|
+
conflicts_with_active: [],
|
|
1298
|
+
scope_expansion_recommendations: [],
|
|
1299
|
+
uncovered_active_task_ids: projection.active_set
|
|
1300
|
+
.filter((task) => task.plan_key === planKey).map(({ task_id: id }) => id),
|
|
1301
|
+
self_unknowns: [{ kind: 'observation_unavailable', ref: 'git_head_unresolved' }],
|
|
1302
|
+
guidance: todoIndependenceGuidance('independence_declared_unobserved', { planKey }),
|
|
1303
|
+
};
|
|
1304
|
+
}
|
|
1276
1305
|
if (artifact === null) {
|
|
1277
1306
|
// 記録が無ければ鮮度を語る相手がいない。HEADを要求すると、commitがまだ無いrepoで
|
|
1278
1307
|
// 「判定できない」でなく「startできない」になってしまう。
|
|
@@ -1414,6 +1443,23 @@ async function startTask({
|
|
|
1414
1443
|
structureContext, featureContext });
|
|
1415
1444
|
}
|
|
1416
1445
|
|
|
1446
|
+
/** declare-without-git: HEAD does not resolve (no commit) and the plan's witness set records this task's row. */
|
|
1447
|
+
async function declaredWithoutHead({ repoRoot, planKey, taskId }) {
|
|
1448
|
+
if (headResolves(repoRoot)) return false;
|
|
1449
|
+
const recorded = await readTodoWitnessSet({ repoRoot, planKey }).catch(() => null);
|
|
1450
|
+
return recorded?.plan_key === planKey && Object.hasOwn(recorded.manual_witness, taskId);
|
|
1451
|
+
}
|
|
1452
|
+
|
|
1453
|
+
function headResolves(repoRoot) {
|
|
1454
|
+
try {
|
|
1455
|
+
currentHeadSha(repoRoot);
|
|
1456
|
+
return true;
|
|
1457
|
+
} catch (error) {
|
|
1458
|
+
if (error?.code === 'INDEPENDENCE_BASE_UNRESOLVED') return false;
|
|
1459
|
+
throw error;
|
|
1460
|
+
}
|
|
1461
|
+
}
|
|
1462
|
+
|
|
1417
1463
|
const declareCommand = (planKey, taskId) => `lattice todo independence witness declare --plan ${planKey} --task ${taskId}`
|
|
1418
1464
|
+ ' --owns <path>[,<path>...] [--reads <path>,...] [--writes <path>,...]';
|
|
1419
1465
|
|
|
@@ -1451,7 +1497,7 @@ async function enforcedDoneGate({ repoRoot, planKey, flags }) {
|
|
|
1451
1497
|
}
|
|
1452
1498
|
throw new TodoStoreError('TODO_TRANSITION_REFUSED', 'enforced_done_reference_missing', undefined, {
|
|
1453
1499
|
plan_key: planKey, task_id: flags.task,
|
|
1454
|
-
next_action: `Name the adopted change: \`lattice todo done --plan ${planKey} --task ${flags.task} --message
|
|
1500
|
+
next_action: `Name the adopted change: \`lattice todo done --plan ${planKey} --task ${flags.task} --message ${ENFORCED_DONE_MESSAGE}\` (a sha must be in HEAD).`,
|
|
1455
1501
|
});
|
|
1456
1502
|
}
|
|
1457
1503
|
|
|
@@ -3810,13 +3856,22 @@ async function witnessDeclare({ repoRoot, planKey, flags }) {
|
|
|
3810
3856
|
const waitingFor = projectTodoStatus(await readTodoStore({ repoRoot }), TODO_STATUS_DISPATCH_ONLY).next_ready
|
|
3811
3857
|
.filter((task) => task.plan_key === planKey && !keep.has(task.task_id))
|
|
3812
3858
|
.map(({ task_id: id }) => id).sort();
|
|
3813
|
-
|
|
3859
|
+
// declare-without-git: a Store root with no commit cannot be observed, so the row is recorded and not compiled.
|
|
3860
|
+
const observable = headResolves(repoRoot);
|
|
3861
|
+
const compile = waitingFor.length === 0 && observable
|
|
3814
3862
|
? await independenceCompile({ repoRoot, planKey, inputRef: scaffolded.witness_ref }) : null;
|
|
3815
3863
|
const result = {
|
|
3816
3864
|
schema: 'lattice.todo_witness_declare_result.v1', project_id: member.plan.project_id, plan_key: planKey,
|
|
3817
3865
|
task_id: taskId, ...row, witness_ref: scaffolded.witness_ref,
|
|
3818
3866
|
witness_set_digest: scaffolded.witness_set_digest, compiled: compile !== null, waiting_for: waitingFor,
|
|
3819
|
-
compile,
|
|
3867
|
+
compile,
|
|
3868
|
+
...(observable ? {} : {
|
|
3869
|
+
observation: 'unavailable',
|
|
3870
|
+
next_action: `The Store root has no commit (git HEAD unresolved), so ${taskId}'s row is recorded but not observed or compiled:`
|
|
3871
|
+
+ ' coverage reads declared_unobserved (not judged safe). The declared task can start:'
|
|
3872
|
+
+ ` \`lattice todo start --plan ${planKey} --task ${taskId}\`.`,
|
|
3873
|
+
}),
|
|
3874
|
+
result_digest: '',
|
|
3820
3875
|
};
|
|
3821
3876
|
result.result_digest = todoSelfDigest(result, 'result_digest');
|
|
3822
3877
|
return result;
|
|
@@ -4534,6 +4589,94 @@ function writesTodoStore(argv) {
|
|
|
4534
4589
|
}
|
|
4535
4590
|
}
|
|
4536
4591
|
|
|
4592
|
+
/** notice-impl: the writes that can make a task startable carry `notices` ([startable notices](dfd-done-notice.md)). */
|
|
4593
|
+
function releasesTasks(argv) {
|
|
4594
|
+
const [command, second] = argv;
|
|
4595
|
+
return ['done', 'retire', 'unblock'].includes(command)
|
|
4596
|
+
|| (command === 'phase' && ['accept', 'close-unaudited'].includes(second))
|
|
4597
|
+
|| (command === 'dependency' && second === 'disconnect');
|
|
4598
|
+
}
|
|
4599
|
+
|
|
4600
|
+
async function openNotices(repoRoot) {
|
|
4601
|
+
const store = await readTodoStore({ repoRoot });
|
|
4602
|
+
const rows = new Map();
|
|
4603
|
+
for (const member of store.members) {
|
|
4604
|
+
if (member.coordination?.mode !== 'enforced') continue;
|
|
4605
|
+
const recorded = await readTodoWitnessSet({ repoRoot, planKey: member.plan.plan_key }).catch(() => null);
|
|
4606
|
+
rows.set(member.plan.plan_key, new Set(Object.keys(recorded?.manual_witness ?? {})));
|
|
4607
|
+
}
|
|
4608
|
+
return projectTodoNotices(store, { declared: (planKey, taskId) => rows.get(planKey)?.has(taskId) === true });
|
|
4609
|
+
}
|
|
4610
|
+
|
|
4611
|
+
/** A committed write is never undone for its notices: an unreadable projection says so and `notice list` recovers. */
|
|
4612
|
+
async function withNotices(repoRoot, result, before) {
|
|
4613
|
+
if (result === null || typeof result !== 'object' || typeof result.result_digest !== 'string') return result;
|
|
4614
|
+
let extra;
|
|
4615
|
+
try {
|
|
4616
|
+
if (before === null) throw new Error('notices_before_unreadable');
|
|
4617
|
+
extra = { notices: newTodoNotices(before, await openNotices(repoRoot)) };
|
|
4618
|
+
} catch (error) {
|
|
4619
|
+
extra = { notices: null, notices_unavailable: error?.detail?.reason ?? error?.message ?? 'notices_unreadable' };
|
|
4620
|
+
}
|
|
4621
|
+
const carried = { ...result, ...extra, result_digest: '' };
|
|
4622
|
+
carried.result_digest = todoSelfDigest(carried, 'result_digest');
|
|
4623
|
+
return carried;
|
|
4624
|
+
}
|
|
4625
|
+
|
|
4626
|
+
// Same bound as the Store's lane check (1..256 chars, no control characters).
|
|
4627
|
+
const isNoticeLane = (value) => typeof value === 'string' && value.length > 0 && value.length <= 256
|
|
4628
|
+
&& !/[\u0000-\u001f\u007f]/u.test(value);
|
|
4629
|
+
|
|
4630
|
+
function noticeAckRefusal(error, lane) {
|
|
4631
|
+
if (!['STORE_CORRUPT', 'UNSUPPORTED_SCHEMA'].includes(error?.code)) throw error;
|
|
4632
|
+
return { lane_file: error.detail?.ref ?? null, code: error.code, reason: error.detail?.reason ?? error.message };
|
|
4633
|
+
}
|
|
4634
|
+
|
|
4635
|
+
/** `todo notice list`: open notices, unacked unless asked; one unreadable ack file never hides the rest. */
|
|
4636
|
+
async function noticeList({ repoRoot, lane, includeAcked }) {
|
|
4637
|
+
const store = await readTodoStore({ repoRoot });
|
|
4638
|
+
const open = (await openNotices(repoRoot)).filter((notice) => lane === null || notice.lane === lane);
|
|
4639
|
+
const acked = new Map();
|
|
4640
|
+
const ackUnreadable = [];
|
|
4641
|
+
if (lane === null) {
|
|
4642
|
+
const all = await readAllTodoNoticeAcks({ repoRoot });
|
|
4643
|
+
for (const record of all.acks) acked.set(record.lane, new Set(record.acks.map(({ notice_id: id }) => id)));
|
|
4644
|
+
ackUnreadable.push(...all.unreadable);
|
|
4645
|
+
} else {
|
|
4646
|
+
try {
|
|
4647
|
+
const record = await readTodoNoticeAcks({ repoRoot, lane });
|
|
4648
|
+
acked.set(lane, new Set((record?.acks ?? []).map(({ notice_id: id }) => id)));
|
|
4649
|
+
} catch (error) {
|
|
4650
|
+
ackUnreadable.push(noticeAckRefusal(error, lane));
|
|
4651
|
+
}
|
|
4652
|
+
}
|
|
4653
|
+
const notices = open.map((notice) => ({ ...notice, acked: acked.get(notice.lane)?.has(notice.notice_id) === true }))
|
|
4654
|
+
.filter((notice) => includeAcked || !notice.acked);
|
|
4655
|
+
const result = {
|
|
4656
|
+
schema: 'lattice.todo_notice_list_result.v1', project_id: store.project_id, lane, notices,
|
|
4657
|
+
ack_unreadable: ackUnreadable, result_digest: '',
|
|
4658
|
+
};
|
|
4659
|
+
result.result_digest = todoSelfDigest(result, 'result_digest');
|
|
4660
|
+
return result;
|
|
4661
|
+
}
|
|
4662
|
+
|
|
4663
|
+
/** `todo notice ack`: an id that is no longer open is reported as closed, never refused (nothing is left to ack). */
|
|
4664
|
+
async function noticeAck({ repoRoot, env, lane, ids }) {
|
|
4665
|
+
const store = await readTodoStore({ repoRoot });
|
|
4666
|
+
const openIds = (await openNotices(repoRoot)).filter((notice) => notice.lane === lane).map(({ notice_id: id }) => id);
|
|
4667
|
+
const open = new Set(openIds);
|
|
4668
|
+
const live = ids.filter((id) => open.has(id));
|
|
4669
|
+
const written = live.length === 0 ? { acked: [], already: [] } : await ackTodoNotices({
|
|
4670
|
+
repoRoot, lane, noticeIds: live, openIds, actor: resolveTodoActor(env), now: new Date().toISOString(),
|
|
4671
|
+
});
|
|
4672
|
+
const result = {
|
|
4673
|
+
schema: 'lattice.todo_notice_ack_result.v1', project_id: store.project_id, lane,
|
|
4674
|
+
acked: written.acked, already: written.already, closed: ids.filter((id) => !open.has(id)).sort(), result_digest: '',
|
|
4675
|
+
};
|
|
4676
|
+
result.result_digest = todoSelfDigest(result, 'result_digest');
|
|
4677
|
+
return result;
|
|
4678
|
+
}
|
|
4679
|
+
|
|
4537
4680
|
async function ensureActiveProjectDashboard({ repoRoot, env, stderr, strict = false }) {
|
|
4538
4681
|
if (env.LATTICE_DASHBOARD_AUTOSTART === '0') return null;
|
|
4539
4682
|
let actor;
|
|
@@ -4841,6 +4984,19 @@ export async function runTodoCli({ argv, cwd, stdout, stderr, env = process.env,
|
|
|
4841
4984
|
supersedes: flags.supersedes ?? null,
|
|
4842
4985
|
});
|
|
4843
4986
|
}
|
|
4987
|
+
} else if (argv[0] === 'notice' && argv[1] === 'list'
|
|
4988
|
+
&& matchFlagCommand(argv, ['notice', 'list'], TODO_FLAG_SPECS['notice list']) !== null) {
|
|
4989
|
+
const flags = matchFlagCommand(argv, ['notice', 'list'], TODO_FLAG_SPECS['notice list']);
|
|
4990
|
+
if (flags.lane === undefined || isNoticeLane(flags.lane)) {
|
|
4991
|
+
action = (repoRoot) => noticeList({ repoRoot, lane: flags.lane ?? null, includeAcked: flags['include-acked'] === true });
|
|
4992
|
+
}
|
|
4993
|
+
} else if (argv[0] === 'notice' && argv[1] === 'ack'
|
|
4994
|
+
&& matchFlagCommand(argv, ['notice', 'ack'], TODO_FLAG_SPECS['notice ack']) !== null) {
|
|
4995
|
+
const flags = matchFlagCommand(argv, ['notice', 'ack'], TODO_FLAG_SPECS['notice ack']);
|
|
4996
|
+
const ids = typeof flags.notice === 'string' ? [...new Set(flags.notice.split(',').map((id) => id.trim()))] : [];
|
|
4997
|
+
if (isNoticeLane(flags.lane) && ids.length > 0 && ids.every((id) => /^[0-9a-f]{64}$/u.test(id))) {
|
|
4998
|
+
action = (repoRoot) => noticeAck({ repoRoot, env, lane: flags.lane, ids });
|
|
4999
|
+
}
|
|
4844
5000
|
} else if (argv[0] === 'note' && argv[1] === 'list' && readFlags(argv, ['note', 'list']) !== null) {
|
|
4845
5001
|
const flags = readFlags(argv, ['note', 'list']);
|
|
4846
5002
|
action = (repoRoot) => listNotes({ repoRoot, planKey: flags.plan, taskId: flags.task ?? null });
|
|
@@ -5211,15 +5367,17 @@ export async function runTodoCli({ argv, cwd, stdout, stderr, env = process.env,
|
|
|
5211
5367
|
if (writesTodoStore(argv)) {
|
|
5212
5368
|
await ensureActiveProjectDashboard({ repoRoot, env, stderr });
|
|
5213
5369
|
}
|
|
5214
|
-
const
|
|
5370
|
+
const before = releasesTasks(argv) ? await openNotices(repoRoot).catch(() => null) : null;
|
|
5371
|
+
const written = atomicCommit
|
|
5215
5372
|
? await commitTodoStoreMutation({ repoRoot, argv, action, env })
|
|
5216
5373
|
: await action(repoRoot);
|
|
5374
|
+
const result = releasesTasks(argv) ? await withNotices(repoRoot, written, before) : written;
|
|
5217
5375
|
if (result !== null) stdout.write(`${plainVerify ? verifyVerdictLine(result) : JSON.stringify(result)}\n`);
|
|
5218
5376
|
return 0;
|
|
5219
5377
|
} catch (error) {
|
|
5220
5378
|
if (error instanceof TodoStoreError || (typeof error?.code === 'string'
|
|
5221
5379
|
&& error.detail !== null && typeof error.detail === 'object')) {
|
|
5222
|
-
return typedFailure(stderr, error, guidanceContext(argv, env));
|
|
5380
|
+
return typedFailure(stderr, error, { ...guidanceContext(argv, env), enforcedPlans: await enforcedPlanKeys(cwd) });
|
|
5223
5381
|
}
|
|
5224
5382
|
// 漏れた`fetch failed`もTypeErrorで届く。呼び出し側の契約違反と答えず、内部故障として観測口へ渡す。
|
|
5225
5383
|
if (error instanceof TypeError && cliFailureClass(error) !== 'transport') {
|
package/src/todo-contracts.mjs
CHANGED
|
@@ -41,6 +41,8 @@ export const TODO_NOTE_EVENT_SCHEMA = 'lattice.todo_note_event.v1';
|
|
|
41
41
|
* task noteの読み書きは1バイトも変わらない。
|
|
42
42
|
*/
|
|
43
43
|
export const TODO_NOTE_EVENT_V2_SCHEMA = 'lattice.todo_note_event.v2';
|
|
44
|
+
// Per-lane startable-notice ack set (host-local; todo-notice-store.mjs).
|
|
45
|
+
export const TODO_NOTICE_ACKS_SCHEMA = 'lattice.todo_notice_acks.v1';
|
|
44
46
|
/**
|
|
45
47
|
* v2でnoteの`scope`とplan noteを載せる。v1のままでは`task_id`が identifier 必須・
|
|
46
48
|
* `full_history_command`が`--task <id>`込みの文字列と完全一致で、どちらもplan noteを表せない。
|
|
@@ -62,7 +62,7 @@ export const TODO_INDEPENDENCE_LEGACY_SCHEMAS = Object.freeze([
|
|
|
62
62
|
export const TODO_INDEPENDENCE_TASK_LIMIT = 256;
|
|
63
63
|
export const TODO_INDEPENDENCE_LIST_LIMIT = 4_096;
|
|
64
64
|
export const TODO_INDEPENDENCE_COVERAGE = Object.freeze([
|
|
65
|
-
'verified', 'stale', 'superseded', 'missing',
|
|
65
|
+
'verified', 'stale', 'superseded', 'missing', 'declared_unobserved',
|
|
66
66
|
]);
|
|
67
67
|
|
|
68
68
|
/** conflictを生んだresourceの種別。切断可能性の導出はこの種別だけを根拠にする。 */
|
|
@@ -28,6 +28,7 @@ export const TODO_INDEPENDENCE_GUIDANCE_CODES = Object.freeze([
|
|
|
28
28
|
'independence_conflict_between_ready',
|
|
29
29
|
'independence_verdicts_absent',
|
|
30
30
|
'independence_verified',
|
|
31
|
+
'independence_declared_unobserved',
|
|
31
32
|
]);
|
|
32
33
|
|
|
33
34
|
export const SEAM_PROPOSAL_GUIDANCE_CODES = Object.freeze([
|
|
@@ -113,6 +114,10 @@ const CATALOG = Object.freeze({
|
|
|
113
114
|
message: '判定が途中で止まっており、記録はどの組についてもverdictを持たない。自分にunknownが無いことは、他と干渉しない証拠にならない。',
|
|
114
115
|
next_action: 'lattice todo independence compile --plan <key> --input <file>',
|
|
115
116
|
}),
|
|
117
|
+
independence_declared_unobserved: Object.freeze({
|
|
118
|
+
message: '宣言は記録したが、Storeのrepoにcommitが無いので、触るファイルの観測と並列可否の判定はしていない。干渉しない証拠ではない。',
|
|
119
|
+
next_action: 'none',
|
|
120
|
+
}),
|
|
116
121
|
independence_verified: Object.freeze({
|
|
117
122
|
message: '記録時点の宣言境界では、他のready工程と干渉しない。',
|
|
118
123
|
next_action: 'none',
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { lstat, mkdir, readFile, readdir, writeFile } from 'node:fs/promises';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
|
|
5
|
+
import { LOCK_WAIT_MS, StoreLockError, withStoreLock } from './store-lock.mjs';
|
|
6
|
+
import {
|
|
7
|
+
TODO_LIMITS, TODO_NOTICE_ACKS_SCHEMA, canonicalizeTodoArtifact, exactRecord, isStrictTodoTimestamp, isTodoDigest, isTodoIdentifier,
|
|
8
|
+
todoSelfDigest,
|
|
9
|
+
} from './todo-contracts.mjs';
|
|
10
|
+
import { TodoStoreError, atomicWrite, rejectNewerTodoSchema } from './todo-store.mjs';
|
|
11
|
+
|
|
12
|
+
export { TODO_NOTICE_ACKS_SCHEMA };
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Per-lane ack set of startable notices (dfd-done-notice.md, row "Store: ack set").
|
|
16
|
+
* Host-local delivery state, not a plan fact: it is git-ignored (its own .gitignore), has its own lock, and never touches the
|
|
17
|
+
* lifecycle journals. Losing it means a notice is delivered again, never lost.
|
|
18
|
+
*/
|
|
19
|
+
export const TODO_NOTICE_ROOT_REF = '.lattice/todo/notices';
|
|
20
|
+
const LANE_FILE = /^[0-9a-f]{16}\.json$/u;
|
|
21
|
+
|
|
22
|
+
const fail = (code, reason, detail) => { throw new TodoStoreError(code, reason, reason, detail); };
|
|
23
|
+
const canonicalLine = (value) => `${canonicalizeTodoArtifact(value)}\n`;
|
|
24
|
+
// Lane is the exact string the plan records (bot id or name); bounded so the record stays bounded.
|
|
25
|
+
const isLane = (value) => typeof value === 'string' && value.length > 0 && value.length <= 256
|
|
26
|
+
&& !/\p{Cc}/u.test(value);
|
|
27
|
+
const isActor = (value) => exactRecord(value, ['host', 'session', 'agent'])
|
|
28
|
+
&& [value.host, value.session, value.agent].every(isTodoIdentifier);
|
|
29
|
+
const isAck = (value) => exactRecord(value, ['notice_id', 'acked_at', 'actor'])
|
|
30
|
+
&& isTodoDigest(value.notice_id) && isStrictTodoTimestamp(value.acked_at) && isActor(value.actor);
|
|
31
|
+
const sortedUnique = (ids) => ids.every((id, index) => index === 0 || ids[index - 1] < id);
|
|
32
|
+
|
|
33
|
+
const laneFileName = (lane) => `${createHash('sha256').update(lane, 'utf8').digest('hex').slice(0, 16)}.json`;
|
|
34
|
+
const laneRef = (lane) => path.posix.join(TODO_NOTICE_ROOT_REF, laneFileName(lane));
|
|
35
|
+
|
|
36
|
+
function sealed(lane, acks) {
|
|
37
|
+
const record = { schema: TODO_NOTICE_ACKS_SCHEMA, lane, acks, acks_digest: '' };
|
|
38
|
+
record.acks_digest = todoSelfDigest(record, 'acks_digest');
|
|
39
|
+
return record;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Every refusal names the lane file, so one bad lane never hides another.
|
|
43
|
+
async function readLaneFile(repoRoot, ref) {
|
|
44
|
+
const corrupt = (reason) => fail('STORE_CORRUPT', reason, {
|
|
45
|
+
ref,
|
|
46
|
+
next_action: `${ref} is a host-local notice ack set, not plan data. Delete it to start the lane's acks over`
|
|
47
|
+
+ ' (its open notices are listed and delivered again), or run `lattice todo notice ack` to replace it.',
|
|
48
|
+
});
|
|
49
|
+
let bytes;
|
|
50
|
+
try {
|
|
51
|
+
const state = await lstat(path.resolve(repoRoot, ref));
|
|
52
|
+
if (!state.isFile()) corrupt('notice_acks_not_file');
|
|
53
|
+
if (state.size > TODO_LIMITS.journalSegmentBytes) corrupt('notice_acks_too_large');
|
|
54
|
+
bytes = await readFile(path.resolve(repoRoot, ref), 'utf8');
|
|
55
|
+
} catch (error) {
|
|
56
|
+
if (error instanceof TodoStoreError) throw error;
|
|
57
|
+
if (error?.code === 'ENOENT') return null;
|
|
58
|
+
corrupt('notice_acks_unreadable');
|
|
59
|
+
}
|
|
60
|
+
let record;
|
|
61
|
+
try { record = JSON.parse(bytes); } catch { corrupt('notice_acks_json_invalid'); }
|
|
62
|
+
rejectNewerTodoSchema(record, 'todo_notice_acks', ref);
|
|
63
|
+
if (!exactRecord(record, ['schema', 'lane', 'acks', 'acks_digest']) || record.schema !== TODO_NOTICE_ACKS_SCHEMA
|
|
64
|
+
|| !isLane(record.lane) || !Array.isArray(record.acks) || !record.acks.every(isAck)
|
|
65
|
+
|| !sortedUnique(record.acks.map(({ notice_id: id }) => id)) || !isTodoDigest(record.acks_digest)) {
|
|
66
|
+
corrupt('notice_acks_shape_invalid');
|
|
67
|
+
}
|
|
68
|
+
if (canonicalLine(record) !== bytes) corrupt('notice_acks_not_canonical');
|
|
69
|
+
if (record.acks_digest !== todoSelfDigest(record, 'acks_digest')) corrupt('notice_acks_digest_mismatch');
|
|
70
|
+
if (laneRef(record.lane) !== ref) corrupt('notice_acks_lane_mismatch');
|
|
71
|
+
return record;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** The lane's ack set, or null when the lane has none. */
|
|
75
|
+
export async function readTodoNoticeAcks({ repoRoot, lane } = {}) {
|
|
76
|
+
if (typeof repoRoot !== 'string' || !isLane(lane)) throw new TypeError('readTodoNoticeAcks options invalid');
|
|
77
|
+
const ref = laneRef(lane);
|
|
78
|
+
const record = await readLaneFile(path.resolve(repoRoot), ref);
|
|
79
|
+
// A different lane whose hash prefix collides is not this lane's record.
|
|
80
|
+
if (record !== null && record.lane !== lane) {
|
|
81
|
+
fail('STORE_CORRUPT', 'notice_acks_lane_mismatch', { ref, lane, recorded_lane: record.lane });
|
|
82
|
+
}
|
|
83
|
+
return record;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/** Every lane's ack set; an unreadable lane file is named in `unreadable` and never hides the others. */
|
|
87
|
+
export async function readAllTodoNoticeAcks({ repoRoot } = {}) {
|
|
88
|
+
if (typeof repoRoot !== 'string') throw new TypeError('readAllTodoNoticeAcks options invalid');
|
|
89
|
+
const root = path.resolve(repoRoot);
|
|
90
|
+
let names;
|
|
91
|
+
try { names = (await readdir(path.resolve(root, TODO_NOTICE_ROOT_REF))).filter((name) => LANE_FILE.test(name)).sort(); }
|
|
92
|
+
catch (error) {
|
|
93
|
+
if (error?.code === 'ENOENT') return { acks: [], unreadable: [] };
|
|
94
|
+
return { acks: [], unreadable: [{ lane_file: TODO_NOTICE_ROOT_REF, code: 'STORE_CORRUPT', reason: 'notice_acks_unreadable' }] };
|
|
95
|
+
}
|
|
96
|
+
const acks = [];
|
|
97
|
+
const unreadable = [];
|
|
98
|
+
for (const name of names) {
|
|
99
|
+
const ref = path.posix.join(TODO_NOTICE_ROOT_REF, name);
|
|
100
|
+
try {
|
|
101
|
+
const record = await readLaneFile(root, ref);
|
|
102
|
+
if (record !== null) acks.push(record);
|
|
103
|
+
} catch (error) {
|
|
104
|
+
if (!(error instanceof TodoStoreError)) throw error;
|
|
105
|
+
unreadable.push({ lane_file: ref, code: error.code, reason: error.detail.reason });
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return { acks, unreadable };
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Record acks for `noticeIds` (each must be in `openIds`, the lane's open notices Plan read) and drop
|
|
113
|
+
* acks whose notice is no longer open, so the set stays bounded by the open notices.
|
|
114
|
+
* An unreadable older file is replaced (its acks were already unusable: list shows them unacked);
|
|
115
|
+
* a newer Lattice's file is refused, never downgraded.
|
|
116
|
+
*/
|
|
117
|
+
export async function ackTodoNotices({ repoRoot, lane, noticeIds, openIds, actor, now } = {}) {
|
|
118
|
+
if (typeof repoRoot !== 'string' || !isLane(lane) || !Array.isArray(noticeIds) || noticeIds.length === 0
|
|
119
|
+
|| !Array.isArray(openIds) || ![...noticeIds, ...openIds].every(isTodoDigest)
|
|
120
|
+
|| !isActor(actor) || !isStrictTodoTimestamp(now)) {
|
|
121
|
+
throw new TypeError('ackTodoNotices options invalid');
|
|
122
|
+
}
|
|
123
|
+
const open = new Set(openIds);
|
|
124
|
+
if (!noticeIds.every((id) => open.has(id))) throw new TypeError('ackTodoNotices noticeIds must be open notices');
|
|
125
|
+
const root = path.resolve(repoRoot);
|
|
126
|
+
const directory = path.resolve(root, TODO_NOTICE_ROOT_REF);
|
|
127
|
+
try { await mkdir(directory); }
|
|
128
|
+
catch (error) {
|
|
129
|
+
// Protects against creating a Store skeleton outside a published Store; leaves once the Store exists.
|
|
130
|
+
if (error?.code === 'ENOENT') {
|
|
131
|
+
fail('STORE_WRITE_CONFLICT', 'store_missing', { next_action: 'Initialize the Todo Store, then retry the ack.' });
|
|
132
|
+
}
|
|
133
|
+
if (error?.code !== 'EEXIST') throw error;
|
|
134
|
+
}
|
|
135
|
+
const ref = laneRef(lane);
|
|
136
|
+
try {
|
|
137
|
+
return await withStoreLock({ lockPath: path.join(directory, '.write.lock'), createParent: false, waitMs: LOCK_WAIT_MS },
|
|
138
|
+
async () => {
|
|
139
|
+
// Ignored in any repository, not only where the host's .gitignore says so.
|
|
140
|
+
await writeFile(path.join(directory, '.gitignore'), '*\n', { flag: 'wx' }).catch((error) => {
|
|
141
|
+
if (error?.code !== 'EEXIST') throw error;
|
|
142
|
+
});
|
|
143
|
+
let current = null;
|
|
144
|
+
try { current = await readLaneFile(root, ref); }
|
|
145
|
+
catch (error) {
|
|
146
|
+
if (!(error instanceof TodoStoreError) || error.code !== 'STORE_CORRUPT') throw error;
|
|
147
|
+
}
|
|
148
|
+
// A colliding lane's record is not ours to keep; it is replaced like any unreadable file.
|
|
149
|
+
const kept = (current?.lane === lane ? current.acks : []).filter(({ notice_id: id }) => open.has(id));
|
|
150
|
+
const keptIds = new Set(kept.map(({ notice_id: id }) => id));
|
|
151
|
+
const requested = [...new Set(noticeIds)].sort();
|
|
152
|
+
const already = requested.filter((id) => keptIds.has(id));
|
|
153
|
+
const acked = requested.filter((id) => !keptIds.has(id));
|
|
154
|
+
const acks = [...kept, ...acked.map((id) => ({ notice_id: id, acked_at: now, actor }))]
|
|
155
|
+
.sort((left, right) => (left.notice_id < right.notice_id ? -1 : 1));
|
|
156
|
+
const next = sealed(lane, acks);
|
|
157
|
+
if (current === null || next.acks_digest !== current.acks_digest) {
|
|
158
|
+
await atomicWrite(path.resolve(root, ref), Buffer.from(canonicalLine(next), 'utf8'));
|
|
159
|
+
}
|
|
160
|
+
return { acked, already };
|
|
161
|
+
});
|
|
162
|
+
} catch (error) {
|
|
163
|
+
if (error instanceof StoreLockError) fail('STORE_WRITE_CONFLICT', error.reason, error.detail);
|
|
164
|
+
throw error;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
// Startable notices (notice-impl, docs/architecture/dfd-done-notice.md): a read-only projection over the
|
|
2
|
+
// Store journals. Lattice records and shows; a notice starts nothing and gates nothing.
|
|
3
|
+
|
|
4
|
+
import { digestTodoArtifact } from './todo-contracts.mjs';
|
|
5
|
+
import { createTodoReadiness } from './todo-readiness.mjs';
|
|
6
|
+
import { projectTodoStatus, TODO_STATUS_DISPATCH_ONLY } from './todo-status.mjs';
|
|
7
|
+
|
|
8
|
+
const byText = (left, right) => (left < right ? -1 : left > right ? 1 : 0);
|
|
9
|
+
|
|
10
|
+
/** The journal event that put a task or phase in its current state: its latest event. */
|
|
11
|
+
function latestEvent(member, match) {
|
|
12
|
+
const event = member?.journal.events.findLast(match);
|
|
13
|
+
return event === undefined ? null : event;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function triggerOf(member, event, ref) {
|
|
17
|
+
return {
|
|
18
|
+
plan_key: member.plan.plan_key, ...ref, kind: event.kind,
|
|
19
|
+
event_digest: event.event_digest, recorded_at: event.recorded_at, actor: event.actor ?? null,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Open notices: ready tasks (`next_ready`, the same rule as `todo status`) that waited on something.
|
|
25
|
+
* `declared(planKey, taskId)` says whether an enforced plan's witness set records the task's row.
|
|
26
|
+
*/
|
|
27
|
+
export function projectTodoNotices(store, { lane = null, declared = () => true } = {}) {
|
|
28
|
+
const readiness = createTodoReadiness(store);
|
|
29
|
+
const members = new Map(store.members.map((member) => [member.plan.plan_key, member]));
|
|
30
|
+
const notices = [];
|
|
31
|
+
for (const ready of projectTodoStatus(store, TODO_STATUS_DISPATCH_ONLY).next_ready) {
|
|
32
|
+
const member = members.get(ready.plan_key);
|
|
33
|
+
const task = member?.plan.tasks.find(({ task_id: id }) => id === ready.task_id);
|
|
34
|
+
if (task === undefined || (lane !== null && task.lane !== lane)) continue;
|
|
35
|
+
const refs = readiness.prerequisiteRefs(readiness.key({ ...member.plan, ...task }));
|
|
36
|
+
const triggers = [];
|
|
37
|
+
for (const ref of refs.tasks) {
|
|
38
|
+
const event = latestEvent(members.get(ref.plan_key), (entry) => entry.task_id === ref.task_id);
|
|
39
|
+
if (event !== null) triggers.push(triggerOf(members.get(ref.plan_key), event, { task_id: ref.task_id }));
|
|
40
|
+
}
|
|
41
|
+
const ownPhase = member.plan.phases?.find(({ phase_id: id }) => id === task.phase_id);
|
|
42
|
+
const phaseRefs = [...refs.phases, ...(ownPhase?.predecessor_phase_ids ?? [])
|
|
43
|
+
.map((phaseId) => ({ plan_key: member.plan.plan_key, phase_id: phaseId }))];
|
|
44
|
+
for (const ref of phaseRefs) {
|
|
45
|
+
const event = latestEvent(members.get(ref.plan_key),
|
|
46
|
+
(entry) => entry.phase_id === ref.phase_id && entry.task_id === undefined);
|
|
47
|
+
if (event !== null) triggers.push(triggerOf(members.get(ref.plan_key), event, { phase_id: ref.phase_id }));
|
|
48
|
+
}
|
|
49
|
+
const own = latestEvent(member, (entry) => entry.task_id === task.task_id);
|
|
50
|
+
if (own?.kind === 'unblock') triggers.push(triggerOf(member, own, { task_id: task.task_id }));
|
|
51
|
+
// A task that waited on nothing was never waited on; next_ready already shows it.
|
|
52
|
+
if (triggers.length === 0) continue;
|
|
53
|
+
const unique = [...new Map(triggers.map((entry) => [entry.event_digest, entry])).values()]
|
|
54
|
+
.sort((left, right) => byText(left.event_digest, right.event_digest));
|
|
55
|
+
const planKey = member.plan.plan_key;
|
|
56
|
+
const mode = member.coordination?.mode ?? null;
|
|
57
|
+
notices.push({
|
|
58
|
+
notice_id: digestTodoArtifact([planKey, member.plan.plan_version, task.task_id,
|
|
59
|
+
unique.map(({ event_digest: digest }) => digest)]),
|
|
60
|
+
plan_key: planKey,
|
|
61
|
+
plan_version: member.plan.plan_version,
|
|
62
|
+
task_id: task.task_id,
|
|
63
|
+
title: task.title,
|
|
64
|
+
lane: task.lane ?? null,
|
|
65
|
+
done_condition: task.done_condition ?? null,
|
|
66
|
+
coordination_mode: mode,
|
|
67
|
+
triggers: unique,
|
|
68
|
+
// Same rule as the enforced done hints (#141): offer what the start path accepts.
|
|
69
|
+
next_action: mode === 'enforced' && !declared(planKey, task.task_id)
|
|
70
|
+
? `lattice todo independence witness declare --plan ${planKey} --task ${task.task_id} --owns <path>[,<path>...]`
|
|
71
|
+
: `lattice todo start --plan ${planKey} --task ${task.task_id}`,
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
return notices.sort((left, right) => byText(`${left.plan_key}\0${left.task_id}`, `${right.plan_key}\0${right.task_id}`));
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** Notices open after a write and not before it: the `notices` of a mutation result. */
|
|
78
|
+
export function newTodoNotices(before, after) {
|
|
79
|
+
const open = new Set(before.map(({ notice_id: id }) => id));
|
|
80
|
+
return after.filter(({ notice_id: id }) => !open.has(id));
|
|
81
|
+
}
|
package/src/todo-readiness.mjs
CHANGED
|
@@ -126,10 +126,28 @@ export function createTodoReadiness(store) {
|
|
|
126
126
|
}
|
|
127
127
|
const startedSuccessor = (key) => startedSuccessors(key).length > 0;
|
|
128
128
|
|
|
129
|
+
/** notice-impl: what a task waits on — predecessor tasks, phases whose accept it needs, and its own phase. */
|
|
130
|
+
function prerequisiteRefs(key) {
|
|
131
|
+
const node = nodes.get(key);
|
|
132
|
+
const tasks = [...(incoming.get(key) ?? [])].map((source) => nodes.get(source))
|
|
133
|
+
.filter((pred) => pred !== undefined).map(({ plan_key, task_id }) => ({ plan_key, task_id }));
|
|
134
|
+
const phaseRefs = [...(acceptanceIncoming.get(key) ?? [])].map((source) => phases.get(source))
|
|
135
|
+
.filter((phase) => phase !== undefined).map(({ plan_key, phase_id }) => ({ plan_key, phase_id }));
|
|
136
|
+
for (const source of incoming.get(key) ?? []) {
|
|
137
|
+
const pred = nodes.get(source);
|
|
138
|
+
if (pred !== undefined && isPhaseTodoPlanSchema(pred.schema) && !isDecoupledPhaseTodoPlanSchema(pred.schema)
|
|
139
|
+
&& !(pred.plan_key === node?.plan_key && pred.phase_id === node?.phase_id)) {
|
|
140
|
+
phaseRefs.push({ plan_key: pred.plan_key, phase_id: pred.phase_id });
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return { tasks: uniqueRefs(tasks).sort(byRef), phases: uniqueRefs(phaseRefs).sort(byRef) };
|
|
144
|
+
}
|
|
145
|
+
|
|
129
146
|
return {
|
|
130
147
|
key: taskKey,
|
|
131
148
|
status: (key) => nodes.get(key)?.status,
|
|
132
149
|
prerequisites,
|
|
150
|
+
prerequisiteRefs,
|
|
133
151
|
ownPhaseReady,
|
|
134
152
|
ownPhaseStatus,
|
|
135
153
|
isReady: (key) => nodes.get(key)?.status === 'pending'
|
|
@@ -19,6 +19,7 @@ const STORE_PATHS = [STORE_REF,
|
|
|
19
19
|
':(exclude,glob).lattice/todo/**/.write.lock*',
|
|
20
20
|
':(exclude,glob).lattice/todo/**/.write.lock*/**',
|
|
21
21
|
':(exclude,glob).lattice/todo/.cross-plan-recovery/**',
|
|
22
|
+
':(exclude,glob).lattice/todo/notices/**',
|
|
22
23
|
];
|
|
23
24
|
const LOCK_NAME = 'lattice-todo-store-commit.lock';
|
|
24
25
|
|
package/src/todo-store.mjs
CHANGED
|
@@ -24,6 +24,7 @@ import {
|
|
|
24
24
|
import path from 'node:path';
|
|
25
25
|
import {
|
|
26
26
|
TODO_COORDINATION_MODES,
|
|
27
|
+
TODO_EVENT_KINDS,
|
|
27
28
|
TODO_LIMITS,
|
|
28
29
|
TODO_PLAN_SCOPED_EVENT_KINDS,
|
|
29
30
|
canonicalizeTodoArtifact,
|
|
@@ -62,6 +63,7 @@ import {
|
|
|
62
63
|
collectTodoStructureGitProvenance,
|
|
63
64
|
} from './todo-structure-git-adapter.mjs';
|
|
64
65
|
import { sha256Bytes, verifyLinearHashChain } from './hash-chain.mjs';
|
|
66
|
+
import packageJson from '../package.json' with { type: 'json' };
|
|
65
67
|
import { gitCatFileBatch, gitSync } from './git-process.mjs';
|
|
66
68
|
import { matchesTodoSourceLineDigest } from './todo-source-line-eol.mjs';
|
|
67
69
|
import {
|
|
@@ -111,17 +113,61 @@ function fail(code, reason, detail) {
|
|
|
111
113
|
throw new TodoStoreError(code, reason, reason, detail);
|
|
112
114
|
}
|
|
113
115
|
|
|
116
|
+
const upgradeAction = (what) => `${what} was written by a newer Lattice than ${packageJson.version}. The record is`
|
|
117
|
+
+ ` not corrupt: do not repair or delete it. Upgrade Lattice on this host to a version newer than`
|
|
118
|
+
+ ` ${packageJson.version}, then run the command again.`;
|
|
119
|
+
|
|
114
120
|
function rejectUnsupportedRevisionSchema(value, { family, supportedSchemas }) {
|
|
115
121
|
const schema = value?.schema;
|
|
116
122
|
if (typeof schema === 'string'
|
|
117
123
|
&& new RegExp(`^lattice\\.${family}\\.v[1-9]\\d*$`, 'u').test(schema)
|
|
118
124
|
&& !supportedSchemas.includes(schema)) {
|
|
119
125
|
fail('UNSUPPORTED_SCHEMA', 'unsupported_revision_schema', {
|
|
120
|
-
schema, supported_schemas: [...supportedSchemas],
|
|
126
|
+
schema, supported_schemas: [...supportedSchemas], next_action: upgradeAction(`Schema ${schema}`),
|
|
121
127
|
});
|
|
122
128
|
}
|
|
123
129
|
}
|
|
124
130
|
|
|
131
|
+
// Reader registration (newer-value-says-upgrade): the newest schema of each Store record family this
|
|
132
|
+
// reader knows. Bump it in the same diff that teaches the validator a new version.
|
|
133
|
+
export const NEWEST_KNOWN_TODO_SCHEMA = Object.freeze({ todo_event: 4, todo_plan: 8, todo_manifest: 2, todo_notice_acks: 1 });
|
|
134
|
+
const NEWER_SCHEMA_FAMILY = new Map([[validateTodoPlan, 'todo_plan'], [validateTodoManifest, 'todo_manifest']]);
|
|
135
|
+
const vocabularyWord = (value) => typeof value === 'string' && /^[a-z][a-z0-9_-]{0,63}$/u.test(value);
|
|
136
|
+
|
|
137
|
+
function newerSchema(value, family) {
|
|
138
|
+
const match = typeof value?.schema === 'string' ? value.schema.match(/^lattice\.([a-z_]+)\.v([1-9]\d{0,5})$/u) : null;
|
|
139
|
+
return match !== null && match[1] === family && Number(match[2]) > NEWEST_KNOWN_TODO_SCHEMA[family]
|
|
140
|
+
? { pointer: '/schema', value: value.schema } : null;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// An event this reader cannot validate is "newer", not corrupt, when it names a higher event schema, or
|
|
144
|
+
// when it is intact (its own digest matches: the bytes are what a writer wrote) and names an event kind
|
|
145
|
+
// or coordination mode this reader does not know. Everything else stays STORE_CORRUPT.
|
|
146
|
+
function newerEventValue(event) {
|
|
147
|
+
const schema = newerSchema(event, 'todo_event');
|
|
148
|
+
if (schema !== null) return schema;
|
|
149
|
+
let intact = false;
|
|
150
|
+
try { intact = isTodoDigest(event?.event_digest) && event.event_digest === todoSelfDigest(event, 'event_digest'); } catch { /* not intact */ }
|
|
151
|
+
if (!intact) return null;
|
|
152
|
+
if (vocabularyWord(event.kind) && !TODO_EVENT_KINDS.includes(event.kind)) return { pointer: '/kind', value: event.kind };
|
|
153
|
+
const mode = event.kind === 'coordination_mode' ? event.payload?.mode : undefined;
|
|
154
|
+
return vocabularyWord(mode) && !TODO_COORDINATION_MODES.includes(mode) ? { pointer: '/payload/mode', value: mode } : null;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
function failNewer({ pointer, value }, ref) {
|
|
158
|
+
fail('UNSUPPORTED_SCHEMA', 'newer_lattice_value', {
|
|
159
|
+
...(ref === null ? {} : { ref }), pointer, value, reader_version: packageJson.version,
|
|
160
|
+
required_version: `>${packageJson.version}`,
|
|
161
|
+
next_action: upgradeAction(`The value '${value}' at ${pointer}${ref === null ? '' : ` in ${ref}`}`),
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/** Side records outside the lifecycle (the notice ack set) use the same upgrade refusal. */
|
|
166
|
+
export function rejectNewerTodoSchema(value, family, ref) {
|
|
167
|
+
const newer = newerSchema(value, family);
|
|
168
|
+
if (newer !== null) failNewer(newer, ref);
|
|
169
|
+
}
|
|
170
|
+
|
|
125
171
|
function requireWriter(writer, caller) {
|
|
126
172
|
if (!exactRecord(writer, ['schema', 'caller']) || writer.schema !== 'lattice.todo_store_writer.v1'
|
|
127
173
|
|| writer.caller !== caller) throw new TypeError(`writer capability for ${caller} required`);
|
|
@@ -169,7 +215,11 @@ function parseCanonicalJsonLine(bytes, { code, reason, maxBytes, validate, ref =
|
|
|
169
215
|
let expected;
|
|
170
216
|
try { expected = `${canonicalizeTodoArtifact(value)}\n`; } catch { fail(code, reason, detail); }
|
|
171
217
|
if (text !== expected) fail(code, 'non_canonical_or_duplicate_key', detail);
|
|
172
|
-
if (!validate(value))
|
|
218
|
+
if (!validate(value)) {
|
|
219
|
+
const newer = NEWER_SCHEMA_FAMILY.has(validate) ? newerSchema(value, NEWER_SCHEMA_FAMILY.get(validate)) : null;
|
|
220
|
+
if (newer !== null) failNewer(newer, ref);
|
|
221
|
+
fail(code, 'schema_invalid', detail);
|
|
222
|
+
}
|
|
173
223
|
return value;
|
|
174
224
|
}
|
|
175
225
|
|
|
@@ -208,7 +258,11 @@ function parseJournalSegment(bytes, ref = null) {
|
|
|
208
258
|
let canonical;
|
|
209
259
|
try { canonical = canonicalizeTodoArtifact(event); } catch { fail('STORE_CORRUPT', 'journal_schema_invalid'); }
|
|
210
260
|
if (line !== canonical) fail('STORE_CORRUPT', 'journal_non_canonical_or_duplicate_key');
|
|
211
|
-
if (!validateTodoEvent(event))
|
|
261
|
+
if (!validateTodoEvent(event)) {
|
|
262
|
+
const newer = newerEventValue(event);
|
|
263
|
+
if (newer !== null) failNewer(newer, ref);
|
|
264
|
+
fail('STORE_CORRUPT', 'journal_schema_invalid');
|
|
265
|
+
}
|
|
212
266
|
return event;
|
|
213
267
|
});
|
|
214
268
|
}
|
|
@@ -2050,7 +2104,7 @@ export async function readTodoStoreForDisplay({ repoRoot = process.cwd(), now }
|
|
|
2050
2104
|
return { state: 'unavailable', store: null, verified_at: null, source: null, inconsistency, dropped_members: dropped };
|
|
2051
2105
|
}
|
|
2052
2106
|
|
|
2053
|
-
async function atomicWrite(absolute, bytes) {
|
|
2107
|
+
export async function atomicWrite(absolute, bytes) {
|
|
2054
2108
|
await mkdir(path.dirname(absolute), { recursive: true });
|
|
2055
2109
|
const temporary = path.join(path.dirname(absolute), `.${path.basename(absolute)}.${process.pid}.${randomBytes(6).toString('hex')}.tmp`);
|
|
2056
2110
|
let handle;
|
|
@@ -3377,13 +3431,17 @@ export async function initializeTodoStore(options = {}) {
|
|
|
3377
3431
|
const sameDirectoryIdentity = (left, right) => left !== null && right !== null
|
|
3378
3432
|
&& left.dev === right.dev && left.ino === right.ino;
|
|
3379
3433
|
|
|
3380
|
-
|
|
3434
|
+
// Host-local notice ack sets (and their temp files) of a store that is gone; see todo-notice-store.mjs.
|
|
3435
|
+
const NOTICE_ACK_RESIDUE = /^(?:\.gitignore|\.?[0-9a-f]{16}\.json(?:\.\d+\.[0-9a-f]{12}\.tmp)?)$/u;
|
|
3436
|
+
|
|
3437
|
+
async function transientStoreDirectory(root, allowNotes = true, allowAcks = false) {
|
|
3381
3438
|
for (const entry of await readdir(root, { withFileTypes: true })) {
|
|
3382
|
-
if (entry.isFile() && (entry.name === '.write.lock' || /^\.write\.lock\..+\.(?:tmp|stale)$/u.test(entry.name)
|
|
3439
|
+
if (entry.isFile() && (entry.name === '.write.lock' || /^\.write\.lock\..+\.(?:tmp|stale)$/u.test(entry.name)
|
|
3440
|
+
|| (allowAcks && NOTICE_ACK_RESIDUE.test(entry.name)))) continue;
|
|
3383
3441
|
if (!entry.isDirectory()) return false;
|
|
3384
3442
|
const child = path.join(root, entry.name);
|
|
3385
|
-
if (allowNotes && entry.name
|
|
3386
|
-
if (!await transientStoreDirectory(child, false)) return false;
|
|
3443
|
+
if (allowNotes && ['notes', 'notices'].includes(entry.name)) {
|
|
3444
|
+
if (!await transientStoreDirectory(child, false, entry.name === 'notices')) return false;
|
|
3387
3445
|
} else if (['.cross-plan-recovery', '.write.lock.recovery'].includes(entry.name)) {
|
|
3388
3446
|
for (const claim of await readdir(child, { withFileTypes: true })) {
|
|
3389
3447
|
if (!claim.isDirectory() || (await readdir(path.join(child, claim.name))).length !== 0) return false;
|
|
@@ -3459,6 +3517,30 @@ async function prepareAuthoredStoreRoot(repoRoot, options) {
|
|
|
3459
3517
|
});
|
|
3460
3518
|
}
|
|
3461
3519
|
}
|
|
3520
|
+
// Acks of the store that is gone name notices that cannot open again; losing them is redelivery at most.
|
|
3521
|
+
const notices = path.join(root, 'notices');
|
|
3522
|
+
const noticesIdentity = await lstat(notices).catch((error) => {
|
|
3523
|
+
if (error?.code !== 'ENOENT') throw error;
|
|
3524
|
+
return null;
|
|
3525
|
+
});
|
|
3526
|
+
if (noticesIdentity !== null) {
|
|
3527
|
+
await withStoreLock({ lockPath: path.join(notices, '.write.lock'), createParent: false }, async () => {
|
|
3528
|
+
if (!sameDirectoryIdentity(noticesIdentity, await lstat(notices))
|
|
3529
|
+
|| !await transientStoreDirectory(notices, false, true)) {
|
|
3530
|
+
fail('STORE_WRITE_CONFLICT', 'authoring_activation_path_changed');
|
|
3531
|
+
}
|
|
3532
|
+
for (const name of await readdir(notices)) {
|
|
3533
|
+
if (NOTICE_ACK_RESIDUE.test(name)) await rm(path.join(notices, name), { force: true });
|
|
3534
|
+
}
|
|
3535
|
+
});
|
|
3536
|
+
try { await rmdir(notices); }
|
|
3537
|
+
catch (error) {
|
|
3538
|
+
if (!['ENOTEMPTY', 'EEXIST'].includes(error?.code)) throw error;
|
|
3539
|
+
throw new StoreLockError('store_locked', path.join(notices, '.write.lock'), {
|
|
3540
|
+
next_action: `Confirm no writer before clearing abandoned host-local notice lock residue in ${notices}`,
|
|
3541
|
+
});
|
|
3542
|
+
}
|
|
3543
|
+
}
|
|
3462
3544
|
await protocolStage(options, 'authoring_residue_locked');
|
|
3463
3545
|
}); } catch (error) {
|
|
3464
3546
|
const gone = (await uninitializedStoreLayout(repoRoot)).identity === null;
|