@juangcarmona/lighthouse-sdlc 0.24.1 → 0.24.2
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 +2 -0
- package/package.json +1 -1
- package/src/repository-housekeeping.mjs +10 -1
- package/src/worker-recovery.mjs +13 -3
package/README.md
CHANGED
|
@@ -115,6 +115,8 @@ An operator may retire monitoring of a terminal historical execution after inspe
|
|
|
115
115
|
|
|
116
116
|
Retirement records `owner-retired` alongside the original observation and owner decision in the scan artifact. Unknown outcomes remain unknown. It authorizes no retry, reservation release, publication, merge or lifecycle completion; existing issue blockers and candidate PRs remain actionable. Missing relationships and other unreconciled observations still make coverage incomplete. Deleting or editing the decision makes that historical monitoring incomplete again.
|
|
117
117
|
|
|
118
|
+
After a repository rename, an old receipt may no longer validate under its current namespace. Inspection reports that receipt as `receipt-invalid` while preserving other observations. To retire its monitoring, add `requestRepository` with the former owner/name and `repositoryId` with the current numeric GitHub repository ID to the owner decision. The former namespace must retain the same owner, the original receipt must validate under that namespace, and both its fetched comment and terminal native run must belong to the current repository. This compatibility applies only to inspection retirement; it cannot authenticate a dispatch or admit recovery under an old name.
|
|
119
|
+
|
|
118
120
|
For a manual dry-run, dispatch maintenance with `housekeeping: true` and `dry_run: true`. It retains `lighthouse-daily-housekeeping-<attempt>/daily-housekeeping.json` without tracker, reservation or continuation effects; it is not scheduled-operation evidence. Set `dry_run: false` only after activation to update the existing report index. The index preserves owner notes, newer observations and the last complete repository scan. Existing issue-serialized maintenance remains responsible for legal reservation cleanup, bounded recovery and lifecycle completion; resolved dependencies and merged PRs grant no new authority. A daily inspection does not claim those effects succeeded.
|
|
119
121
|
|
|
120
122
|
The Lighthouse operator can run `node scripts/reconcile-worker-maintenance.mjs --report-index <issue>` to assess actual complete daily coverage independently of half-hour recovery freshness. The daily pointer must match a native run, attempt and complete inspection artifact. Missing, disabled, skipped, partial, inaccessible and overdue coverage remain unhealthy or unconfirmed. A cron expression is not a latency guarantee. Installation, activation, package publication, complete native scans and verified effects require separate evidence; no fleet registration or named pilot is required.
|
package/package.json
CHANGED
|
@@ -24,6 +24,7 @@ export function housekeepingReconciler(api, repository, owner, indexNumber) {
|
|
|
24
24
|
const value = JSON.parse(match[1]);
|
|
25
25
|
const localEvidence = url => typeof url === 'string' && url.startsWith(`https://github.com/${repository}/`) && /^(?:issues\/[1-9][0-9]*(?:#issuecomment-[1-9][0-9]*)?|pull\/[1-9][0-9]*|actions\/runs\/[1-9][0-9]*(?:\/attempts\/[1-9][0-9]*)?)$/.test(url.slice(`https://github.com/${repository}/`.length));
|
|
26
26
|
if (value.schemaVersion !== 1 || value.repository !== repository || value.disposition !== 'retire' || ![value.issue, value.requestCommentId, value.workerRunId, value.runAttempt].every(positive) || !/^[a-f0-9]{64}$/.test(value.requestId ?? '') || !/^[a-f0-9]{64}$/.test(value.requestDigest ?? '') || typeof value.reason !== 'string' || !value.reason.trim() || value.reason.length > 2000 || !Array.isArray(value.evidence) || !value.evidence.length || value.evidence.length > 20 || !value.evidence.every(localEvidence)) throw Error('Invalid owner reconciliation');
|
|
27
|
+
if (value.requestRepository !== undefined && (!new RegExp(`^${owner}/[A-Za-z0-9_.-]+$`).test(value.requestRepository) || value.requestRepository === repository || !positive(value.repositoryId))) throw Error('Invalid historical repository identity');
|
|
27
28
|
result.push({ value, comment });
|
|
28
29
|
}
|
|
29
30
|
}
|
|
@@ -38,8 +39,16 @@ export function housekeepingReconciler(api, repository, owner, indexNumber) {
|
|
|
38
39
|
if (!decision || !(worker.state === 'uncertain' || incompleteCodes.has(worker.code))) { workers.push(worker); continue; }
|
|
39
40
|
const { value, comment } = decision;
|
|
40
41
|
const receiptComment = await api(`issues/comments/${value.requestCommentId}`);
|
|
41
|
-
|
|
42
|
+
let receipt;
|
|
43
|
+
if (value.requestRepository !== undefined) {
|
|
44
|
+
const current = await api('');
|
|
45
|
+
if (worker.code !== 'receipt-invalid' || worker.requestCommentId !== value.requestCommentId || receiptComment.issue_url !== `https://api.github.com/repos/${repository}/issues/${item.issue}` || current.full_name !== repository || current.id !== value.repositoryId) throw Error('Historical receipt repository is not confirmed');
|
|
46
|
+
// Validate the original identifier under the explicitly recorded old namespace.
|
|
47
|
+
// The fetched comment and native execution must still belong to the current numeric repository.
|
|
48
|
+
receipt = readDispatchReceipt({ ...receiptComment, issue_url: `https://api.github.com/repos/${value.requestRepository}/issues/${item.issue}` }, value.requestRepository, item.issue);
|
|
49
|
+
} else receipt = readDispatchReceipt(receiptComment, repository, item.issue);
|
|
42
50
|
const run = await api(`actions/runs/${value.workerRunId}`);
|
|
51
|
+
if (value.requestRepository !== undefined && run.repository?.id !== value.repositoryId) throw Error('Historical execution belongs to a different repository');
|
|
43
52
|
if (receipt.id !== value.requestId || receipt.digest !== value.requestDigest || String(receipt.workerRunId) !== String(value.workerRunId) || (receipt.recovery?.rootId ?? receipt.id) !== worker.rootId || Number(comment.id) <= Number(receiptComment.id) || run.id !== value.workerRunId || run.run_attempt !== value.runAttempt || run.repository?.full_name !== repository || run.path !== stagePath(workerFor(receipt)) || run.status !== 'completed' || !Number.isFinite(Date.parse(run.updated_at)) || Date.parse(run.updated_at) > Date.parse(comment.created_at)) throw Error('Owner reconciliation no longer matches the terminal execution');
|
|
44
53
|
const url = `https://github.com/${repository}/issues/${indexNumber}#issuecomment-${comment.id}`;
|
|
45
54
|
workers.push({ ...worker, state: 'reconciled', code: 'owner-retired', original: worker, reconciliation: { ...value, commentId: comment.id, url }, nextAction: `Historical monitoring retired by the owner: ${url}. Preserve the original outcome and existing candidates; no retry or lifecycle transition is authorized.` });
|
package/src/worker-recovery.mjs
CHANGED
|
@@ -150,12 +150,22 @@ export async function observeDispatch(api, repository, owner, comment, issue, co
|
|
|
150
150
|
// Reporting is read-only so it can observe an active worker without acquiring its lease.
|
|
151
151
|
export async function observeRecovery(api, repository, owner, issueNumber, now = Date.now(), readArtifact = readActionsJson) {
|
|
152
152
|
const issue = await api(`issues/${issueNumber}`), comments = await issueComments(api, issueNumber);
|
|
153
|
-
const entries =
|
|
153
|
+
const entries = [], invalid = [];
|
|
154
|
+
for (const comment of comments.filter(c => c.user?.login === 'github-actions[bot]' && c.user.type === 'Bot' && c.body?.includes('<!-- lighthouse-dispatch:'))) {
|
|
155
|
+
try { entries.push({ comment, receipt: readDispatchReceipt(comment, repository, issueNumber) }); }
|
|
156
|
+
catch {
|
|
157
|
+
let receipt;
|
|
158
|
+
try { const matches = [...comment.body.matchAll(/<!-- lighthouse-dispatch:(\{[^\n]*\}) -->/g)]; if (matches.length === 1) receipt = JSON.parse(matches[0][1]); } catch {}
|
|
159
|
+
let worker = 'unknown';
|
|
160
|
+
try { stagePath(workerFor(receipt)); worker = workerFor(receipt); } catch {}
|
|
161
|
+
invalid.push({ issue: issueNumber, worker, outcome: 'unknown', state: 'uncertain', code: 'receipt-invalid', requestCommentId: comment.id, ...(receipt ? { rootId: receipt.recovery?.rootId ?? receipt.id, observedRunId: String(receipt.workerRunId) } : {}), nextAction: `Maintainer: inspect historical receipt https://github.com/${repository}/issues/${issueNumber}#issuecomment-${comment.id}. It cannot authenticate recovery; preserve its original bytes and reconcile its repository identity and effects.` });
|
|
162
|
+
}
|
|
163
|
+
}
|
|
154
164
|
const unattended = comments.filter(c => c.user?.login === 'github-actions[bot]' && c.user.type === 'Bot' && c.body?.includes('<!-- lighthouse-unattended:')).at(-1);
|
|
155
|
-
if (unattended && (!entries.length || unattended.id > entries.at(-1).comment.id)) return [];
|
|
165
|
+
if (!invalid.length && unattended && (!entries.length || unattended.id > entries.at(-1).comment.id)) return [];
|
|
156
166
|
const latest = new Map();
|
|
157
167
|
for (const entry of entries) latest.set(entry.receipt.recovery?.rootId ?? entry.receipt.id, entry);
|
|
158
|
-
const observations = [];
|
|
168
|
+
const observations = [...invalid];
|
|
159
169
|
for (const { comment } of latest.values()) {
|
|
160
170
|
const { dispatch, stop, run, jobs, revision, workflowRevision, ...observation } = await observeDispatch(api, repository, owner, comment, issue, comments, now, readArtifact);
|
|
161
171
|
observations.push(observation);
|