@hearsay-tools/squawk 0.18.0-dev.7820 → 0.18.0-dev.7830
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/activity/read-model.d.ts +3 -1
- package/dist/activity/read-model.js +17 -15
- package/dist/activity/read-model.js.map +1 -1
- package/dist/activity/requests.d.ts +3 -1
- package/dist/activity/requests.js +1 -1
- package/dist/activity/requests.js.map +1 -1
- package/dist/artifacts/reports-index.d.ts +3 -7
- package/dist/artifacts/reports-index.js +6 -6
- package/dist/artifacts/reports-index.js.map +1 -1
- package/dist/automations/service.js +1 -1
- package/dist/automations/service.js.map +1 -1
- package/dist/automations/task-template.js +3 -3
- package/dist/automations/task-template.js.map +1 -1
- package/dist/ci-wait/controller.d.ts +42 -42
- package/dist/delegation/conversations.d.ts +6 -2
- package/dist/delegation/conversations.js +1 -1
- package/dist/delegation/conversations.js.map +1 -1
- package/dist/delegation/family-end.d.ts +4 -2
- package/dist/delegation/family-end.js +1 -1
- package/dist/delegation/family-end.js.map +1 -1
- package/dist/delegation/scratch-cleanup.js +2 -2
- package/dist/delegation/scratch-cleanup.js.map +1 -1
- package/dist/delegation/task-discovery.js +1 -1
- package/dist/delegation/task-discovery.js.map +1 -1
- package/dist/delegation/worker-cleanup.js +4 -4
- package/dist/delegation/worker-cleanup.js.map +1 -1
- package/dist/project-commands.js +1 -1
- package/dist/project-commands.js.map +1 -1
- package/dist/project-migration/live.js +1 -1
- package/dist/project-migration/live.js.map +1 -1
- package/dist/runs/branch-owners.d.ts +2 -2
- package/dist/runs/cold-reads.d.ts +1 -1
- package/dist/runs/cold-reads.js +1 -1
- package/dist/runs/lifecycle.d.ts +2 -1
- package/dist/runs/lifecycle.js.map +1 -1
- package/dist/runs/live-tasks.js +1 -1
- package/dist/runs/live-tasks.js.map +1 -1
- package/dist/runs/ports.d.ts +63 -31
- package/dist/runs/retention.d.ts +4 -3
- package/dist/runs/retention.js +2 -2
- package/dist/runs/retention.js.map +1 -1
- package/dist/runs/run-cold-reads.d.ts +98 -0
- package/dist/runs/run-cold-reads.js +194 -0
- package/dist/runs/run-cold-reads.js.map +1 -0
- package/dist/runs/run-persistence.d.ts +150 -0
- package/dist/runs/run-persistence.js +396 -0
- package/dist/runs/run-persistence.js.map +1 -0
- package/dist/runs/run-queries.d.ts +190 -0
- package/dist/runs/run-queries.js +480 -0
- package/dist/runs/run-queries.js.map +1 -0
- package/dist/runs/run-repo-scope.d.ts +38 -0
- package/dist/runs/run-repo-scope.js +78 -0
- package/dist/runs/run-repo-scope.js.map +1 -0
- package/dist/runs/run-retention.d.ts +6 -2
- package/dist/runs/run-retention.js +11 -2
- package/dist/runs/run-retention.js.map +1 -1
- package/dist/runs/store.d.ts +12 -292
- package/dist/runs/store.js +122 -1119
- package/dist/runs/store.js.map +1 -1
- package/dist/serve-boot.d.ts +3 -1
- package/dist/serve-boot.js +2 -2
- package/dist/serve-boot.js.map +1 -1
- package/dist/server/models-routes.d.ts +13 -13
- package/dist/server/project-context.js +3 -3
- package/dist/server/project-context.js.map +1 -1
- package/dist/server/repo-branches.d.ts +5 -3
- package/dist/server/repo-branches.js +1 -1
- package/dist/server/repo-branches.js.map +1 -1
- package/dist/server/reports-api.d.ts +2 -2
- package/dist/server/run-checkout.d.ts +3 -1
- package/dist/server/run-checkout.js +2 -2
- package/dist/server/run-checkout.js.map +1 -1
- package/dist/server/run-relationships.d.ts +3 -1
- package/dist/server/run-relationships.js +1 -1
- package/dist/server/run-relationships.js.map +1 -1
- package/dist/server/server.d.ts +58 -58
- package/dist/server/server.js +12 -12
- package/dist/server/server.js.map +1 -1
- package/dist/server/start-server.js +1 -1
- package/dist/server/start-server.js.map +1 -1
- package/dist/workflows/run/auto-resume.js +2 -2
- package/dist/workflows/run/auto-resume.js.map +1 -1
- package/dist/workflows/run/completion-gate.js +1 -1
- package/dist/workflows/run/completion-gate.js.map +1 -1
- package/dist/workflows/run/continuation-acceptance.js +2 -2
- package/dist/workflows/run/continuation-acceptance.js.map +1 -1
- package/dist/workflows/run/family-reconciler.d.ts +2 -1
- package/dist/workflows/run/family-reconciler.js +8 -8
- package/dist/workflows/run/family-reconciler.js.map +1 -1
- package/dist/workflows/run/maintenance-claims.js +2 -2
- package/dist/workflows/run/maintenance-claims.js.map +1 -1
- package/dist/workflows/run/native-skill-input-queue.js +1 -1
- package/dist/workflows/run/native-skill-input-queue.js.map +1 -1
- package/dist/workflows/run/queued-revival.js +3 -3
- package/dist/workflows/run/queued-revival.js.map +1 -1
- package/dist/workflows/run/run-cancel.js +5 -5
- package/dist/workflows/run/run-cancel.js.map +1 -1
- package/dist/workflows/run/run-finish.js +1 -1
- package/dist/workflows/run/run-finish.js.map +1 -1
- package/dist/workflows/run/run-line.js +2 -2
- package/dist/workflows/run/run-line.js.map +1 -1
- package/dist/workflows/run/run-recovery.js +6 -6
- package/dist/workflows/run/run-recovery.js.map +1 -1
- package/dist/workflows/run/run-settlement.js +4 -4
- package/dist/workflows/run/run-settlement.js.map +1 -1
- package/dist/workflows/run/run-start.js +1 -1
- package/dist/workflows/run/run-start.js.map +1 -1
- package/dist/workflows/run/step-loop.js +4 -4
- package/dist/workflows/run/step-loop.js.map +1 -1
- package/dist/workflows/run/turn-nudges.js +1 -1
- package/dist/workflows/run/turn-nudges.js.map +1 -1
- package/dist/workflows/run/turn-settler.js +1 -1
- package/dist/workflows/run/turn-settler.js.map +1 -1
- package/dist/workflows/run/usage-accounting.js +1 -1
- package/dist/workflows/run/usage-accounting.js.map +1 -1
- package/dist/workflows/run/wake-admission.js +1 -1
- package/dist/workflows/run/wake-admission.js.map +1 -1
- package/dist/workflows/run/worker-questions.js +3 -3
- package/dist/workflows/run/worker-questions.js.map +1 -1
- package/dist/workflows/run.js +1 -1
- package/dist/workflows/run.js.map +1 -1
- package/package.json +4 -4
- package/scripts/benchmark-automation-lookups.ts +2 -2
- package/scripts/benchmark-conversation-lookup.ts +2 -2
- package/scripts/benchmark-family-reconcile.ts +2 -2
- package/scripts/benchmark-run-store.ts +3 -3
- package/scripts/benchmark-workspace-events.ts +2 -2
- package/scripts/benchmark-worktree-retention.ts +1 -1
- package/scripts/seed-archive-profile.ts +2 -2
|
@@ -0,0 +1,480 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The list and find queries over a project's runs (hearsay-tools/squawk#4044): the live set, the
|
|
3
|
+
* list rows and their archived window and pages, the workspace search, the workers of a run and
|
|
4
|
+
* the indexed finds. Each query lays the held records over the rows it read. `RunStore` keeps one
|
|
5
|
+
* of these as `store.queries`.
|
|
6
|
+
*/
|
|
7
|
+
import { toRunSummary } from '../contract/index.js';
|
|
8
|
+
import { matchesRunSearch, sqlPrefilterTokens } from '../contract/index.js';
|
|
9
|
+
import { listBranchOwners } from './branch-owners.js';
|
|
10
|
+
import { guardedJsonSql } from './guarded-json-sql.js';
|
|
11
|
+
import { ARCHIVED_ROOT } from './run-database.js';
|
|
12
|
+
import { ISSUE_URL_RE } from './run-references.js';
|
|
13
|
+
import { familyRootOf, isLiveRecord, materializedWorktreePath, newestFirst } from './run-row.js';
|
|
14
|
+
import { listPeerTaskSummaries, parseStoredSummary } from './run-summary-page.js';
|
|
15
|
+
/** An archived page's cursor: the last row's order, opaque to clients. A held run with no row yet
|
|
16
|
+
* lists after every row (`seq` is infinite), which JSON cannot carry, so it travels as null. */
|
|
17
|
+
function encodeArchivedCursor(key) {
|
|
18
|
+
return Buffer.from(JSON.stringify({ c: key.createdAt, s: Number.isFinite(key.seq) ? key.seq : null })).toString('base64url');
|
|
19
|
+
}
|
|
20
|
+
function decodeArchivedCursor(cursor) {
|
|
21
|
+
try {
|
|
22
|
+
const parsed = JSON.parse(Buffer.from(cursor, 'base64url').toString('utf8'));
|
|
23
|
+
if (typeof parsed !== 'object' || parsed === null)
|
|
24
|
+
return undefined;
|
|
25
|
+
const { c, s } = parsed;
|
|
26
|
+
if (typeof c !== 'string' || !(s === null || (typeof s === 'number' && Number.isInteger(s))))
|
|
27
|
+
return undefined;
|
|
28
|
+
return { createdAt: c, seq: s ?? Number.POSITIVE_INFINITY };
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/** The items newest first, each by the order beside it. Stable: ties keep their input order. */
|
|
35
|
+
export function sortNewestFirst(entries) {
|
|
36
|
+
return [...entries].sort(([, a], [, b]) => newestFirst(a, b)).map(([item]) => item);
|
|
37
|
+
}
|
|
38
|
+
export class RunQueriesTopic {
|
|
39
|
+
state;
|
|
40
|
+
constructor(state) {
|
|
41
|
+
this.state = state;
|
|
42
|
+
}
|
|
43
|
+
get db() { return this.state.db(); }
|
|
44
|
+
get held() { return this.state.held; }
|
|
45
|
+
get pins() { return this.state.pins; }
|
|
46
|
+
get deleted() { return this.state.deleted; }
|
|
47
|
+
get unreadable() { return this.state.unreadable; }
|
|
48
|
+
get base() { return this.state.base; }
|
|
49
|
+
get coldReads() { return this.state.coldReads; }
|
|
50
|
+
loadCold(id) { return this.state.rows.loadCold(id); }
|
|
51
|
+
decodeCold(row) { return this.state.rows.decodeCold(row); }
|
|
52
|
+
fromRow(row) { return this.state.rows.fromRow(row); }
|
|
53
|
+
getRun(id) { return this.state.getRun(id); }
|
|
54
|
+
/**
|
|
55
|
+
* The live set, newest first: runs whose record is live (`isLiveRecord`) or that a RunManager
|
|
56
|
+
* pins. Finished runs are not here — read one by id (`getRun`), by an indexed query
|
|
57
|
+
* (`listWorkersOf`, `findRunByClientRequestId`, `listRunsWithWorktree`,
|
|
58
|
+
* `listBranchOwners`), or as list rows (`listRunSummaries`).
|
|
59
|
+
*/
|
|
60
|
+
listRuns() {
|
|
61
|
+
return sortNewestFirst([...this.held].filter(([id, run]) => isLiveRecord(run) || this.pins.has(id)).map(([, run]) => [run, this.listOrder(run)]));
|
|
62
|
+
}
|
|
63
|
+
/** Where a held run lists: its row's insertion order, or after every row while this store has
|
|
64
|
+
* not written it yet. The held set keeps such runs in creation order, and so does every list
|
|
65
|
+
* that sorts them in held-set order (`sortNewestFirst` is stable). */
|
|
66
|
+
listOrder(run) {
|
|
67
|
+
return { createdAt: run.createdAt, seq: this.base.get(run.id)?.seq ?? Number.POSITIVE_INFINITY };
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* EVERY run as a full record, newest first — decoded row by row. Only the legacy `GET /runs`
|
|
71
|
+
* (older clients; the cockpit reads `GET /run-summaries`) may call this: it is exactly the
|
|
72
|
+
* whole-history parse #779 exists to remove from everything else.
|
|
73
|
+
*/
|
|
74
|
+
listAllRunsForLegacyRoute() {
|
|
75
|
+
const runs = new Map();
|
|
76
|
+
for (const row of this.db?.listAll() ?? []) {
|
|
77
|
+
if (this.deleted.has(row.id) || this.held.has(row.id))
|
|
78
|
+
continue;
|
|
79
|
+
const run = this.decodeCold(row);
|
|
80
|
+
if (run)
|
|
81
|
+
runs.set(row.id, [run, row]);
|
|
82
|
+
}
|
|
83
|
+
for (const [id, run] of this.held)
|
|
84
|
+
runs.set(id, [run, this.listOrder(run)]);
|
|
85
|
+
return sortNewestFirst(runs.values());
|
|
86
|
+
}
|
|
87
|
+
/** A bounded page of discoverable peer roots, including the current held overlay. */
|
|
88
|
+
listPeerTaskSummaries(options) {
|
|
89
|
+
return listPeerTaskSummaries({ db: this.db, held: this.held, skipped: this.deleted,
|
|
90
|
+
order: run => this.listOrder(run), cold: id => this.coldSummary(id) }, options);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Every run as its list row, newest first: the stored `summary` column, with each held run's
|
|
94
|
+
* own projection laid over it — a debounced save keeps memory up to 300 ms ahead of the row,
|
|
95
|
+
* and a run created since the last save has no row yet. `usage` is the caller's to attach.
|
|
96
|
+
*
|
|
97
|
+
* With `archivedWindow` (#864), the window the cockpit's lists read: every unarchived run, plus
|
|
98
|
+
* the newest `archivedWindow` archived ROOT runs, and whether older archived roots were left
|
|
99
|
+
* out. Archived workers are never in it (see `RunDatabase.listWindowSummaries`); with `roots`,
|
|
100
|
+
* no worker is — the runs index, whose readers list no workers. A held run
|
|
101
|
+
* lists by its record, so one archived or unarchived since the last save is ranked as it is now.
|
|
102
|
+
*
|
|
103
|
+
* A row this store found unreadable is left out, as the cold reader leaves out a row it had to
|
|
104
|
+
* decode and could not. A finished row nobody has decoded is served from its summary by both,
|
|
105
|
+
* which decodes nothing; reading it is what finds out (`isUnreadable`).
|
|
106
|
+
*/
|
|
107
|
+
listRunSummaries(options = {}) {
|
|
108
|
+
const { archivedWindow, roots = false } = options;
|
|
109
|
+
// Every skipped row may be an archived root, so ask for that many more: one past the window
|
|
110
|
+
// after skipping is how "older ones were left out" is known without counting them.
|
|
111
|
+
const rows = (archivedWindow === undefined
|
|
112
|
+
? this.db?.listSummaries()
|
|
113
|
+
: this.db?.listWindowSummaries(archivedWindow + 1 + this.deleted.size + this.unreadable.size + this.held.size, { roots })) ?? [];
|
|
114
|
+
const summaries = new Map();
|
|
115
|
+
for (const row of rows) {
|
|
116
|
+
if (this.deleted.has(row.id) || this.held.has(row.id) || this.unreadable.has(row.id))
|
|
117
|
+
continue;
|
|
118
|
+
const summary = parseStoredSummary(row.summary) ?? this.coldSummary(row.id);
|
|
119
|
+
if (summary)
|
|
120
|
+
summaries.set(row.id, [summary, row]);
|
|
121
|
+
}
|
|
122
|
+
for (const [id, run] of this.held) {
|
|
123
|
+
if (archivedWindow !== undefined && (run.archived || roots) && run.delegation?.role === 'worker')
|
|
124
|
+
continue;
|
|
125
|
+
summaries.set(id, [toRunSummary(run), this.listOrder(run)]);
|
|
126
|
+
}
|
|
127
|
+
const runs = sortNewestFirst(summaries.values());
|
|
128
|
+
if (archivedWindow === undefined)
|
|
129
|
+
return { runs, truncated: false };
|
|
130
|
+
let archived = 0;
|
|
131
|
+
const kept = runs.filter((run) => !run.archived || ++archived <= archivedWindow);
|
|
132
|
+
return { runs: kept, truncated: archived > archivedWindow };
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* One page of archived ROOT runs, newest first (#864): `GET /run-summaries/archived`, the
|
|
136
|
+
* archived runs past the window. Held runs list by their record, as in `listRunSummaries`.
|
|
137
|
+
* `before` is the previous page's `nextCursor`; with `q`, only runs `matchesRunSearch` keeps, and
|
|
138
|
+
* `total` counts those. `automationNames` lets `q` match a task by its automation's name, as the
|
|
139
|
+
* list's origin line shows it (hearsay-tools/cezarion#1616). A cursor this store did not write
|
|
140
|
+
* answers `{ error }`.
|
|
141
|
+
*
|
|
142
|
+
* Ranking reads every archived root's key (id, created_at, seq: no record, no summary), so the
|
|
143
|
+
* page and `total` agree with the held overlay; only the page's own rows are read in full.
|
|
144
|
+
*/
|
|
145
|
+
listArchivedRuns(options) {
|
|
146
|
+
let after;
|
|
147
|
+
if (options.before !== undefined) {
|
|
148
|
+
after = decodeArchivedCursor(options.before);
|
|
149
|
+
if (!after)
|
|
150
|
+
return { error: 'before is not a cursor this server wrote' };
|
|
151
|
+
}
|
|
152
|
+
const q = options.q?.trim() ?? '';
|
|
153
|
+
const ranked = this.rankArchivedRows(q, options.automationNames);
|
|
154
|
+
this.overlayHeldArchived(ranked, q, options.automationNames);
|
|
155
|
+
const ordered = [...ranked.entries()].sort(([, a], [, b]) => newestFirst(a, b));
|
|
156
|
+
return this.archivedPage(ordered, after, options.limit);
|
|
157
|
+
}
|
|
158
|
+
/** The archived roots in `runs.db`, each by its key: every one without `q` (no record, no
|
|
159
|
+
* summary read), and with `q` the searched rows `matchesRunSearch` keeps, which carry the summary
|
|
160
|
+
* the search read. A deleted, held or unreadable run's row is left out; a held run joins in
|
|
161
|
+
* `overlayHeldArchived`. */
|
|
162
|
+
rankArchivedRows(q, automationNames) {
|
|
163
|
+
const skipped = (id) => this.deleted.has(id) || this.held.has(id) || this.unreadable.has(id);
|
|
164
|
+
const ranked = new Map();
|
|
165
|
+
if (q === '') {
|
|
166
|
+
for (const key of this.db?.listKeysWhere(ARCHIVED_ROOT) ?? [])
|
|
167
|
+
if (!skipped(key.id))
|
|
168
|
+
ranked.set(key.id, key);
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
for (const row of this.db?.searchRootSummaries(sqlPrefilterTokens(q, { automationNames })) ?? []) {
|
|
172
|
+
if (skipped(row.id))
|
|
173
|
+
continue;
|
|
174
|
+
const summary = parseStoredSummary(row.summary) ?? this.coldSummary(row.id);
|
|
175
|
+
if (summary?.archived && matchesRunSearch(summary, q, { automationNames }))
|
|
176
|
+
ranked.set(row.id, { ...row, summary });
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
return ranked;
|
|
180
|
+
}
|
|
181
|
+
/** Lay the held archived roots over `ranked`, each by its record: it replaces its stored row
|
|
182
|
+
* (already left out of `ranked`), and with `q` it must match. A held worker never lists. */
|
|
183
|
+
overlayHeldArchived(ranked, q, automationNames) {
|
|
184
|
+
for (const [id, run] of this.held) {
|
|
185
|
+
if (!run.archived || run.delegation?.role === 'worker')
|
|
186
|
+
continue;
|
|
187
|
+
const summary = toRunSummary(run);
|
|
188
|
+
if (q === '' || matchesRunSearch(summary, q, { automationNames }))
|
|
189
|
+
ranked.set(id, { ...this.listOrder(run), summary });
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
/** The page of `ordered` after the cursor `after`: its summaries, the cursor of the next page,
|
|
193
|
+
* and `total`, the count of all of `ordered`. */
|
|
194
|
+
archivedPage(ordered, after, limit) {
|
|
195
|
+
const rest = after ? ordered.filter(([, key]) => newestFirst(key, after) > 0) : ordered;
|
|
196
|
+
const page = rest.slice(0, limit);
|
|
197
|
+
const runs = this.hydrateArchivedPage(page);
|
|
198
|
+
const last = page.at(-1)?.[1];
|
|
199
|
+
return {
|
|
200
|
+
runs,
|
|
201
|
+
nextCursor: last && rest.length > page.length ? encodeArchivedCursor(last) : null,
|
|
202
|
+
total: ordered.length,
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
/** The page's summaries: a ranked key's own, else its stored one, read for the rows that have
|
|
206
|
+
* none in a single query. A row whose stored summary does not fit the contract is projected from
|
|
207
|
+
* its record; a row that cannot be read at all is left out. */
|
|
208
|
+
hydrateArchivedPage(page) {
|
|
209
|
+
const cold = new Map((this.db?.getSummaries(page.filter(([, key]) => !key.summary).map(([id]) => id)) ?? [])
|
|
210
|
+
.map((row) => [row.id, parseStoredSummary(row.summary) ?? this.coldSummary(row.id)]));
|
|
211
|
+
return page.flatMap(([id, key]) => {
|
|
212
|
+
const summary = key.summary ?? cold.get(id);
|
|
213
|
+
return summary ? [summary] : [];
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* The ROOT runs, archived or not, that match `query` (`matchesRunSearch`), newest first: at most
|
|
218
|
+
* `limit`, and whether more matched. The owned half of the workspace search (#864); held runs
|
|
219
|
+
* match by their record.
|
|
220
|
+
*/
|
|
221
|
+
searchRunSummaries(query, limit) {
|
|
222
|
+
const matched = new Map();
|
|
223
|
+
// Rows come newest first, so the newest `limit + 1` row matches are all a page can use; held
|
|
224
|
+
// runs, which may be newer than any row, are ranked in below.
|
|
225
|
+
this.db?.visitRootSummaries(sqlPrefilterTokens(query), (row) => {
|
|
226
|
+
if (this.deleted.has(row.id) || this.held.has(row.id) || this.unreadable.has(row.id))
|
|
227
|
+
return true;
|
|
228
|
+
const summary = parseStoredSummary(row.summary) ?? this.coldSummary(row.id);
|
|
229
|
+
if (summary && matchesRunSearch(summary, query))
|
|
230
|
+
matched.set(row.id, [summary, row]);
|
|
231
|
+
return matched.size <= limit;
|
|
232
|
+
});
|
|
233
|
+
for (const [id, run] of this.held) {
|
|
234
|
+
if (run.delegation?.role === 'worker')
|
|
235
|
+
continue;
|
|
236
|
+
const summary = toRunSummary(run);
|
|
237
|
+
if (matchesRunSearch(summary, query))
|
|
238
|
+
matched.set(id, [summary, this.listOrder(run)]);
|
|
239
|
+
}
|
|
240
|
+
const runs = sortNewestFirst(matched.values());
|
|
241
|
+
return { runs: runs.slice(0, limit), truncated: runs.length > limit };
|
|
242
|
+
}
|
|
243
|
+
/** A row whose stored summary does not fit the contract any more, projected from its record. */
|
|
244
|
+
coldSummary(id) {
|
|
245
|
+
const run = this.loadCold(id);
|
|
246
|
+
return run ? toRunSummary(run) : undefined;
|
|
247
|
+
}
|
|
248
|
+
/** Run `fn` reading each run that is not held at most once (`ColdReadCache`, hearsay-tools/cezarion#2378). */
|
|
249
|
+
withReadCache(fn) { return this.coldReads.scope(fn); }
|
|
250
|
+
/** The ids in memory right now: the held set, for diagnostics and the benchmark's heap pass. */
|
|
251
|
+
heldIds() {
|
|
252
|
+
return [...this.held.keys()];
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* The workers a root run owns, newest first, read off its own `receipts` (#659). Every
|
|
256
|
+
* `createOwnedRun` writes the receipt and the worker record in one transaction, and the
|
|
257
|
+
* receipt list is capped at 1,024 creations (#816), so this is a bounded lookup rather than a walk of the whole
|
|
258
|
+
* project index. An ordinary or worker run owns nothing and costs one map read; a receipt
|
|
259
|
+
* whose record has been deleted is skipped, never invented. A parent quarantined to
|
|
260
|
+
* `invalid` has no readable receipts and reports none, which is also what the cockpit
|
|
261
|
+
* assumes for that role.
|
|
262
|
+
*/
|
|
263
|
+
listOwnedWorkers(parentId) {
|
|
264
|
+
const parent = this.getRun(parentId);
|
|
265
|
+
if (parent?.delegation?.role !== 'root')
|
|
266
|
+
return [];
|
|
267
|
+
const workers = [];
|
|
268
|
+
for (const receipt of parent.delegation.receipts) {
|
|
269
|
+
const worker = this.getRun(receipt.workerId);
|
|
270
|
+
if (worker?.delegation?.role === 'worker' && worker.delegation.parentRunId === parentId)
|
|
271
|
+
workers.push(worker);
|
|
272
|
+
}
|
|
273
|
+
return workers.sort((a, b) => b.createdAt.localeCompare(a.createdAt));
|
|
274
|
+
}
|
|
275
|
+
/** Every worker filed under `parentId` (the `parent_run_id` index plus memory), newest first:
|
|
276
|
+
* receipts or not, which is what the reconcile and deletion checks ask. */
|
|
277
|
+
listWorkersOf(parentId) {
|
|
278
|
+
const workers = new Map();
|
|
279
|
+
for (const run of this.held.values()) {
|
|
280
|
+
if (run.delegation?.role === 'worker' && run.delegation.parentRunId === parentId)
|
|
281
|
+
workers.set(run.id, [run, this.listOrder(run)]);
|
|
282
|
+
}
|
|
283
|
+
// Ids first: a live family's workers are usually all held, and then no record is read at all.
|
|
284
|
+
const cold = (this.db?.listIdsByParent(parentId) ?? []).filter((id) => !this.held.has(id) && !this.deleted.has(id));
|
|
285
|
+
for (const row of cold.length > 0 ? this.db.getMany(cold) : []) {
|
|
286
|
+
const run = this.fromRow(row);
|
|
287
|
+
if (run?.delegation?.role === 'worker' && run.delegation.parentRunId === parentId)
|
|
288
|
+
workers.set(row.id, [run, row]);
|
|
289
|
+
}
|
|
290
|
+
return sortNewestFirst(workers.values());
|
|
291
|
+
}
|
|
292
|
+
/** The id of every worker, held or stored, without decoding any (recovery's worker passes). */
|
|
293
|
+
listWorkerIds() {
|
|
294
|
+
const ids = new Set(this.db?.listWorkerIds() ?? []);
|
|
295
|
+
for (const id of this.deleted)
|
|
296
|
+
ids.delete(id);
|
|
297
|
+
for (const run of this.held.values())
|
|
298
|
+
if (run.delegation?.role === 'worker')
|
|
299
|
+
ids.add(run.id);
|
|
300
|
+
return [...ids];
|
|
301
|
+
}
|
|
302
|
+
/** The id of every run whose delegation is quarantined (`invalid`), held or stored: its stored
|
|
303
|
+
* summary says so, so nothing is decoded (scratch cleanup). */
|
|
304
|
+
listQuarantinedRunIds() {
|
|
305
|
+
const ids = new Set((this.db?.listKeysWhere(guardedJsonSql("json_extract(summary, '$.delegation.role') = 'invalid'", 0)) ?? []).map((key) => key.id));
|
|
306
|
+
for (const id of this.deleted)
|
|
307
|
+
ids.delete(id);
|
|
308
|
+
for (const [id, run] of this.held) {
|
|
309
|
+
if (run.delegation?.role === 'invalid')
|
|
310
|
+
ids.add(id);
|
|
311
|
+
else
|
|
312
|
+
ids.delete(id);
|
|
313
|
+
}
|
|
314
|
+
return [...ids];
|
|
315
|
+
}
|
|
316
|
+
/** All retained tasks this automation started, including variants, finished and archived runs.
|
|
317
|
+
* Logs and receipts may compact independently. Read only matching keys in SQLite and overlay
|
|
318
|
+
* held records so a debounced provenance update or deletion is reflected immediately. */
|
|
319
|
+
countAutomationRuns(automationId) {
|
|
320
|
+
const ids = new Set(this.db?.listAutomationRuns(automationId) ?? []);
|
|
321
|
+
for (const id of this.deleted)
|
|
322
|
+
ids.delete(id);
|
|
323
|
+
for (const [id, run] of this.held) {
|
|
324
|
+
if (run.automation?.automationId === automationId || run.automationTrigger?.automationId === automationId)
|
|
325
|
+
ids.add(id);
|
|
326
|
+
else
|
|
327
|
+
ids.delete(id);
|
|
328
|
+
}
|
|
329
|
+
return ids.size;
|
|
330
|
+
}
|
|
331
|
+
/** First non-archived task referencing a project issue, including secondary references. */
|
|
332
|
+
findNonArchivedRunByIssue(repo, number) {
|
|
333
|
+
const url = `https://github.com/${repo}/issues/${number}`.toLowerCase();
|
|
334
|
+
const matches = (run) => {
|
|
335
|
+
if (run.archived)
|
|
336
|
+
return false;
|
|
337
|
+
const urls = [run.referencedIssueUrl, ...(run.referencedIssueCandidates ?? []),
|
|
338
|
+
...(run.automation?.event.startsWith('issue.') ? [run.automation.githubUrl] : []),
|
|
339
|
+
...[...run.task.matchAll(new RegExp(ISSUE_URL_RE.source, 'gi'))].map((match) => match[0])]
|
|
340
|
+
.filter((value) => value !== undefined)
|
|
341
|
+
.map((value) => value.replace(/\/+$/, '').toLowerCase())
|
|
342
|
+
.filter((value) => value.endsWith(`/issues/${number}`));
|
|
343
|
+
// The legacy issueNumber is display-only and cannot establish repository identity.
|
|
344
|
+
// Explicit task markers remain project-scoped unless a qualified URL contradicts them.
|
|
345
|
+
return urls.includes(url) || (urls.length === 0 && run.markerRefs?.issue === number);
|
|
346
|
+
};
|
|
347
|
+
for (const run of this.held.values())
|
|
348
|
+
if (matches(run))
|
|
349
|
+
return run.id;
|
|
350
|
+
// Secondary references are record-only: query them in SQLite rather than hydrating every
|
|
351
|
+
// finished transcript or relying on the slim summary's primary issue number.
|
|
352
|
+
const where = `archived = 0 AND ${guardedJsonSql(`
|
|
353
|
+
json_extract(data, '$.issueNumber') = ? OR json_extract(data, '$.markerRefs.issue') = ?
|
|
354
|
+
OR lower(rtrim(json_extract(data, '$.referencedIssueUrl'), '/')) = ?
|
|
355
|
+
OR EXISTS (SELECT 1 FROM json_each(data, '$.referencedIssueCandidates') WHERE lower(rtrim(value, '/')) = ?)
|
|
356
|
+
OR (json_extract(data, '$.automation.event') LIKE 'issue.%' AND lower(rtrim(json_extract(data, '$.automation.githubUrl'), '/')) = ?)
|
|
357
|
+
OR instr(lower(json_extract(data, '$.task')), ?) > 0
|
|
358
|
+
`, 0, ['data'])}`;
|
|
359
|
+
for (const key of this.db?.listKeysWhere(where, [number, number, url, url, url, url]) ?? []) {
|
|
360
|
+
if (this.held.has(key.id) || this.deleted.has(key.id) || this.unreadable.has(key.id))
|
|
361
|
+
continue;
|
|
362
|
+
const run = this.getRun(key.id);
|
|
363
|
+
if (run && matches(run))
|
|
364
|
+
return key.id;
|
|
365
|
+
}
|
|
366
|
+
return undefined;
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
369
|
+
* The runs automation receipts launched, by receipt id (`automation.receiptId` or
|
|
370
|
+
* `automationTrigger.receiptId`). Memory answers first; a receipt it does not know costs one
|
|
371
|
+
* pass over `runs.db` that reads the records' JSON in SQLite — only a crash leftover (a
|
|
372
|
+
* receipt still `reserved` at startup) ever asks.
|
|
373
|
+
*/
|
|
374
|
+
findRunIdsByAutomationReceipt(receiptIds) {
|
|
375
|
+
const wanted = new Set(receiptIds);
|
|
376
|
+
const found = new Map();
|
|
377
|
+
const receiptOf = (run) => run.automation?.receiptId ?? run.automationTrigger?.receiptId;
|
|
378
|
+
for (const run of this.held.values()) {
|
|
379
|
+
const receipt = receiptOf(run);
|
|
380
|
+
if (receipt !== undefined && wanted.has(receipt))
|
|
381
|
+
found.set(receipt, run.id);
|
|
382
|
+
}
|
|
383
|
+
const missing = [...wanted].filter((receipt) => !found.has(receipt));
|
|
384
|
+
if (missing.length === 0 || !this.db)
|
|
385
|
+
return found;
|
|
386
|
+
for (const id of this.db.listRunsByAutomationReceipt(missing)) {
|
|
387
|
+
if (this.held.has(id) || this.deleted.has(id))
|
|
388
|
+
continue;
|
|
389
|
+
const run = this.getRun(id);
|
|
390
|
+
const receipt = run && receiptOf(run);
|
|
391
|
+
if (receipt !== undefined && wanted.has(receipt) && !found.has(receipt))
|
|
392
|
+
found.set(receipt, id);
|
|
393
|
+
}
|
|
394
|
+
return found;
|
|
395
|
+
}
|
|
396
|
+
/** The id of every root whose delegation carries a conversation, held or stored: recovery's full
|
|
397
|
+
* reconcile pass (#661). `naming` keeps the ledgers whose messages name that run id as sender or
|
|
398
|
+
* recipient. Stored roots come from the `conversation_members` index, so no record is read. */
|
|
399
|
+
listConversationRootIds(naming) {
|
|
400
|
+
const ids = new Set(this.db?.listConversationRoots(naming) ?? []);
|
|
401
|
+
for (const id of this.deleted)
|
|
402
|
+
ids.delete(id);
|
|
403
|
+
for (const [id, run] of this.held) {
|
|
404
|
+
if (run.delegation?.role === 'root' && run.delegation.conversation && (!naming || run.delegation.conversation.messages.some(message => [message.senderRunId, message.recipientRunId].includes(naming))))
|
|
405
|
+
ids.add(id);
|
|
406
|
+
else
|
|
407
|
+
ids.delete(id);
|
|
408
|
+
}
|
|
409
|
+
return [...ids];
|
|
410
|
+
}
|
|
411
|
+
/** The id of every run, held or stored, without decoding any (orphan-worktree sweeps). */
|
|
412
|
+
listRunIds() {
|
|
413
|
+
const ids = new Set(this.db?.listIds() ?? []);
|
|
414
|
+
for (const id of this.deleted)
|
|
415
|
+
ids.delete(id);
|
|
416
|
+
for (const id of this.held.keys())
|
|
417
|
+
ids.add(id);
|
|
418
|
+
return [...ids];
|
|
419
|
+
}
|
|
420
|
+
/** Runs with a materialized worktree directory (`worktreePath`, not reclaimed), most recently
|
|
421
|
+
* finished first, then newest first: worktree retention and the worktrees panel. */
|
|
422
|
+
listRunsWithWorktree() {
|
|
423
|
+
const runs = this.queryRuns(this.db?.listWithWorktree() ?? [], (run) => materializedWorktreePath(run) !== undefined);
|
|
424
|
+
const recency = ([run]) => run.finishedAt ?? run.createdAt;
|
|
425
|
+
return runs.sort((a, b) => (recency(a) < recency(b) ? 1 : recency(a) > recency(b) ? -1 : newestFirst(a[1], b[1]))).map(([run]) => run);
|
|
426
|
+
}
|
|
427
|
+
/**
|
|
428
|
+
* Every run that owns a branch or names the PR it created, as the few fields branch cleanup and
|
|
429
|
+
* git-log attribution read (issue 08 §B3, §B5; a squash commit is attributed by its PR number):
|
|
430
|
+
* the stored summary plus the `branch` and `base_branch` columns, so a Git-tab request decodes
|
|
431
|
+
* no record. Held runs answer from memory.
|
|
432
|
+
*/
|
|
433
|
+
listBranchOwners() {
|
|
434
|
+
const rows = (this.db?.listBranchOwners(`branch IS NOT NULL OR ${guardedJsonSql("json_extract(summary, '$.pullRequestUrl') IS NOT NULL", 0)}`) ?? [])
|
|
435
|
+
.filter((row) => !this.deleted.has(row.id) && !this.held.has(row.id));
|
|
436
|
+
return listBranchOwners(rows, [...this.held.values()], (id) => this.getRun(id));
|
|
437
|
+
}
|
|
438
|
+
/** The rows a column query returned, as records, with memory laid over them: a held run
|
|
439
|
+
* answers from memory (matching `matches` there, not on its maybe-older row). */
|
|
440
|
+
queryRuns(rows, matches) {
|
|
441
|
+
const runs = new Map();
|
|
442
|
+
for (const run of this.held.values())
|
|
443
|
+
if (matches(run))
|
|
444
|
+
runs.set(run.id, [run, this.listOrder(run)]);
|
|
445
|
+
for (const row of rows) {
|
|
446
|
+
if (runs.has(row.id) || this.held.has(row.id) || this.deleted.has(row.id))
|
|
447
|
+
continue;
|
|
448
|
+
const run = this.fromRow(row);
|
|
449
|
+
if (run && matches(run))
|
|
450
|
+
runs.set(row.id, [run, row]);
|
|
451
|
+
}
|
|
452
|
+
return [...runs.values()];
|
|
453
|
+
}
|
|
454
|
+
/** The run an idempotent start already created (#504), archived or not. A deleted run is gone
|
|
455
|
+
* with its record, so a retry after deletion honestly creates a fresh one. */
|
|
456
|
+
findRunByClientRequestId(clientRequestId) {
|
|
457
|
+
for (const run of this.held.values())
|
|
458
|
+
if (run.clientRequestId === clientRequestId)
|
|
459
|
+
return run;
|
|
460
|
+
const row = this.db?.findByClientRequestId(clientRequestId);
|
|
461
|
+
if (!row || this.held.has(row.id))
|
|
462
|
+
return undefined;
|
|
463
|
+
const run = this.getRun(row.id);
|
|
464
|
+
return run?.clientRequestId === clientRequestId ? run : undefined;
|
|
465
|
+
}
|
|
466
|
+
/** Indexed family enumeration, including members not yet flushed to SQLite. */
|
|
467
|
+
listFamilyRunIds(rootId) {
|
|
468
|
+
const ids = new Set([rootId, ...(this.db?.listIdsByParent(rootId) ?? [])]);
|
|
469
|
+
for (const [id, run] of this.held) {
|
|
470
|
+
if (familyRootOf(run) === rootId)
|
|
471
|
+
ids.add(id);
|
|
472
|
+
else if (id !== rootId)
|
|
473
|
+
ids.delete(id);
|
|
474
|
+
}
|
|
475
|
+
for (const id of this.deleted)
|
|
476
|
+
ids.delete(id);
|
|
477
|
+
return [...ids];
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
//# sourceMappingURL=run-queries.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-queries.js","sourceRoot":"","sources":["../../src/runs/run-queries.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAEjE,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAwB,MAAM,yCAAyC,CAAC;AACrH,OAAO,EAAE,gBAAgB,EAAoB,MAAM,oBAAoB,CAAC;AAExE,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAGvD,OAAO,EAAE,aAAa,EAAiC,MAAM,mBAAmB,CAAC;AAEjF,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,wBAAwB,EAAE,WAAW,EA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,SAAS,CAAC;IACpE,CAAC;IAED,+EAA+E;IAC/E,gBAAgB,CAAC,MAAc;QAC7B,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI,CAAC,EAAE,EAAE,eAAe,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAC3E,KAAK,MAAM,CAAC,EAAE,EAAE,GAAG,CAAC,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YAClC,IAAI,YAAY,CAAC,GAAG,CAAC,KAAK,MAAM;gBAAE,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;iBACzC,IAAI,EAAE,KAAK,MAAM;gBAAE,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACzC,CAAC;QACD,KAAK,MAAM,EAAE,IAAI,IAAI,CAAC,OAAO;YAAE,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QAC9C,OAAO,CAAC,GAAG,GAAG,CAAC,CAAC;IAClB,CAAC;CACF"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { RunRepoHandle } from './ports.ts';
|
|
2
|
+
import type { RunClaimsTopic } from './run-claims-topic.ts';
|
|
3
|
+
import type { RunColdReadsTopic } from './run-cold-reads.ts';
|
|
4
|
+
import type { RunDatabase } from './run-database.ts';
|
|
5
|
+
import type { RunPersistenceTopic } from './run-persistence.ts';
|
|
6
|
+
import type { RepoHandle, RunRecord } from './store.ts';
|
|
7
|
+
/** What the topic asks of the store; no import of `store.ts` values. */
|
|
8
|
+
export interface RepoScopeState {
|
|
9
|
+
/** The open database; null for an unavailable or closed store. */
|
|
10
|
+
db(): RunDatabase | null;
|
|
11
|
+
readonly held: Map<string, RunRecord>;
|
|
12
|
+
readonly deleted: Set<string>;
|
|
13
|
+
readonly claims: Pick<RunClaimsTopic, 'claimFamilies'>;
|
|
14
|
+
readonly persistence: Pick<RunPersistenceTopic, 'touch' | 'flush'>;
|
|
15
|
+
readonly rows: Pick<RunColdReadsTopic, 'decodeCold' | 'holdDecoded'>;
|
|
16
|
+
}
|
|
17
|
+
export declare class RunRepoScopeTopic implements RunRepoHandle {
|
|
18
|
+
private readonly state;
|
|
19
|
+
/** The repository this project IS (#945), armed after `open()` by `setRepoHandle`. Undefined
|
|
20
|
+
* until it arrives and `null` when it cannot be known — both mean "unscoped", which is
|
|
21
|
+
* exactly the pre-#945 behavior. */
|
|
22
|
+
repoHandle: RepoHandle | null | undefined;
|
|
23
|
+
constructor(state: RepoScopeState);
|
|
24
|
+
private get db();
|
|
25
|
+
private get held();
|
|
26
|
+
private get deleted();
|
|
27
|
+
private get claims();
|
|
28
|
+
private get persistence();
|
|
29
|
+
private decodeCold;
|
|
30
|
+
private holdDecoded;
|
|
31
|
+
/**
|
|
32
|
+
* Set discovered repository identity without blocking boot. Recompute conclusions from retained
|
|
33
|
+
* evidence, including cold records; null retains unknown-handle behavior.
|
|
34
|
+
*/
|
|
35
|
+
setRepoHandle(handle: RepoHandle | null): void;
|
|
36
|
+
/** Whether the stored summary still names a reference the scoped record no longer has. */
|
|
37
|
+
private storedScopeDiffers;
|
|
38
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The repository a project is, armed after the store opens, and the repair of the runs it rescopes
|
|
3
|
+
* (hearsay-tools/squawk#4044). `RunStore` keeps one of these as `store.repoScope`.
|
|
4
|
+
*/
|
|
5
|
+
import { isDeepStrictEqual } from 'node:util';
|
|
6
|
+
import { REFERENCED_RUN_RULE } from '../contract/index.js';
|
|
7
|
+
import { guardedJsonSql } from './guarded-json-sql.js';
|
|
8
|
+
import { snapshotRun } from './lifecycle.js';
|
|
9
|
+
import { rowFamily } from './run-claims.js';
|
|
10
|
+
import { namesForeignReference, rescopeRun } from './run-references.js';
|
|
11
|
+
import { parseStoredSummary } from './run-summary-page.js';
|
|
12
|
+
export class RunRepoScopeTopic {
|
|
13
|
+
state;
|
|
14
|
+
/** The repository this project IS (#945), armed after `open()` by `setRepoHandle`. Undefined
|
|
15
|
+
* until it arrives and `null` when it cannot be known — both mean "unscoped", which is
|
|
16
|
+
* exactly the pre-#945 behavior. */
|
|
17
|
+
repoHandle;
|
|
18
|
+
constructor(state) {
|
|
19
|
+
this.state = state;
|
|
20
|
+
}
|
|
21
|
+
get db() { return this.state.db(); }
|
|
22
|
+
get held() { return this.state.held; }
|
|
23
|
+
get deleted() { return this.state.deleted; }
|
|
24
|
+
get claims() { return this.state.claims; }
|
|
25
|
+
get persistence() { return this.state.persistence; }
|
|
26
|
+
decodeCold(row, loaded) { return this.state.rows.decodeCold(row, loaded); }
|
|
27
|
+
holdDecoded(run) { return this.state.rows.holdDecoded(run); }
|
|
28
|
+
/**
|
|
29
|
+
* Set discovered repository identity without blocking boot. Recompute conclusions from retained
|
|
30
|
+
* evidence, including cold records; null retains unknown-handle behavior.
|
|
31
|
+
*/
|
|
32
|
+
setRepoHandle(handle) {
|
|
33
|
+
this.repoHandle = handle;
|
|
34
|
+
if (!handle)
|
|
35
|
+
return; // nothing to prove foreign against
|
|
36
|
+
// `touch` per healed run: the cockpit is already live when the handle lands, so a corrected
|
|
37
|
+
// chip has to reach the open page over SSE, not just the next `runs.json` write.
|
|
38
|
+
let healed = false;
|
|
39
|
+
const stored = this.db?.listWhere(guardedJsonSql(`${REFERENCED_RUN_RULE.sql} OR json_extract(summary, '$.pullRequests') IS NOT NULL`, 0)).filter((row) => {
|
|
40
|
+
if (this.held.has(row.id) || this.deleted.has(row.id))
|
|
41
|
+
return false;
|
|
42
|
+
const summary = parseStoredSummary(row.summary);
|
|
43
|
+
return !summary || namesForeignReference(summary, handle);
|
|
44
|
+
}) ?? [];
|
|
45
|
+
for (const run of [...this.held.values()]) {
|
|
46
|
+
const before = snapshotRun(run);
|
|
47
|
+
if (rescopeRun(run, this.repoHandle)) {
|
|
48
|
+
this.persistence.touch(run, before);
|
|
49
|
+
healed = true;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
// Only rows this store may write: another process's runs heal when their owner arms its handle.
|
|
53
|
+
const writable = this.claims.claimFamilies(stored.map(rowFamily));
|
|
54
|
+
for (const row of stored) {
|
|
55
|
+
if (!writable.has(rowFamily(row)))
|
|
56
|
+
continue;
|
|
57
|
+
let before;
|
|
58
|
+
const run = this.decodeCold(row, (loaded) => { before = snapshotRun(loaded); });
|
|
59
|
+
// `decodeCold` already scoped it with the handle just armed; write it when that changed it.
|
|
60
|
+
if (!run || !this.storedScopeDiffers(row, run))
|
|
61
|
+
continue;
|
|
62
|
+
this.holdDecoded(run);
|
|
63
|
+
this.persistence.touch(run, before ?? snapshotRun(run));
|
|
64
|
+
healed = true;
|
|
65
|
+
}
|
|
66
|
+
// Discovery may finish after headless shutdown's final flush. Persist repairs now: the
|
|
67
|
+
// debounced save is unref'd, so it cannot keep the CLI alive once the lookup completes.
|
|
68
|
+
if (healed)
|
|
69
|
+
this.persistence.flush();
|
|
70
|
+
}
|
|
71
|
+
/** Whether the stored summary still names a reference the scoped record no longer has. */
|
|
72
|
+
storedScopeDiffers(row, run) {
|
|
73
|
+
const summary = parseStoredSummary(row.summary);
|
|
74
|
+
return summary?.referencedPullRequestUrl !== run.referencedPullRequestUrl ||
|
|
75
|
+
summary?.referencedIssueUrl !== run.referencedIssueUrl || summary?.issueNumber !== run.issueNumber || !isDeepStrictEqual(summary?.pullRequests, run.pullRequests);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=run-repo-scope.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-repo-scope.js","sourceRoot":"","sources":["../../src/runs/run-repo-scope.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AAClF,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,E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