@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/todo-gantt-html.mjs
CHANGED
|
@@ -4,13 +4,14 @@ import { auditPendingPhasesOf } from './todo-audit-pending.mjs';
|
|
|
4
4
|
import { serializeJsonForScript } from './todo-markdown-renderer.mjs';
|
|
5
5
|
import { renderTodoGanttSvg, TODO_GANTT_STATUS_PRESENTATION } from './todo-gantt-svg.mjs';
|
|
6
6
|
import { renderDiagramLegend, renderRightPane } from './todo-gantt-html-independence.mjs';
|
|
7
|
-
import { escapeHtmlAttribute, escapeHtmlText, refKey } from './todo-gantt-html-shared.mjs';
|
|
7
|
+
import { escapeHtmlAttribute, escapeHtmlText, noticesBannerHtml, refKey } from './todo-gantt-html-shared.mjs';
|
|
8
8
|
import { CSS, NESTED_CSS } from './todo-gantt-html-style.mjs';
|
|
9
9
|
import { TODO_STRUCTURE_PRESENTATION_SCHEMA } from './todo-structure-presentation.mjs';
|
|
10
10
|
|
|
11
11
|
export const TODO_GANTT_RENDERER_VERSION = 'lattice.todo_gantt_renderer.v20';
|
|
12
12
|
export const TODO_GANTT_PROSE_MAX_BYTES = 8 * 1024 * 1024;
|
|
13
13
|
export const TODO_GANTT_HTML_MAX_BYTES = 24 * 1024 * 1024;
|
|
14
|
+
const PROSE_OMITTED_TEXT = '(表示上限のため省略)';
|
|
14
15
|
|
|
15
16
|
function projectDisplayName(readModel, metadata) {
|
|
16
17
|
for (const candidate of [metadata?.project_display_name, metadata?.project_name]) {
|
|
@@ -69,7 +70,7 @@ function digest(value) {
|
|
|
69
70
|
* still read, because anchor verification needs them, and their size is still
|
|
70
71
|
* bounded — but they are not rendered into the page.
|
|
71
72
|
*/
|
|
72
|
-
function normalizeSections(readModel, narratives, anchorOutcomes, noteContexts) {
|
|
73
|
+
function normalizeSections(readModel, narratives, anchorOutcomes, noteContexts, omitProse = false) {
|
|
73
74
|
const supplied = new Map(narratives.map((entry) => [refKey(entry.ref), entry]));
|
|
74
75
|
const outcomes = new Map(anchorOutcomes.map((entry) => [refKey(entry.ref), entry]));
|
|
75
76
|
const notes = noteContexts === null ? null : new Map(noteContexts.map((entry) => [
|
|
@@ -78,6 +79,13 @@ function normalizeSections(readModel, narratives, anchorOutcomes, noteContexts)
|
|
|
78
79
|
const result = [];
|
|
79
80
|
const counted = new Set();
|
|
80
81
|
let proseBytes = 0;
|
|
82
|
+
// u03 D-gantt: prose over the budget is left out of the page (and counted here), never refused.
|
|
83
|
+
const omitted = { design_memo: 0, done_condition: 0, narrative: 0, notes: 0 };
|
|
84
|
+
const fits = (bytes) => {
|
|
85
|
+
if (omitProse || proseBytes + bytes > TODO_GANTT_PROSE_MAX_BYTES) return false;
|
|
86
|
+
proseBytes += bytes;
|
|
87
|
+
return true;
|
|
88
|
+
};
|
|
81
89
|
for (const member of readModel.members) {
|
|
82
90
|
const states = new Map(member.tasks.map((state) => [state.task_id, state]));
|
|
83
91
|
for (const task of member.plan.tasks) {
|
|
@@ -87,47 +95,46 @@ function normalizeSections(readModel, narratives, anchorOutcomes, noteContexts)
|
|
|
87
95
|
const narrative = supplied.get(refKey(ref));
|
|
88
96
|
const markdown = narrative?.markdown ?? '';
|
|
89
97
|
const narrativeRef = narrative?.narrative_ref ?? task.narrative_ref;
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}
|
|
98
|
+
// 終了条件(u12)も設計メモと同じ埋め込み散文として数える。
|
|
99
|
+
let shownTask = task;
|
|
100
|
+
for (const field of ['design_memo', 'done_condition']) {
|
|
101
|
+
if (typeof task[field] !== 'string' || fits(Buffer.byteLength(task[field], 'utf8'))) continue;
|
|
102
|
+
omitted[field] += 1;
|
|
103
|
+
shownTask = { ...shownTask, [field]: PROSE_OMITTED_TEXT };
|
|
97
104
|
}
|
|
98
105
|
// ToDos that share one narrative document count its bytes once.
|
|
99
106
|
const documentKey = narrativeRef === null
|
|
100
107
|
? refKey(ref) : JSON.stringify([member.plan.plan_key, narrativeRef, digest(markdown)]);
|
|
101
108
|
if (!counted.has(documentKey)) {
|
|
102
109
|
counted.add(documentKey);
|
|
103
|
-
|
|
104
|
-
if (
|
|
105
|
-
throw new TodoGanttRenderError('TODO_SCALE_EXCEEDED', 'todo gantt embedded prose limit exceeded', {
|
|
106
|
-
prose_bytes: proseBytes, prose_limit: TODO_GANTT_PROSE_MAX_BYTES,
|
|
107
|
-
});
|
|
108
|
-
}
|
|
110
|
+
// The narrative is never rendered into the page, so leaving it out changes nothing visible.
|
|
111
|
+
if (!fits(Buffer.byteLength(markdown, 'utf8'))) omitted.narrative += 1;
|
|
109
112
|
}
|
|
110
113
|
const anchorOutcome = outcomes.get(refKey(ref)) ?? {
|
|
111
114
|
ref, narrative_ref: narrativeRef, anchored: false, reason: 'anchor_missing',
|
|
112
115
|
origin_line: task.narrative_anchor?.origin_line ?? null,
|
|
113
116
|
};
|
|
114
|
-
|
|
115
|
-
if (noteContext !== null)
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
throw new TodoGanttRenderError('TODO_SCALE_EXCEEDED', 'todo gantt embedded prose limit exceeded', {
|
|
121
|
-
prose_bytes: proseBytes, prose_limit: TODO_GANTT_PROSE_MAX_BYTES,
|
|
122
|
-
});
|
|
123
|
-
}
|
|
117
|
+
let noteContext = notes?.get(refKey(ref)) ?? null;
|
|
118
|
+
if (noteContext !== null && !fits(noteContext.notes.reduce((bytes, note) => (
|
|
119
|
+
bytes + Buffer.byteLength(note.body, 'utf8')
|
|
120
|
+
), 0))) {
|
|
121
|
+
omitted.notes += 1;
|
|
122
|
+
noteContext = null;
|
|
124
123
|
}
|
|
125
124
|
result.push({
|
|
126
|
-
ref, task, state: states.get(task.task_id), narrativeRef, anchorOutcome, noteContext,
|
|
125
|
+
ref, task: shownTask, state: states.get(task.task_id), narrativeRef, anchorOutcome, noteContext,
|
|
127
126
|
});
|
|
128
127
|
}
|
|
129
128
|
}
|
|
130
|
-
|
|
129
|
+
const omittedCount = Object.values(omitted).reduce((total, count) => total + count, 0);
|
|
130
|
+
const notices = omittedCount === 0 ? [] : [{
|
|
131
|
+
code: 'TODO_SCALE_EXCEEDED',
|
|
132
|
+
message: omitProse
|
|
133
|
+
? 'ページ全体の大きさが上限を超えたため、設計メモ・終了条件・作業記録を省いて描いています'
|
|
134
|
+
: '埋め込み文章が上限を超えたため、超えた分の設計メモ・終了条件・作業記録を省いて描いています',
|
|
135
|
+
detail: { prose_bytes: proseBytes, prose_limit: TODO_GANTT_PROSE_MAX_BYTES, omitted },
|
|
136
|
+
}];
|
|
137
|
+
return { sections: result, proseBytes, notices };
|
|
131
138
|
}
|
|
132
139
|
|
|
133
140
|
const CONTROLLER = `
|
|
@@ -209,6 +216,7 @@ const NESTED_CONTROLLER = `
|
|
|
209
216
|
export function renderTodoGanttHtml({
|
|
210
217
|
readModel, layout, narratives = [], anchorOutcomes = [], presentation = null, metadata = {},
|
|
211
218
|
expandedLayout = null, noteContexts = null, noteWarnings = [], structurePresentation = null,
|
|
219
|
+
notices = [],
|
|
212
220
|
}) {
|
|
213
221
|
if (readModel?.schema !== 'lattice.todo_store_read.v1' || !Array.isArray(readModel.members)) {
|
|
214
222
|
throw new TypeError('readModel must be lattice.todo_store_read.v1');
|
|
@@ -219,6 +227,7 @@ export function renderTodoGanttHtml({
|
|
|
219
227
|
throw new TypeError('noteContexts must be null or an array');
|
|
220
228
|
}
|
|
221
229
|
if (!Array.isArray(noteWarnings)) throw new TypeError('noteWarnings must be an array');
|
|
230
|
+
if (!Array.isArray(notices)) throw new TypeError('notices must be an array');
|
|
222
231
|
if (presentation !== null
|
|
223
232
|
&& (presentation?.schema !== 'lattice.todo_gantt_presentation_model.v1'
|
|
224
233
|
|| presentation.project_id !== readModel.project_id)) {
|
|
@@ -229,32 +238,44 @@ export function renderTodoGanttHtml({
|
|
|
229
238
|
|| structurePresentation.project_id !== readModel.project_id)) {
|
|
230
239
|
throw new TypeError('structurePresentation must be lattice.todo_structure_presentation.v1');
|
|
231
240
|
}
|
|
232
|
-
const
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
});
|
|
252
|
-
const html = `<!doctype html><html lang="ja"><head><meta http-equiv="Content-Security-Policy" content="default-src 'none'; script-src 'unsafe-inline'; style-src 'unsafe-inline'"><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Lattice — ${escapeHtmlText(displayName)} 依存工程図</title><style>${CSS}${hasHierarchy ? NESTED_CSS : ''}</style></head><body data-gantt-root data-view-state="overview"><main class="shell"><section class="gantt-pane" aria-label="${escapeHtmlAttribute(displayName)} 依存工程図"><div class="diagram-toolbar" role="group" aria-label="図のズーム"><strong class="project-heading">${escapeHtmlText(displayName)} 依存工程図</strong>${renderAuditPendingChip(readModel)}<button type="button" data-zoom-action="out" aria-label="縮小">−</button><button type="button" data-zoom-action="reset">等倍</button><button type="button" data-zoom-action="in" aria-label="拡大">+</button><button type="button" data-zoom-action="fit">全体表示</button><output class="zoom-readout" data-zoom-output aria-live="polite">100%</output><span class="diagram-note">縦=依存段階(時間ではない)</span></div>${renderDiagramLegend(presentation, layout, expandedSvg !== '')}<div class="diagram-scroll" data-diagram-scroll tabindex="0" aria-label="縦方向を主にスクロール可能な依存工程図">${diagrams}</div></section><div class="pane-divider" data-pane-divider aria-hidden="true"></div><aside class="narrative-pane" aria-label="選択工程の詳細と全工程一覧">${rightPane}</aside></main><script type="application/json" id="todo-gantt-data">${staticData}</script><script>${CONTROLLER}${hasHierarchy ? NESTED_CONTROLLER : ''}</script></body></html>`;
|
|
253
|
-
const htmlBytes = Buffer.byteLength(html, 'utf8');
|
|
254
|
-
if (htmlBytes > TODO_GANTT_HTML_MAX_BYTES) {
|
|
255
|
-
throw new TodoGanttRenderError('TODO_SCALE_EXCEEDED', 'todo gantt HTML limit exceeded', {
|
|
256
|
-
html_bytes: htmlBytes, html_limit: TODO_GANTT_HTML_MAX_BYTES,
|
|
241
|
+
const build = (normalized, pageNotices) => {
|
|
242
|
+
const displayName = projectDisplayName(readModel, metadata);
|
|
243
|
+
const hasHierarchy = layout?.hierarchy?.schema === 'lattice.todo_gantt_hierarchy.v1';
|
|
244
|
+
const svg = renderTodoGanttSvg(layout, { presentation });
|
|
245
|
+
// The expanded diagram travels with the page so the badge can bring the
|
|
246
|
+
// history back without a round trip. A file:// artifact has nowhere to ask.
|
|
247
|
+
const expandedSvg = expandedLayout === null ? '' : renderTodoGanttSvg(expandedLayout, { presentation });
|
|
248
|
+
const diagrams = expandedSvg === ''
|
|
249
|
+
? `<div data-diagram="live">${svg}</div>`
|
|
250
|
+
: `<div data-diagram="live">${svg}</div><div data-diagram="expanded" hidden>${expandedSvg}</div>`;
|
|
251
|
+
const rightPane = renderRightPane(
|
|
252
|
+
normalized.sections, layout, presentation, readModel, noteContexts !== null, noteWarnings,
|
|
253
|
+
expandedSvg !== '', structurePresentation,
|
|
254
|
+
);
|
|
255
|
+
const staticData = serializeJsonForScript({
|
|
256
|
+
renderer_version: TODO_GANTT_RENDERER_VERSION,
|
|
257
|
+
metadata,
|
|
258
|
+
presentation,
|
|
259
|
+
structure_presentation: structurePresentation,
|
|
257
260
|
});
|
|
261
|
+
const html = `<!doctype html><html lang="ja"><head><meta http-equiv="Content-Security-Policy" content="default-src 'none'; script-src 'unsafe-inline'; style-src 'unsafe-inline'"><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Lattice — ${escapeHtmlText(displayName)} 依存工程図</title><style>${CSS}${hasHierarchy ? NESTED_CSS : ''}</style></head><body data-gantt-root data-view-state="overview"><main class="shell"><section class="gantt-pane" aria-label="${escapeHtmlAttribute(displayName)} 依存工程図"><div class="diagram-toolbar" role="group" aria-label="図のズーム"><strong class="project-heading">${escapeHtmlText(displayName)} 依存工程図</strong>${renderAuditPendingChip(readModel)}<button type="button" data-zoom-action="out" aria-label="縮小">−</button><button type="button" data-zoom-action="reset">等倍</button><button type="button" data-zoom-action="in" aria-label="拡大">+</button><button type="button" data-zoom-action="fit">全体表示</button><output class="zoom-readout" data-zoom-output aria-live="polite">100%</output><span class="diagram-note">縦=依存段階(時間ではない)</span></div>${renderDiagramLegend(presentation, layout, expandedSvg !== '', noticesBannerHtml(pageNotices))}<div class="diagram-scroll" data-diagram-scroll tabindex="0" aria-label="縦方向を主にスクロール可能な依存工程図">${diagrams}</div></section><div class="pane-divider" data-pane-divider aria-hidden="true"></div><aside class="narrative-pane" aria-label="選択工程の詳細と全工程一覧">${rightPane}</aside></main><script type="application/json" id="todo-gantt-data">${staticData}</script><script>${CONTROLLER}${hasHierarchy ? NESTED_CONTROLLER : ''}</script></body></html>`;
|
|
262
|
+
return html;
|
|
263
|
+
};
|
|
264
|
+
const layoutNotices = [...(layout?.notices ?? []), ...notices];
|
|
265
|
+
let normalized = normalizeSections(readModel, narratives, anchorOutcomes, noteContexts);
|
|
266
|
+
let pageNotices = [...layoutNotices, ...normalized.notices];
|
|
267
|
+
let html = build(normalized, pageNotices);
|
|
268
|
+
let htmlBytes = Buffer.byteLength(html, 'utf8');
|
|
269
|
+
if (htmlBytes > TODO_GANTT_HTML_MAX_BYTES) {
|
|
270
|
+
// u03 D-gantt: draw the page without the embedded prose; if it is still over, serve it with the notice.
|
|
271
|
+
normalized = normalizeSections(readModel, narratives, anchorOutcomes, noteContexts, true);
|
|
272
|
+
pageNotices = [...layoutNotices, { code: 'TODO_SCALE_EXCEEDED',
|
|
273
|
+
message: 'ページ全体の大きさが上限を超えたため、設計メモ・終了条件・作業記録を省いて描いています',
|
|
274
|
+
detail: { html_bytes: htmlBytes, html_limit: TODO_GANTT_HTML_MAX_BYTES } }];
|
|
275
|
+
html = build(normalized, pageNotices);
|
|
276
|
+
htmlBytes = Buffer.byteLength(html, 'utf8');
|
|
258
277
|
}
|
|
259
|
-
return {
|
|
278
|
+
return {
|
|
279
|
+
html, html_digest: digest(html), prose_bytes: normalized.proseBytes, html_bytes: htmlBytes, notices: pageNotices,
|
|
280
|
+
};
|
|
260
281
|
}
|
|
@@ -2,10 +2,13 @@ import { TODO_GANTT_SCOPES, projectTodoGanttScope } from './todo-gantt-scope.mjs
|
|
|
2
2
|
import { buildTodoGanttHierarchy } from './todo-gantt-nested.mjs';
|
|
3
3
|
import { projectTodoCrossPlanDependencies } from './todo-store.mjs';
|
|
4
4
|
import { projectTodoChainV1 } from './todo-chain.mjs';
|
|
5
|
+
import { createTodoReadiness } from './todo-readiness.mjs';
|
|
5
6
|
|
|
6
7
|
const TASK_LIMIT = 2_000;
|
|
7
8
|
const EDGE_LIMIT = 8_000;
|
|
8
9
|
const SWEEP_ROUNDS = 4;
|
|
10
|
+
// A notice names at most this many refs; the count always covers all of them.
|
|
11
|
+
const NOTICE_SAMPLE = 20;
|
|
9
12
|
|
|
10
13
|
/** Columns for a stage made only of ToDos with no registered dependency. */
|
|
11
14
|
const LOOSE_COLUMNS_MINIMUM = 8;
|
|
@@ -107,11 +110,10 @@ function compareText(left, right) {
|
|
|
107
110
|
return left < right ? -1 : left > right ? 1 : 0;
|
|
108
111
|
}
|
|
109
112
|
|
|
110
|
-
|
|
113
|
+
// null when the value is not a task ref; the caller skips what it cannot draw.
|
|
114
|
+
function refOf(value) {
|
|
111
115
|
if (!plain(value) || typeof value.project_id !== 'string'
|
|
112
|
-
|| typeof value.plan_key !== 'string' || typeof value.task_id !== 'string')
|
|
113
|
-
fail('TODO_LAYOUT_INVALID_INPUT', `${context} must be a task ref`);
|
|
114
|
-
}
|
|
116
|
+
|| typeof value.plan_key !== 'string' || typeof value.task_id !== 'string') return null;
|
|
115
117
|
return { project_id: value.project_id, plan_key: value.plan_key, task_id: value.task_id };
|
|
116
118
|
}
|
|
117
119
|
|
|
@@ -135,6 +137,7 @@ function normalizeInput(readModel) {
|
|
|
135
137
|
fail('TODO_LAYOUT_INVALID_INPUT', 'read model must be lattice.todo_store_read.v1');
|
|
136
138
|
}
|
|
137
139
|
|
|
140
|
+
const notices = []; // u03 D-gantt: a read-only drawing draws what it can and says what it left out
|
|
138
141
|
const nodesByKey = new Map();
|
|
139
142
|
const retiredKeys = new Set(); // 撤去済みtask。端点に持つ辺は図から一緒に消す
|
|
140
143
|
const members = [...readModel.members].sort((left, right) => {
|
|
@@ -191,22 +194,30 @@ function normalizeInput(readModel) {
|
|
|
191
194
|
});
|
|
192
195
|
}
|
|
193
196
|
}
|
|
197
|
+
const droppedKeys = new Set(); // 上限で描かないtask。端点に持つ辺は黙って除く(通知は件数で済む)
|
|
194
198
|
if (nodesByKey.size > TASK_LIMIT) {
|
|
195
|
-
|
|
196
|
-
|
|
199
|
+
const kept = [...nodesByKey.values()].sort((left, right) => compareRefs(left.ref, right.ref));
|
|
200
|
+
for (const node of kept.slice(TASK_LIMIT)) { nodesByKey.delete(node.key); droppedKeys.add(node.key); }
|
|
201
|
+
notices.push({
|
|
202
|
+
code: 'TODO_SCALE_EXCEEDED',
|
|
203
|
+
message: `工程数が上限を超えたため、並び順の先頭${TASK_LIMIT}件だけを描いています(${droppedKeys.size}件を除外)`,
|
|
204
|
+
detail: { task_count: kept.length, task_limit: TASK_LIMIT, dropped_task_count: droppedKeys.size },
|
|
197
205
|
});
|
|
198
206
|
}
|
|
199
207
|
|
|
200
208
|
const edgeMap = new Map();
|
|
209
|
+
const skippedEdges = [];
|
|
210
|
+
const skipEdge = (from, to, reason) => skippedEdges.push({ from, to, reason });
|
|
201
211
|
const addEdge = (fromValue, toValue, kind, joinIdentity = null) => {
|
|
202
|
-
const fromRef = refOf(fromValue
|
|
203
|
-
const toRef = refOf(toValue
|
|
212
|
+
const fromRef = refOf(fromValue);
|
|
213
|
+
const toRef = refOf(toValue);
|
|
214
|
+
if (fromRef === null || toRef === null) return skipEdge(fromRef && refKey(fromRef), toRef && refKey(toRef), 'not_a_task_ref');
|
|
204
215
|
const from = refKey(fromRef);
|
|
205
216
|
const to = refKey(toRef);
|
|
206
217
|
if (retiredKeys.has(from) || retiredKeys.has(to)) return; // 撤去済み端点の辺は描かない
|
|
207
|
-
if (
|
|
208
|
-
|
|
209
|
-
|
|
218
|
+
if (droppedKeys.has(from) || droppedKeys.has(to)) return;
|
|
219
|
+
if (from === to) return skipEdge(from, to, 'self_edge');
|
|
220
|
+
if (!nodesByKey.has(from) || !nodesByKey.has(to)) return skipEdge(from, to, 'endpoint_not_in_read_model');
|
|
210
221
|
const key = JSON.stringify([from, to]);
|
|
211
222
|
let edge = edgeMap.get(key);
|
|
212
223
|
if (edge === undefined) {
|
|
@@ -222,10 +233,11 @@ function normalizeInput(readModel) {
|
|
|
222
233
|
}
|
|
223
234
|
};
|
|
224
235
|
for (const member of members) {
|
|
225
|
-
for (const edge of member.plan.hard_dependencies) addEdge(edge
|
|
236
|
+
for (const edge of member.plan.hard_dependencies) addEdge(edge?.from, edge?.to, 'hard');
|
|
226
237
|
for (const join of member.plan.joins) {
|
|
227
238
|
if (!plain(join) || !Array.isArray(join.after) || typeof join.id !== 'string') {
|
|
228
|
-
|
|
239
|
+
skipEdge(null, null, 'join_invalid_shape');
|
|
240
|
+
continue;
|
|
229
241
|
}
|
|
230
242
|
const identity = { project_id: member.plan.project_id, plan_key: member.plan.plan_key,
|
|
231
243
|
join_id: join.id };
|
|
@@ -235,53 +247,106 @@ function normalizeInput(readModel) {
|
|
|
235
247
|
for (const dependency of projectTodoCrossPlanDependencies(members)) {
|
|
236
248
|
addEdge(dependency.from, dependency.to, 'cross_plan');
|
|
237
249
|
}
|
|
238
|
-
if (
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
250
|
+
if (skippedEdges.length > 0) {
|
|
251
|
+
notices.push({
|
|
252
|
+
code: 'TODO_LAYOUT_INVALID_INPUT',
|
|
253
|
+
message: `端点を図に描けない依存${skippedEdges.length}件を除いて描いています`,
|
|
254
|
+
detail: { skipped_edge_count: skippedEdges.length, skipped_edges: skippedEdges.slice(0, NOTICE_SAMPLE) },
|
|
242
255
|
});
|
|
243
256
|
}
|
|
244
257
|
|
|
245
258
|
const nodes = [...nodesByKey.values()].sort((left, right) => compareRefs(left.ref, right.ref));
|
|
246
|
-
|
|
247
|
-
|
|
259
|
+
let edges = [...edgeMap.values()].sort((left, right) => compareText(left.key, right.key));
|
|
260
|
+
if (edges.length > EDGE_LIMIT) {
|
|
261
|
+
notices.push({
|
|
262
|
+
code: 'TODO_SCALE_EXCEEDED',
|
|
263
|
+
message: `依存数が上限を超えたため、並び順の先頭${EDGE_LIMIT}本だけを描いています(${edges.length - EDGE_LIMIT}本を除外)`,
|
|
264
|
+
detail: { edge_count: edges.length, edge_limit: EDGE_LIMIT, dropped_edge_count: edges.length - EDGE_LIMIT },
|
|
265
|
+
});
|
|
266
|
+
edges = edges.slice(0, EDGE_LIMIT);
|
|
267
|
+
}
|
|
268
|
+
edges = breakCycles(nodes, nodesByKey, edges, notices);
|
|
269
|
+
return { nodes, nodesByKey, edges, retiredKeys, notices };
|
|
248
270
|
}
|
|
249
271
|
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
272
|
+
/**
|
|
273
|
+
* u03 D-gantt: a cycle is drawn, not refused. Nodes the topological pass cannot reach (the
|
|
274
|
+
* cycle part, with what hangs off it) are reduced to the tasks that can reach back into a
|
|
275
|
+
* cycle; among those, taken in ref order, each edge that points back to an earlier one is left
|
|
276
|
+
* out, so the rest is acyclic and every later step terminates. The notice names every cut edge.
|
|
277
|
+
*/
|
|
278
|
+
function breakCycles(nodes, nodesByKey, edges, notices) {
|
|
279
|
+
const indegree = new Map(nodes.map(({ key }) => [key, 0]));
|
|
280
|
+
const outgoing = new Map(nodes.map(({ key }) => [key, []]));
|
|
281
|
+
for (const edge of edges) { indegree.set(edge.to, indegree.get(edge.to) + 1); outgoing.get(edge.from).push(edge.to); }
|
|
282
|
+
const queue = nodes.filter(({ key }) => indegree.get(key) === 0).map(({ key }) => key);
|
|
283
|
+
const visited = new Set();
|
|
284
|
+
while (queue.length > 0) {
|
|
285
|
+
const current = queue.pop();
|
|
286
|
+
visited.add(current);
|
|
287
|
+
for (const next of outgoing.get(current)) {
|
|
288
|
+
indegree.set(next, indegree.get(next) - 1);
|
|
289
|
+
if (indegree.get(next) === 0) queue.push(next);
|
|
259
290
|
}
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
291
|
+
}
|
|
292
|
+
if (visited.size === nodes.length) return edges;
|
|
293
|
+
// Peel what only hangs below a cycle (no way back into it), so only cycle tasks lose edges.
|
|
294
|
+
const core = new Set(nodes.filter(({ key }) => !visited.has(key)).map(({ key }) => key));
|
|
295
|
+
const outdegree = new Map([...core].map((key) => [key, 0]));
|
|
296
|
+
const incoming = new Map([...core].map((key) => [key, []]));
|
|
297
|
+
for (const edge of edges) {
|
|
298
|
+
if (core.has(edge.from) && core.has(edge.to)) {
|
|
299
|
+
outdegree.set(edge.from, outdegree.get(edge.from) + 1); incoming.get(edge.to).push(edge.from);
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
const leaves = [...core].filter((key) => outdegree.get(key) === 0);
|
|
303
|
+
while (leaves.length > 0) {
|
|
304
|
+
const leaf = leaves.pop();
|
|
305
|
+
core.delete(leaf);
|
|
306
|
+
for (const from of incoming.get(leaf)) {
|
|
307
|
+
outdegree.set(from, outdegree.get(from) - 1);
|
|
308
|
+
if (outdegree.get(from) === 0) leaves.push(from);
|
|
271
309
|
}
|
|
272
310
|
}
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
311
|
+
const rank = new Map(nodes.filter(({ key }) => core.has(key)).map(({ key }, index) => [key, index]));
|
|
312
|
+
const cut = [];
|
|
313
|
+
const kept = edges.filter((edge) => {
|
|
314
|
+
if (!rank.has(edge.from) || !rank.has(edge.to) || rank.get(edge.from) < rank.get(edge.to)) return true;
|
|
315
|
+
cut.push(edge);
|
|
316
|
+
return false;
|
|
317
|
+
});
|
|
318
|
+
notices.push({
|
|
319
|
+
code: 'TODO_LAYOUT_CYCLE',
|
|
320
|
+
message: `依存が循環しているため、循環部分の工程${rank.size}件の戻り方向の依存${cut.length}本を除いて描いています`,
|
|
321
|
+
detail: {
|
|
322
|
+
cycle_task_count: rank.size,
|
|
323
|
+
cycle_tasks: [...rank.keys()].slice(0, NOTICE_SAMPLE).map((key) => nodesByKey.get(key).ref),
|
|
324
|
+
cut_edge_count: cut.length,
|
|
325
|
+
cut_edges: cut.slice(0, NOTICE_SAMPLE).map((edge) => ({
|
|
326
|
+
from: nodesByKey.get(edge.from).ref, to: nodesByKey.get(edge.to).ref,
|
|
327
|
+
})),
|
|
328
|
+
},
|
|
329
|
+
});
|
|
330
|
+
return kept;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
// u03 D-gantt: the drawing never decides readiness itself. Lattice's readiness (the same one
|
|
334
|
+
// status and start use) decides, so a successor of a retired-not-done task is not drawn ready.
|
|
335
|
+
function readyTaskKeys(readModel, nodes) {
|
|
336
|
+
// Readiness reads the raw edge lists; hand it only the edges normalizeInput can draw, so a
|
|
337
|
+
// malformed one (skipped with a notice) does not stop the page here.
|
|
338
|
+
const drawable = (edge) => refOf(edge?.from) !== null && refOf(edge?.to) !== null;
|
|
339
|
+
const members = readModel.members.map((member) => ({
|
|
340
|
+
...member,
|
|
341
|
+
plan: {
|
|
342
|
+
...member.plan,
|
|
343
|
+
hard_dependencies: member.plan.hard_dependencies.filter(drawable),
|
|
344
|
+
joins: member.plan.joins.filter((join) => plain(join) && Array.isArray(join.after)
|
|
345
|
+
&& join.after.every((after) => refOf(after) !== null) && refOf(join.before) !== null),
|
|
346
|
+
},
|
|
347
|
+
}));
|
|
348
|
+
const readiness = createTodoReadiness({ ...readModel, members });
|
|
349
|
+
return new Set(nodes.filter((node) => readiness.isReady(readiness.key(node.ref))).map(({ key }) => key));
|
|
285
350
|
}
|
|
286
351
|
|
|
287
352
|
function assignWaves(nodes, nodesByKey, edges) {
|
|
@@ -311,6 +376,7 @@ function assignWaves(nodes, nodesByKey, edges) {
|
|
|
311
376
|
}
|
|
312
377
|
}
|
|
313
378
|
}
|
|
379
|
+
// normalizeInput's breakCycles leaves no cycle; this only guards that invariant.
|
|
314
380
|
if (visited !== nodes.length) fail('TODO_LAYOUT_CYCLE', 'todo layout input contains a cycle');
|
|
315
381
|
return { incoming, outgoing, wave };
|
|
316
382
|
}
|
|
@@ -399,13 +465,14 @@ function crossingCount(edges, wave, transversePosition) {
|
|
|
399
465
|
* 読み出しはasync I/Oとgit実行を伴うためCLI層が行い、ここへは値として渡る。
|
|
400
466
|
* layoutは同期pureのままに保つ。
|
|
401
467
|
*/
|
|
402
|
-
function normalizeIndependence(value, nodesByKey) {
|
|
468
|
+
function normalizeIndependence(value, nodesByKey, notices) {
|
|
403
469
|
if (value === null || value === undefined) return { stateByKey: new Map(), summary: null };
|
|
404
470
|
if (!Array.isArray(value)) {
|
|
405
471
|
fail('TODO_LAYOUT_INVALID_INPUT', 'independence must be an array of plan projections');
|
|
406
472
|
}
|
|
407
473
|
const stateByKey = new Map();
|
|
408
474
|
const plans = [];
|
|
475
|
+
const drifted = [];
|
|
409
476
|
for (const projection of value) {
|
|
410
477
|
if (!plain(projection) || typeof projection.plan_key !== 'string'
|
|
411
478
|
|| typeof projection.coverage !== 'string' || !plain(projection.frontier)) {
|
|
@@ -417,11 +484,10 @@ function normalizeIndependence(value, nodesByKey) {
|
|
|
417
484
|
project_id: projection.project_id, plan_key: planKey, task_id: taskId,
|
|
418
485
|
});
|
|
419
486
|
// 図に無いtaskへ状態を付けない。layoutのready判定と投影のready判定が食い違えば、
|
|
420
|
-
//
|
|
487
|
+
// 印を付けずに通知で露見させる(読むだけの図は拒まない)。
|
|
421
488
|
if (!nodesByKey.has(key)) {
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
});
|
|
489
|
+
drifted.push({ plan_key: planKey, task_id: taskId });
|
|
490
|
+
return;
|
|
425
491
|
}
|
|
426
492
|
stateByKey.set(key, state);
|
|
427
493
|
};
|
|
@@ -452,6 +518,13 @@ function normalizeIndependence(value, nodesByKey) {
|
|
|
452
518
|
});
|
|
453
519
|
}
|
|
454
520
|
plans.sort((left, right) => compareText(left.plan_key, right.plan_key));
|
|
521
|
+
if (drifted.length > 0) {
|
|
522
|
+
notices.push({
|
|
523
|
+
code: 'TODO_LAYOUT_INDEPENDENCE_DRIFT',
|
|
524
|
+
message: `独立性の記録が図に無い工程${drifted.length}件を指しているため、その工程には印を付けていません`,
|
|
525
|
+
detail: { drifted_count: drifted.length, drifted_tasks: drifted.slice(0, NOTICE_SAMPLE) },
|
|
526
|
+
});
|
|
527
|
+
}
|
|
455
528
|
return { stateByKey, summary: { plans } };
|
|
456
529
|
}
|
|
457
530
|
|
|
@@ -547,8 +620,8 @@ function layoutTodoGanttFlat(readModel, options = {}) {
|
|
|
547
620
|
});
|
|
548
621
|
const longestNodeKeys = new Set(chain.longest_chain_node_refs.map(refKey));
|
|
549
622
|
const longestEdgeKeys = new Set(chain.longest_chain_edges.map(edge => JSON.stringify([refKey(edge.from), refKey(edge.to)])));
|
|
550
|
-
const readyKeys = readyTaskKeys(readModel, full.nodes
|
|
551
|
-
const independence = normalizeIndependence(options.independence ?? null, full.nodesByKey);
|
|
623
|
+
const readyKeys = readyTaskKeys(readModel, full.nodes);
|
|
624
|
+
const independence = normalizeIndependence(options.independence ?? null, full.nodesByKey, full.notices);
|
|
552
625
|
const seamProposals = normalizeSeamProposals(options.seamProposals ?? null);
|
|
553
626
|
|
|
554
627
|
// Only the geometry stage below sees the narrowed graph.
|
|
@@ -888,6 +961,9 @@ function layoutTodoGanttFlat(readModel, options = {}) {
|
|
|
888
961
|
.map((taskKey) => JSON.parse(taskKey))
|
|
889
962
|
.map(([project_id, plan_key, task_id]) => ({ project_id, plan_key, task_id }))
|
|
890
963
|
.sort(compareRefs),
|
|
964
|
+
// u03 D-gantt: what the drawing left out or bent instead of refusing, each as {code, message, detail}.
|
|
965
|
+
// Absent when there is nothing to say, so a clean layout keeps its bytes (and digest).
|
|
966
|
+
...(full.notices.length > 0 ? { notices: full.notices } : {}),
|
|
891
967
|
metrics: {
|
|
892
968
|
crossing_count: crossingCount(edges, wave, transversePosition),
|
|
893
969
|
visible_node_count: visibleKeys.size,
|
|
@@ -943,11 +1019,13 @@ export function layoutTodoGantt(readModel, options = {}) {
|
|
|
943
1019
|
? fullLayout : layoutTodoGanttFlat(readModel, { ...options, scope: 'all' });
|
|
944
1020
|
const semanticByKey = new Map(semanticLayout.nodes.map((node) => [refKey(node.ref), node]));
|
|
945
1021
|
const semanticRoot = applyHierarchySemantics(nested.root, semanticByKey);
|
|
946
|
-
|
|
1022
|
+
// The levels' own notices repeat or partly cover the whole graph's; the whole graph's are the ones to show.
|
|
1023
|
+
const { notices: _levelNotices, ...rootLayout } = semanticRoot.layout;
|
|
947
1024
|
return {
|
|
948
1025
|
...rootLayout,
|
|
949
1026
|
full_edges: fullLayout.full_edges,
|
|
950
1027
|
groups: fullLayout.groups,
|
|
1028
|
+
...(fullLayout.notices === undefined ? {} : { notices: fullLayout.notices }),
|
|
951
1029
|
scope: fullLayout.scope,
|
|
952
1030
|
folded: fullLayout.folded,
|
|
953
1031
|
hierarchy_nodes: descendantNodes(semanticRoot),
|
package/src/todo-gantt-live.mjs
CHANGED
|
@@ -60,7 +60,7 @@ function withExternalPane(html, pane) {
|
|
|
60
60
|
).replace('</body>', `${externalPaneController(pane)}</body>`);
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
function liveHtml(html, headDigest, eventsPath, externalPane = null) {
|
|
63
|
+
function liveHtml(html, headDigest, eventsPath, externalPane = null, bannerHtml = null) {
|
|
64
64
|
const controller = `<script>(()=>{const badge=document.createElement('div');badge.setAttribute('role','status');badge.style.cssText='position:fixed;right:12px;bottom:12px;z-index:99;padding:6px 10px;border:1px solid #d9d8d4;border-radius:4px;background:#fcfcfb;font:600 12px system-ui';badge.textContent='進捗: 接続中';document.body.append(badge);const head=${JSON.stringify(headDigest)};let lastReceipt=Date.now();let stream=null;const receive=event=>{const next=JSON.parse(event.data);if(typeof next.head_digest!=='string')return;lastReceipt=Date.now();badge.textContent='進捗: 最新';if(next.head_digest!==head){badge.textContent='進捗: 更新を反映中';location.reload();}};const connect=()=>{if(stream)stream.close();badge.textContent='進捗: 接続中';stream=new EventSource(${JSON.stringify(eventsPath)});stream.onopen=()=>{lastReceipt=Date.now();};stream.addEventListener('state',receive);stream.addEventListener('ping',receive);stream.addEventListener('lattice-error',event=>{lastReceipt=Date.now();const detail=JSON.parse(event.data);badge.textContent='進捗: エラー '+detail.code;badge.style.borderColor='#d03b3b';});stream.onerror=()=>{badge.textContent='進捗: 再接続中';};};connect();setInterval(()=>{if(Date.now()-lastReceipt>${SSE_STALE_MS})connect();},${SSE_WATCHDOG_MS});})();</script>`;
|
|
65
65
|
const publicMetadata = '<meta name="description" content="Latticeで管理しているプロジェクトの依存工程と進捗を確認できます。"><meta name="theme-color" content="#f7f3ea">';
|
|
66
66
|
const publicStyle = '<style>body[data-gantt-root]{grid-template-rows:auto minmax(0,1fr)}.lattice-live-brand{z-index:10;display:flex;align-items:center;gap:8px;min-width:0;padding:10px 16px;border-bottom:1px solid #d8d0c5;background:#f7f3ea;color:#6c655d;font:600 12px/1.5 system-ui,-apple-system,"Hiragino Sans","Yu Gothic UI",sans-serif}.lattice-live-brand a{color:#201d19;text-decoration:none}.lattice-live-brand a:hover{color:#315cbe}.lattice-live-brand strong{color:#201d19}.lattice-live-brand-note{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.lattice-live-back{margin-left:auto!important;color:#315cbe!important;font-weight:750}@media(max-width:560px){.lattice-live-brand{padding:9px 12px}.lattice-live-brand-note{display:none}}</style>';
|
|
@@ -68,7 +68,9 @@ function liveHtml(html, headDigest, eventsPath, externalPane = null) {
|
|
|
68
68
|
const live = html
|
|
69
69
|
.replace("default-src 'none';", "default-src 'none'; connect-src 'self';")
|
|
70
70
|
.replace('</head>', `${publicMetadata}${publicStyle}</head>`)
|
|
71
|
-
.replace(/<body([^>]*)>/u, `<body$1>${publicHeader
|
|
71
|
+
.replace(/<body([^>]*)>/u, `<body$1>${bannerHtml === null ? publicHeader
|
|
72
|
+
// The banner shares the header's grid row so the page's row layout is unchanged.
|
|
73
|
+
: `<div>${publicHeader}${bannerHtml}</div>`}`)
|
|
72
74
|
.replace('</body>', `${controller}</body>`);
|
|
73
75
|
return externalPane === null ? live : withExternalPane(live, externalPane);
|
|
74
76
|
}
|
|
@@ -286,7 +288,8 @@ export async function startTodoGanttDashboardServer({
|
|
|
286
288
|
lastHeads.set(project.projectId, rendered.head_digest);
|
|
287
289
|
// 外部ペイン設定は描画のたびにrender側が読み直す。差した/外した側は再起動を要さない。
|
|
288
290
|
const html = liveHtml(rendered.html, rendered.head_digest,
|
|
289
|
-
`${projectPath(project.projectId)}events`, rendered.external_pane ?? null
|
|
291
|
+
`${projectPath(project.projectId)}events`, rendered.external_pane ?? null,
|
|
292
|
+
rendered.banner_html ?? null);
|
|
290
293
|
response.writeHead(200, { 'content-type': 'text/html; charset=utf-8',
|
|
291
294
|
'cache-control': 'no-store', 'x-content-type-options': 'nosniff' });
|
|
292
295
|
response.end(html);
|
|
@@ -6,8 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* 文は事実と次の一歩だけを述べ、指示しない。どのreadyを取るかはhostが所有する
|
|
8
8
|
* (ADR 0063 Decision 5)。命令形にするとLatticeがagentを統制する面へ滑る。
|
|
9
|
-
*
|
|
10
|
-
* それは配車ではなく、intakeが hold する着手を journal へ書かない。
|
|
9
|
+
* 未検証の工程も start は拒否しない(u03 B1–B6、ADR 0182 を置き換える)。助言として返す。
|
|
11
10
|
*/
|
|
12
11
|
|
|
13
12
|
export const TODO_INDEPENDENCE_GUIDANCE_CODES = Object.freeze([
|
|
@@ -83,7 +82,7 @@ const CATALOG = Object.freeze({
|
|
|
83
82
|
next_action: 'declare_witness_set_then_compile',
|
|
84
83
|
}),
|
|
85
84
|
independence_task_undeclared: Object.freeze({
|
|
86
|
-
message: 'この工程はwitness setで宣言されていないため、記録には含まれていない。
|
|
85
|
+
message: 'この工程はwitness setで宣言されていないため、記録には含まれていない。',
|
|
87
86
|
next_action: 'add_task_to_witness_set_then_compile',
|
|
88
87
|
}),
|
|
89
88
|
independence_contract_superseded: Object.freeze({
|
|
@@ -175,27 +174,6 @@ const SEVERABILITY_HINT = Object.freeze({
|
|
|
175
174
|
serial: '共有stateまたはeffectの衝突なので、分割では切り離せない。',
|
|
176
175
|
});
|
|
177
176
|
|
|
178
|
-
/**
|
|
179
|
-
* 記録があるのに対象工程が未検証なら start を拒否する code。
|
|
180
|
-
* 記録が無い(independence_unrecorded)は従来どおり助言だけで通す。
|
|
181
|
-
* 競合(conflict_*)はどの ready を取るかの dispatch なので拒否しない。
|
|
182
|
-
*/
|
|
183
|
-
export const INDEPENDENCE_START_REFUSAL_CODES = Object.freeze([
|
|
184
|
-
'independence_task_undeclared',
|
|
185
|
-
'independence_stale_for_task',
|
|
186
|
-
'independence_superseded',
|
|
187
|
-
'independence_contract_superseded',
|
|
188
|
-
'independence_verdicts_absent',
|
|
189
|
-
]);
|
|
190
|
-
|
|
191
|
-
export function independenceStartRefusal(guidance) {
|
|
192
|
-
if (guidance === null || typeof guidance !== 'object' || Array.isArray(guidance)) {
|
|
193
|
-
throw new TypeError('independence start refusal guidance is invalid');
|
|
194
|
-
}
|
|
195
|
-
if (!INDEPENDENCE_START_REFUSAL_CODES.includes(guidance.code)) return null;
|
|
196
|
-
return guidance;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
177
|
export function todoIndependenceGuidance(code, { severability = null } = {}) {
|
|
200
178
|
const entry = CATALOG[code];
|
|
201
179
|
if (entry === undefined) {
|
|
@@ -328,11 +306,11 @@ export function selectSeamProposalGuidance({ coverage, unknownKinds = [] }) {
|
|
|
328
306
|
export const TODO_INDEPENDENCE_WORKFLOW = Object.freeze([
|
|
329
307
|
'1. 宣言する: .lattice/todo/witness/<plan_key>.json へ、ToDoごとのowns/reads/writes/affected_testsを書く',
|
|
330
308
|
' 係争資源しか所有していないToDoは、ownsまたはwritesの内側で自分が触るsymbolをconcern_anchorsへ宣言できる(witness set v2)。並列可否の判定には写らず、切断候補の束縛だけに効く',
|
|
331
|
-
' remaining の A 工程(まだ done でない ready / blocked)も同じ witness に含める。現在の ready だけを compile すると、次の frontier の start
|
|
309
|
+
' remaining の A 工程(まだ done でない ready / blocked)も同じ witness に含める。現在の ready だけを compile すると、次の frontier の start の助言が未検証(independence_task_undeclared)になる',
|
|
332
310
|
'2. 判定する: lattice todo independence compile --plan <key> --input <ref>(実sensorを引く。pretty-printやdigest未計算の下書きは機械が直す)。next_ready が witness に無い compile は拒否する',
|
|
333
311
|
'3. 読む: lattice todo independence --plan <key> --json(sensorを引かず、記録とHEAD照合だけで返る)',
|
|
334
312
|
'4. 追従する: plan改訂後は lattice todo independence witness migrate --plan <key> で宣言を写してから再compileする',
|
|
335
|
-
'5.
|
|
313
|
+
'5. 記録があるのに対象工程が未宣言・失効でも todo start は止まらず、助言として返る。競合の同時起動も助言のまま',
|
|
336
314
|
]);
|
|
337
315
|
|
|
338
316
|
/**
|