@quolu/lattice 0.102.1 → 0.104.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.md +17 -0
- package/package.json +1 -1
- package/src/cli-help.mjs +47 -8
- package/src/cli-refusal-guidance.mjs +18 -3
- package/src/plan-revise.mjs +4 -3
- package/src/project-cli.mjs +2 -1
- package/src/todo-cli.mjs +253 -27
- package/src/todo-contracts.mjs +37 -18
- package/src/todo-gantt-html-independence.mjs +2 -2
- package/src/todo-gantt-html-shared.mjs +30 -1
- package/src/todo-gantt-html-style.mjs +1 -0
- package/src/todo-gantt-html.mjs +7 -4
- package/src/todo-gantt-layout.mjs +2 -0
- package/src/todo-independence-guidance.mjs +2 -2
- package/src/todo-migration.mjs +5 -6
- package/src/todo-note-store.mjs +8 -3
- package/src/todo-notice-store.mjs +2 -2
- package/src/todo-notices.mjs +12 -1
- package/src/todo-readiness.mjs +53 -7
- package/src/todo-revision-note.mjs +29 -0
- package/src/todo-revision.mjs +12 -13
- package/src/todo-status.mjs +46 -7
- package/src/todo-store-view.mjs +59 -0
- package/src/todo-store.mjs +139 -56
package/src/todo-revision.mjs
CHANGED
|
@@ -139,7 +139,7 @@ function validSourceCutoverBatch(value, revision) {
|
|
|
139
139
|
if (!exactRecord(value, ['batch_id', 'archive_ref', 'operations', 'batch_digest'])
|
|
140
140
|
|| !isTodoIdentifier(value.batch_id) || !isTodoRef(value.archive_ref)
|
|
141
141
|
|| !value.archive_ref.endsWith('.md') || parseTodoSourceRef(value.archive_ref) !== null
|
|
142
|
-
|| !Array.isArray(value.operations) || value.operations.length < 1
|
|
142
|
+
|| !Array.isArray(value.operations) || value.operations.length < 1
|
|
143
143
|
|| !isTodoDigest(value.batch_digest)
|
|
144
144
|
|| value.batch_digest !== todoSelfDigest(value, 'batch_digest')) return false;
|
|
145
145
|
const sourceRefs = new Set();
|
|
@@ -183,7 +183,7 @@ function validTaskMigration(value) {
|
|
|
183
183
|
const activeTargets = Array.isArray(value)
|
|
184
184
|
? value.filter(({ to_task_id }) => to_task_id !== 'removed').map(({ to_task_id }) => to_task_id)
|
|
185
185
|
: [];
|
|
186
|
-
return Array.isArray(value) && value.length > 0
|
|
186
|
+
return Array.isArray(value) && value.length > 0
|
|
187
187
|
&& value.every((entry) => exactRecord(entry, [
|
|
188
188
|
'from_task_id', 'to_task_id', 'state_policy',
|
|
189
189
|
]) && isTodoIdentifier(entry.from_task_id)
|
|
@@ -198,7 +198,7 @@ function validTaskMigration(value) {
|
|
|
198
198
|
}
|
|
199
199
|
|
|
200
200
|
function validPhaseMigration(value, desiredPlan) {
|
|
201
|
-
if (!Array.isArray(value) || value.length === 0
|
|
201
|
+
if (!Array.isArray(value) || value.length === 0
|
|
202
202
|
|| !value.every((entry) => exactRecord(entry, [
|
|
203
203
|
'from_phase_id', 'to_phase_id', 'state_policy',
|
|
204
204
|
]) && (entry.from_phase_id === null || isTodoIdentifier(entry.from_phase_id))
|
|
@@ -227,7 +227,7 @@ export function todoTaskMigrationDigest(taskMigration) {
|
|
|
227
227
|
function validRuntimeTaskMigration(value) {
|
|
228
228
|
if (!exactRecord(value, ['schema', 'entries', 'migration_digest'])
|
|
229
229
|
|| value.schema !== 'lattice.runtime_task_migration.v1'
|
|
230
|
-
|| !Array.isArray(value.entries) || value.entries.length < 1
|
|
230
|
+
|| !Array.isArray(value.entries) || value.entries.length < 1
|
|
231
231
|
|| !isTodoDigest(value.migration_digest)
|
|
232
232
|
|| value.migration_digest !== todoSelfDigest(value, 'migration_digest')) return false;
|
|
233
233
|
const targets = [];
|
|
@@ -238,7 +238,7 @@ function validRuntimeTaskMigration(value) {
|
|
|
238
238
|
'predecessor_task_id', 'disposition', 'successor_task_ids', 'reason', 'evidence_digests',
|
|
239
239
|
]) || !isTodoIdentifier(entry.predecessor_task_id)
|
|
240
240
|
|| !['carry', 'stay', 'replace', 'split', 'retire'].includes(entry.disposition)
|
|
241
|
-
|| !Array.isArray(entry.successor_task_ids)
|
|
241
|
+
|| !Array.isArray(entry.successor_task_ids)
|
|
242
242
|
|| !entry.successor_task_ids.every(isTodoIdentifier)
|
|
243
243
|
|| new Set(entry.successor_task_ids).size !== entry.successor_task_ids.length
|
|
244
244
|
|| successorTail.some((id, targetIndex) => targetIndex > 0
|
|
@@ -374,7 +374,6 @@ export function validatePhaseTodoRevision(value) {
|
|
|
374
374
|
function validSourceInventory(value, desiredPlan, { requireNarrativeRef = false } = {}) {
|
|
375
375
|
if (!exactRecord(value, ['active', 'excluded_tombstones'])
|
|
376
376
|
|| !Array.isArray(value.active) || !Array.isArray(value.excluded_tombstones)
|
|
377
|
-
|| value.active.length > 512 || value.excluded_tombstones.length > 2_048
|
|
378
377
|
|| !value.active.every((entry) => exactRecord(entry, ['task_id', 'source_ref', 'source_digest'])
|
|
379
378
|
&& isTodoIdentifier(entry.task_id) && parseTodoSourceRef(entry.source_ref) !== null
|
|
380
379
|
&& isTodoDigest(entry.source_digest))
|
|
@@ -476,7 +475,7 @@ function explainPredecessor(value, at = '/predecessor') {
|
|
|
476
475
|
* 可否を変えずに1件ずつ言い当てる。
|
|
477
476
|
*/
|
|
478
477
|
function explainTaskMigration(value, at = '/task_migration') {
|
|
479
|
-
if (!Array.isArray(value) || value.length === 0
|
|
478
|
+
if (!Array.isArray(value) || value.length === 0) {
|
|
480
479
|
return reject('bounded_collection_violation', at);
|
|
481
480
|
}
|
|
482
481
|
for (const [index, entry] of value.entries()) {
|
|
@@ -509,7 +508,7 @@ function explainTaskMigration(value, at = '/task_migration') {
|
|
|
509
508
|
}
|
|
510
509
|
|
|
511
510
|
function explainPhaseMigration(value, desiredPlan, at = '/phase_migration') {
|
|
512
|
-
if (!Array.isArray(value) || value.length === 0
|
|
511
|
+
if (!Array.isArray(value) || value.length === 0) {
|
|
513
512
|
return reject('bounded_collection_violation', at);
|
|
514
513
|
}
|
|
515
514
|
for (const [index, entry] of value.entries()) {
|
|
@@ -554,7 +553,7 @@ function explainRuntimeTaskMigration(value, taskMigration, desiredPlan, at = '/r
|
|
|
554
553
|
const keyCheck = explainKeys(value, ['schema', 'entries', 'migration_digest'], at);
|
|
555
554
|
if (!keyCheck.valid) return keyCheck;
|
|
556
555
|
if (value.schema !== 'lattice.runtime_task_migration.v1') return reject('schema_mismatch', `${at}/schema`);
|
|
557
|
-
if (!Array.isArray(value.entries) || value.entries.length === 0
|
|
556
|
+
if (!Array.isArray(value.entries) || value.entries.length === 0) {
|
|
558
557
|
return reject('bounded_collection_violation', `${at}/entries`);
|
|
559
558
|
}
|
|
560
559
|
const targets = [];
|
|
@@ -569,7 +568,7 @@ function explainRuntimeTaskMigration(value, taskMigration, desiredPlan, at = '/r
|
|
|
569
568
|
if (!['carry', 'stay', 'replace', 'split', 'retire'].includes(entry.disposition)) {
|
|
570
569
|
return reject('invalid_disposition', `${entryAt}/disposition`);
|
|
571
570
|
}
|
|
572
|
-
if (!Array.isArray(entry.successor_task_ids)
|
|
571
|
+
if (!Array.isArray(entry.successor_task_ids)
|
|
573
572
|
|| !entry.successor_task_ids.every(isTodoIdentifier)) {
|
|
574
573
|
return reject('invalid_successor_task_ids', `${entryAt}/successor_task_ids`);
|
|
575
574
|
}
|
|
@@ -631,10 +630,10 @@ function explainRuntimeTaskMigration(value, taskMigration, desiredPlan, at = '/r
|
|
|
631
630
|
function explainSourceInventory(value, desiredPlan, { requireNarrativeRef = false } = {}, at = '/source_inventory') {
|
|
632
631
|
const keyCheck = explainKeys(value, ['active', 'excluded_tombstones'], at);
|
|
633
632
|
if (!keyCheck.valid) return keyCheck;
|
|
634
|
-
if (!Array.isArray(value.active)
|
|
633
|
+
if (!Array.isArray(value.active)) {
|
|
635
634
|
return reject('bounded_collection_violation', `${at}/active`);
|
|
636
635
|
}
|
|
637
|
-
if (!Array.isArray(value.excluded_tombstones)
|
|
636
|
+
if (!Array.isArray(value.excluded_tombstones)) {
|
|
638
637
|
return reject('bounded_collection_violation', `${at}/excluded_tombstones`);
|
|
639
638
|
}
|
|
640
639
|
for (const [index, entry] of value.active.entries()) {
|
|
@@ -693,7 +692,7 @@ function explainSourceCutoverBatch(value, revision, at = '/source_cutover_batch'
|
|
|
693
692
|
|| parseTodoSourceRef(value.archive_ref) !== null) {
|
|
694
693
|
return reject('invalid_archive_ref', `${at}/archive_ref`);
|
|
695
694
|
}
|
|
696
|
-
if (!Array.isArray(value.operations) || value.operations.length === 0
|
|
695
|
+
if (!Array.isArray(value.operations) || value.operations.length === 0) {
|
|
697
696
|
return reject('bounded_collection_violation', `${at}/operations`);
|
|
698
697
|
}
|
|
699
698
|
const sourceRefs = new Set();
|
package/src/todo-status.mjs
CHANGED
|
@@ -31,7 +31,8 @@ import {
|
|
|
31
31
|
* plan単位noteは工程に属する義務で、taskへ着手した人のcontextには届くが、**まだ誰も
|
|
32
32
|
* 着手していない工程の義務は、この欄が無いとどこにも出ない**。
|
|
33
33
|
*/
|
|
34
|
-
export const TODO_STATUS_SCHEMA = 'lattice.todo_status_result.
|
|
34
|
+
export const TODO_STATUS_SCHEMA = 'lattice.todo_status_result.v10';
|
|
35
|
+
/** v10: `active_set[].connections` and `connection_pending[]` carry the one `connections` list: open 他条件に接続 and 優先接続 entries. */
|
|
35
36
|
/** v9 (u03 A77): `truncated: [{list, total, shown}]` records every cut of an output list. */
|
|
36
37
|
/** v8: cross_plan_findingsは件数だけ全数、本文は先頭からこの件数まで(statusを止めない)。 */
|
|
37
38
|
export const TODO_STATUS_FINDING_LIMIT = 32;
|
|
@@ -130,11 +131,31 @@ function taskRefEntry(value) {
|
|
|
130
131
|
&& isTodoIdentifier(value.plan_key) && isTodoIdentifier(value.task_id);
|
|
131
132
|
}
|
|
132
133
|
|
|
134
|
+
function connectionEntry(value) {
|
|
135
|
+
if (exactRecord(value, ['kind', 'agent', 'since', 'reason'])) {
|
|
136
|
+
return value.kind === 'priority' && isTodoStatusBoundedText(value.agent, TODO_STATUS_LABEL_LIMIT)
|
|
137
|
+
&& typeof value.since === 'string' && (value.reason === null || isTodoStatusBoundedText(value.reason, TODO_STATUS_REASON_LIMIT));
|
|
138
|
+
}
|
|
139
|
+
return (exactRecord(value, ['kind', 'ref', 'state', 'reason', 'since'])
|
|
140
|
+
|| exactRecord(value, ['kind', 'ref', 'state', 'reason', 'since', 'state_reason']))
|
|
141
|
+
&& ['task', 'schedule'].includes(value.kind) && value.state === 'open'
|
|
142
|
+
&& isTodoStatusBoundedText(value.ref, TODO_STATUS_REASON_LIMIT)
|
|
143
|
+
&& isTodoStatusBoundedText(value.reason, TODO_STATUS_REASON_LIMIT) && typeof value.since === 'string'
|
|
144
|
+
&& (value.state_reason === undefined || isTodoStatusBoundedText(value.state_reason, TODO_STATUS_LABEL_LIMIT));
|
|
145
|
+
}
|
|
146
|
+
|
|
133
147
|
function activeTaskEntry(value) {
|
|
134
|
-
return exactRecord(value, ['plan_key', 'task_id', 'label', 'unmet_dependencies'])
|
|
148
|
+
return exactRecord(value, ['plan_key', 'task_id', 'label', 'unmet_dependencies', 'connections'])
|
|
149
|
+
&& isTodoIdentifier(value.plan_key) && isTodoIdentifier(value.task_id)
|
|
150
|
+
&& isTodoStatusBoundedText(value.label, TODO_STATUS_LABEL_LIMIT)
|
|
151
|
+
&& boundedList(value.unmet_dependencies, taskRefEntry) && boundedList(value.connections, connectionEntry);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function connectionPendingEntry(value) {
|
|
155
|
+
return exactRecord(value, ['plan_key', 'task_id', 'label', 'connections'])
|
|
135
156
|
&& isTodoIdentifier(value.plan_key) && isTodoIdentifier(value.task_id)
|
|
136
157
|
&& isTodoStatusBoundedText(value.label, TODO_STATUS_LABEL_LIMIT)
|
|
137
|
-
&& boundedList(value.
|
|
158
|
+
&& boundedList(value.connections, connectionEntry) && value.connections.length > 0;
|
|
138
159
|
}
|
|
139
160
|
|
|
140
161
|
function blockedEntry(value) {
|
|
@@ -356,13 +377,13 @@ export function validateTodoStatusResult(value) {
|
|
|
356
377
|
try {
|
|
357
378
|
return exactRecord(value, [
|
|
358
379
|
'schema', 'project_id', 'active_set', 'next_ready', 'dispatch_frontier',
|
|
359
|
-
'blocked', 'audit_pending', 'structure_finalization_pending', 'plan_notes',
|
|
380
|
+
'blocked', 'connection_pending', 'audit_pending', 'structure_finalization_pending', 'plan_notes',
|
|
360
381
|
'coordination', 'parallel_candidates', 'cross_plan_findings',
|
|
361
382
|
'member_heads', 'truncated', 'result_digest',
|
|
362
383
|
]) && value.schema === TODO_STATUS_SCHEMA && isTodoIdentifier(value.project_id)
|
|
363
384
|
&& boundedList(value.active_set, activeTaskEntry) && boundedList(value.next_ready, taskEntry)
|
|
364
385
|
&& dispatchFrontierEntry(value.dispatch_frontier, value.project_id, value.next_ready)
|
|
365
|
-
&& boundedList(value.blocked, blockedEntry) && boundedList(value.audit_pending, auditPendingEntry)
|
|
386
|
+
&& boundedList(value.blocked, blockedEntry) && boundedList(value.connection_pending, connectionPendingEntry) && boundedList(value.audit_pending, auditPendingEntry)
|
|
366
387
|
&& boundedList(value.structure_finalization_pending, structureFinalizationPendingEntry)
|
|
367
388
|
&& boundedList(value.plan_notes, planNoteEntry)
|
|
368
389
|
&& boundedList(value.coordination, coordinationEntry)
|
|
@@ -625,8 +646,23 @@ export function projectTodoStatus(readModel, options = undefined) {
|
|
|
625
646
|
const activeSet = [];
|
|
626
647
|
const nextReady = [];
|
|
627
648
|
const blocked = [];
|
|
649
|
+
const connectionPending = [];
|
|
650
|
+
// One `connections` list (the Owner's one place): open 他条件に接続 entries and 優先接続 entries. Settled ones are
|
|
651
|
+
// history that `todo show` lists.
|
|
652
|
+
const openConnections = (key) => graph.readiness.allConnections(key)
|
|
653
|
+
.filter((entry) => entry.kind === 'priority' || entry.state === 'open')
|
|
654
|
+
.map((entry) => entry.kind === 'priority'
|
|
655
|
+
? { kind: 'priority', agent: displayText(entry.agent, 'unknown', TODO_STATUS_LABEL_LIMIT), since: entry.since,
|
|
656
|
+
reason: entry.reason === null ? null : displayText(entry.reason, 'priority', TODO_STATUS_REASON_LIMIT) }
|
|
657
|
+
: { kind: entry.kind, ref: entry.ref, state: 'open', reason: displayText(entry.reason, 'connection', TODO_STATUS_REASON_LIMIT),
|
|
658
|
+
since: entry.since,
|
|
659
|
+
...(entry.state_reason === undefined ? {} : { state_reason: displayText(entry.state_reason, 'chart_not_read', TODO_STATUS_LABEL_LIMIT) }) });
|
|
628
660
|
for (const node of nodes.values()) {
|
|
629
661
|
const task = { plan_key: node.plan_key, task_id: node.task_id, label: node.label };
|
|
662
|
+
if (node.status === 'pending') {
|
|
663
|
+
const connections = openConnections(node.key);
|
|
664
|
+
if (connections.length > 0) connectionPending.push({ ...task, connections });
|
|
665
|
+
}
|
|
630
666
|
if (node.status === 'in-progress') {
|
|
631
667
|
const unmetDependencies = [...incoming.get(node.key)]
|
|
632
668
|
.filter((key) => !nodes.get(key).finished)
|
|
@@ -641,7 +677,7 @@ export function projectTodoStatus(readModel, options = undefined) {
|
|
|
641
677
|
const entry = truncated.get('active_set.unmet_dependencies');
|
|
642
678
|
entry.total += unmetDependencies.length; entry.shown += shownDependencies.length;
|
|
643
679
|
}
|
|
644
|
-
activeSet.push({ ...task, unmet_dependencies: shownDependencies });
|
|
680
|
+
activeSet.push({ ...task, unmet_dependencies: shownDependencies, connections: openConnections(node.key) });
|
|
645
681
|
}
|
|
646
682
|
if (isNodeReady(node, graph)) nextReady.push({ ...task, done_condition: node.done_condition });
|
|
647
683
|
if (node.status === 'blocked') {
|
|
@@ -655,9 +691,11 @@ export function projectTodoStatus(readModel, options = undefined) {
|
|
|
655
691
|
activeSet.sort(compareTaskEntries);
|
|
656
692
|
nextReady.sort(compareTaskEntries);
|
|
657
693
|
blocked.sort(compareTaskEntries);
|
|
694
|
+
connectionPending.sort(compareTaskEntries);
|
|
658
695
|
memberHeads.sort((left, right) => left.plan_key < right.plan_key ? -1 : left.plan_key > right.plan_key ? 1 : 0);
|
|
659
696
|
const lists = {
|
|
660
|
-
active_set: activeSet, next_ready: nextReady, blocked,
|
|
697
|
+
active_set: activeSet, next_ready: nextReady, blocked, connection_pending: connectionPending,
|
|
698
|
+
audit_pending: auditPending,
|
|
661
699
|
structure_finalization_pending: structureFinalizations, plan_notes: planNotes,
|
|
662
700
|
coordination, parallel_candidates: parallelCandidates, member_heads: memberHeads,
|
|
663
701
|
};
|
|
@@ -678,6 +716,7 @@ export function projectTodoStatus(readModel, options = undefined) {
|
|
|
678
716
|
next_ready: lists.next_ready,
|
|
679
717
|
dispatch_frontier: dispatchFrontier(readModel.project_id, lists.next_ready),
|
|
680
718
|
blocked: lists.blocked,
|
|
719
|
+
connection_pending: lists.connection_pending,
|
|
681
720
|
// 監査待ちは`member.phases`だけから作った別の列で、dispatch(next_ready/dispatch_frontier)へは
|
|
682
721
|
// 影響しない。監査が進んでもfrontier_digestは動かない。
|
|
683
722
|
audit_pending: lists.audit_pending,
|
package/src/todo-store-view.mjs
CHANGED
|
@@ -75,6 +75,65 @@ export function projectTodoCrossPlanDependencies(members) {
|
|
|
75
75
|
});
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
+
/**
|
|
79
|
+
* 接続 (schedule): one plan chain's connection_added events with how each ended. `ended` is 'removed' or
|
|
80
|
+
* 'resolved' (an add has at most one end, which Store append enforces); a state of 'removed' is not shown.
|
|
81
|
+
*/
|
|
82
|
+
export function projectTodoScheduleConnections(events) {
|
|
83
|
+
const ends = new Map();
|
|
84
|
+
for (const event of events ?? []) {
|
|
85
|
+
if (event.kind === 'connection_removed') ends.set(event.payload.target_event_digest, { ended: 'removed', event });
|
|
86
|
+
if (event.kind === 'connection_resolved') ends.set(event.payload.target_event_digest, { ended: 'resolved', event });
|
|
87
|
+
}
|
|
88
|
+
return (events ?? []).filter((event) => event.kind === 'connection_added').map((event) => {
|
|
89
|
+
const end = ends.get(event.event_digest);
|
|
90
|
+
return { kind: 'schedule', task_id: event.payload.task_id, ref: event.payload.to.id,
|
|
91
|
+
state: end === undefined ? 'open' : end.ended === 'resolved' ? 'settled' : 'removed',
|
|
92
|
+
reason: event.payload.reason, since: event.recorded_at, event_digest: event.event_digest,
|
|
93
|
+
actor: event.actor, provenance: event.provenance, ended: end?.ended ?? null,
|
|
94
|
+
...(end?.ended === 'resolved' ? { settled_at: end.event.recorded_at, evidence: end.event.payload.evidence } : {}) };
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const connectionTaskKey = (projectId, planKey, taskId) => `${projectId}\0${planKey}\0${taskId}`;
|
|
99
|
+
export { connectionTaskKey as todoConnectionTaskKey };
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* 接続 per task, keyed `project\0plan\0task`: schedule connections from the plan chain, and task connections from
|
|
103
|
+
* today's cross-chart ledger edges (settled once that task is done or retired, open while its chart is unread).
|
|
104
|
+
* Pure; a removed connection is not listed. Entry: {kind, ref, state, reason, since, event_digest, settled_at?,
|
|
105
|
+
* evidence?, state_reason?}, sorted by since then digest.
|
|
106
|
+
*/
|
|
107
|
+
export function projectTodoConnections(members, externalTasks = []) {
|
|
108
|
+
const external = new Map(externalTasks.map((entry) => [connectionTaskKey(entry.project_id, entry.plan_key, entry.task_id), entry]));
|
|
109
|
+
const byTask = new Map();
|
|
110
|
+
const push = (key, entry) => byTask.set(key, [...(byTask.get(key) ?? []), entry]);
|
|
111
|
+
for (const member of members) {
|
|
112
|
+
const { plan } = member;
|
|
113
|
+
for (const entry of projectTodoScheduleConnections(member.plan_scoped?.events)) {
|
|
114
|
+
if (entry.state === 'removed') continue;
|
|
115
|
+
const { task_id: taskId, actor: _actor, provenance: _provenance, ended: _ended, ...shown } = entry;
|
|
116
|
+
push(connectionTaskKey(plan.project_id, plan.plan_key, taskId), shown);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
for (const dependency of projectTodoCrossPlanDependencies(members)) {
|
|
120
|
+
if (dependency.from.project_id === dependency.to.project_id) continue;
|
|
121
|
+
const { from, to } = dependency;
|
|
122
|
+
const source = external.get(connectionTaskKey(from.project_id, from.plan_key, from.task_id));
|
|
123
|
+
const settled = source?.finished === true;
|
|
124
|
+
push(connectionTaskKey(to.project_id, to.plan_key, to.task_id), {
|
|
125
|
+
kind: 'task', ref: `${from.project_id}/${from.plan_key}/${from.task_id}`,
|
|
126
|
+
state: settled ? 'settled' : 'open', reason: dependency.reason, since: dependency.connected_at,
|
|
127
|
+
event_digest: dependency.event_digest,
|
|
128
|
+
...(!settled && (source === undefined || source.status === null || source.status === undefined)
|
|
129
|
+
? { state_reason: source?.reason ?? 'chart_not_read' } : {}) });
|
|
130
|
+
}
|
|
131
|
+
for (const [key, entries] of byTask) {
|
|
132
|
+
byTask.set(key, entries.sort((left, right) => (left.since + left.event_digest < right.since + right.event_digest ? -1 : 1)));
|
|
133
|
+
}
|
|
134
|
+
return byTask;
|
|
135
|
+
}
|
|
136
|
+
|
|
78
137
|
function mappedNodeRef(ref, plan, idMap) {
|
|
79
138
|
if (ref.project_id !== plan.project_id || ref.plan_key !== plan.plan_key) return ref;
|
|
80
139
|
return { ...ref, task_id: idMap.get(ref.task_id) ?? ref.task_id };
|