@juangcarmona/lighthouse-sdlc 0.22.3 → 0.22.4
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/github-actions.md +2 -0
- package/package.json +1 -1
- package/src/worker-recovery.mjs +17 -1
- package/src/worker-reports.mjs +1 -0
package/github-actions.md
CHANGED
|
@@ -140,6 +140,8 @@ For a scoped acceptance, set `LIGHTHOUSE_MAINTENANCE_ISSUES` to a JSON array of
|
|
|
140
140
|
|
|
141
141
|
A confirmed automatic final-review rejection before admission has a separate limit of one linked retry. The trusted callback uses `workflow_dispatch` with the native worker ID, so recovery does not depend on delivery of a separate completion event. Both completion signals retain the original worker, revisions and receipt; it reuses the original merge, CI and product apply. Changed current authority blocks recovery. Duplicate completion signals and the scheduled sweep share the same retry identity and issue lease. GitHub event delivery and schedules provide no recovery latency guarantee.
|
|
142
142
|
|
|
143
|
+
When an authenticated worker's workflow ref no longer resolves, maintenance confirms its absence from GitHub branch and tag inventories and retains a `workflow-ref-missing` blocker with the original request and run. Historical provenance remains valid; no retry, handoff restoration or automatic ref recreation follows. Other observation entries continue. Permission failures, unavailable inventories and ambiguous lookups remain errors rather than proof of deletion.
|
|
144
|
+
|
|
143
145
|
Recovery authenticates the original dispatch and its bounded chain, current source and workflow revision, owner intent, reservation and Actions job evidence. It retries only failed or timed-out refine/propose/implement/apply-review executions whose preparation passed and whose trusted publication step is positively recorded as skipped. Each retry is a new receipt and immutable request, at most two per original request, delayed at least 30 minutes after the previous execution. A newer owner request supersedes older recovery candidates. Workers retain their lifecycle gates and current authority checks.
|
|
144
146
|
|
|
145
147
|
When the current dispatched agent failed or was cancelled and the publication step is confirmed skipped, maintenance can recreate a missing terminal notice without granting a retry. It can restore a missing triage or refinement handoff when retained validated output, owner intent, source, workflow and current labels still match. If a failed publication left the original stage label in place, maintenance can complete its outcome-label transition before restoring the handoff; a competing stage or status blocks this recovery. A restored result does not imply that an interrupted automatic continuation ran; the owner requests the next stage after inspection. A missing or unverified version 3 label adoption is reported in the failure notice; the host does not create the label implicitly. Confirmed implementation publication can resume its CI request through the reconciliation below. Confirmed integration can restore its report and continuation. A confirmed blocked integration report can also restore its missing handoff while keeping the blocker and requiring separate authorization to continue. Other interrupted publications require operator inspection.
|
package/package.json
CHANGED
package/src/worker-recovery.mjs
CHANGED
|
@@ -97,6 +97,17 @@ export function recoveryDecision({ request, receipt, run, jobs, issue, comments,
|
|
|
97
97
|
return result('retryable', 'worker-technical-failure', 'Record one linked retry under the adopted policy.', { retryAt });
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
+
async function workflowRefMissing(api, ref, error) {
|
|
101
|
+
if (![404, 422].includes(error.status)) return false;
|
|
102
|
+
// A lookup failure alone cannot prove absence; require successful, bounded inventories.
|
|
103
|
+
for (const kind of ['heads', 'tags']) {
|
|
104
|
+
const prefix = `refs/${kind}/${ref}`;
|
|
105
|
+
const refs = await api(`git/matching-refs/${kind}/${encodeURIComponent(ref)}?per_page=100`);
|
|
106
|
+
if (!Array.isArray(refs) || refs.length >= 100 || refs.some(item => typeof item?.ref !== 'string' || !item.ref.startsWith(prefix) || item.ref === prefix)) return false;
|
|
107
|
+
}
|
|
108
|
+
return true;
|
|
109
|
+
}
|
|
110
|
+
|
|
100
111
|
export async function observeDispatch(api, repository, owner, comment, issue, comments, now = Date.now(), readArtifact = readActionsJson) {
|
|
101
112
|
const receipt = readDispatchReceipt(comment, repository, issue.number);
|
|
102
113
|
const missingOrigin = () => ({ issue: issue.number, worker: workerFor(receipt), outcome: 'unknown', rootId: receipt.recovery?.rootId ?? receipt.id, attempt: receipt.recovery?.attempt ?? 0, state: 'uncertain', code: 'dispatch-origin-unavailable', nextAction: `Inspect original router https://github.com/${repository}/actions/runs/${receipt.routerRunId}/attempts/${receipt.routerAttempt} and request digest ${receipt.digest}. Restore only retained authenticated bytes with that digest and origin; otherwise preserve the candidate and reconcile effects before a new owner request. Never resend the unconfirmed dispatch.` });
|
|
@@ -119,8 +130,13 @@ export async function observeDispatch(api, repository, owner, comment, issue, co
|
|
|
119
130
|
if (!Array.isArray(jobs.jobs) || !Number.isSafeInteger(jobs.total_count) || jobs.total_count !== jobs.jobs.length || jobs.total_count > 100) throw Error('Execution job inventory is incomplete or exceeds recovery bounds');
|
|
120
131
|
const repo = await api('');
|
|
121
132
|
const revision = (await api(`commits/${encodeURIComponent(repo.default_branch)}`)).sha;
|
|
122
|
-
const workflowRevision = (await api(`commits/${encodeURIComponent(dispatch.request.ref)}`)).sha;
|
|
123
133
|
const execution = workerExecutionObservation({ run, jobs: jobs.jobs, receipt, worker: workerFor(dispatch.request) });
|
|
134
|
+
let workflowRevision;
|
|
135
|
+
try { workflowRevision = (await api(`commits/${encodeURIComponent(dispatch.request.ref)}`)).sha; }
|
|
136
|
+
catch (error) {
|
|
137
|
+
if (!await workflowRefMissing(api, dispatch.request.ref, error)) throw error;
|
|
138
|
+
return { ...identity({ request: dispatch.request, run }), outcome: execution.outcome, state: 'blocked', code: 'workflow-ref-missing', workflowRef: dispatch.request.ref, expectedWorkflowRevision: dispatch.request.workflowRevision, requestDigest: receipt.digest, requestCommentId: comment.id, refLookupStatus: error.status, nextAction: `Maintainer: reconcile the retained execution https://github.com/${repository}/actions/runs/${run.id} and select an existing workflow ref under a fresh owner request. Historical provenance remains authenticated; never resend this request or recreate its ref automatically.` };
|
|
139
|
+
}
|
|
124
140
|
const observation = workerFor(dispatch.request) === 'apply-product-change'
|
|
125
141
|
? ['completed', 'waiting', 'blocked'].includes(receipt.status) ? null : productApplyObservation({ prepare: jobs.jobs.find(job => job.name === 'Recheck product approval')?.conclusion, apply: jobs.jobs.find(job => job.name === 'Apply with the pinned ProductShape provider')?.conclusion, publish: jobs.jobs.find(job => job.name === 'Recheck and publish provider output')?.conclusion })
|
|
126
142
|
: execution.observation;
|
package/src/worker-reports.mjs
CHANGED
|
@@ -7,6 +7,7 @@ export const causes = Object.freeze({
|
|
|
7
7
|
'dispatch-unconfirmed': ['Dispatch confirmation is missing', 'Reconcile the recorded request with Actions before requesting more work.'],
|
|
8
8
|
'execution-rerun': ['Execution was rerun outside recovery', 'Inspect all attempts and the original claim.'],
|
|
9
9
|
'authority-changed': ['Source or owner intent changed', 'Request fresh work against the current source and intent.'],
|
|
10
|
+
'workflow-ref-missing': ['Workflow reference no longer exists', 'Maintainer: reconcile the original execution and select an existing workflow ref under a fresh owner request; never resend or recreate its ref automatically.'],
|
|
10
11
|
'manual-recovery': ['Outcome requires operator recovery', 'Inspect actual effects and make a new owner decision.'],
|
|
11
12
|
'publication-uncertain': ['Publication effects are uncertain', 'Inspect the PR, issue and publication job before another request.'],
|
|
12
13
|
'execution-time-unknown': ['Execution timestamp is unavailable', 'Inspect the Actions execution timestamps.'],
|