@juangcarmona/lighthouse-sdlc 0.21.11 → 0.22.1
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 +4 -0
- package/execution-environments.md +2 -0
- package/github-actions.md +6 -4
- package/issue-control.md +61 -0
- package/package.json +6 -3
- package/schemas/issue-control-intent.schema.json +408 -0
- package/src/admission-recovery.mjs +25 -2
- package/src/completion-state.mjs +43 -0
- package/src/host-contract.mjs +3 -1
- package/src/implementation-evidence.mjs +6 -2
- package/src/implementation-runtime.mjs +2 -1
- package/src/implementation.mjs +3 -2
- package/src/install-workflows.mjs +14 -1
- package/src/issue-actions.mjs +40 -71
- package/src/issue-admission.mjs +41 -0
- package/src/issue-comment-intent.mjs +56 -0
- package/src/issue-control-actions.mjs +103 -0
- package/src/issue-control-admission.mjs +80 -0
- package/src/issue-control-contract.mjs +69 -0
- package/src/issue-control-execution.mjs +56 -0
- package/src/issue-control-facts.mjs +137 -0
- package/src/issue-control-intent.mjs +73 -0
- package/src/issue-control-ledger.mjs +139 -0
- package/src/issue-control-native.mjs +62 -0
- package/src/issue-control.mjs +155 -0
- package/src/issue-entry.mjs +56 -0
- package/src/product-change.mjs +2 -0
- package/src/proposal-review.mjs +5 -2
- package/src/proposal.mjs +5 -2
- package/src/source-link-tree.mjs +90 -0
- package/src/stage-dispatch.mjs +5 -2
- package/src/unattended-actions.mjs +11 -34
- package/src/unattended-runtime.mjs +1 -1
- package/src/worker-maintenance.mjs +11 -3
- package/src/worker-recovery.mjs +5 -3
- package/unattended.md +2 -0
- package/workflows/lighthouse-sdlc-router.yml +87 -0
- package/workflows/lighthouse-worker-maintenance.yml +12 -1
package/README.md
CHANGED
|
@@ -91,6 +91,10 @@ The installer subscribes the router to selected continuation workers and the wor
|
|
|
91
91
|
|
|
92
92
|
Required PR checks must come from an event [GitHub accepts for PR rules](https://docs.github.com/en/pull-requests/how-tos/merge-and-close-pull-requests/troubleshooting-required-status-checks?plain=1). A green `workflow_dispatch` job supports execution evidence but cannot satisfy those rules. Lighthouse authenticates the native run, SHA and check suite before counting a job; unavailable origin or an ineligible event blocks integration with its execution link. Configure eligible CI for bot publications separately; dispatch alone does not establish unattended merge readiness. Post-merge verification can still use dispatch.
|
|
93
93
|
|
|
94
|
+
## Typed issue controls
|
|
95
|
+
|
|
96
|
+
The optional [issue-control SDK](issue-control.md) provides authenticated observation, stage-only Refine/Propose, ordinary comments and explicit continuation of a verified pending question. Install with `--with-issue-control` to enable the existing router's typed entry and capability declaration. Caller-owned credentials and a durable atomic intent journal are required; source receipts distinguish submission, worker admission and validated results. Native actual-user qualification and release remain separate from this source implementation.
|
|
97
|
+
|
|
94
98
|
## Bounded unattended routes
|
|
95
99
|
|
|
96
100
|
Install `--with-unattended` explicitly to add fast-forward and test-first hotfix compositions. [Configuration and execution](unattended.md) describes admission, separate model review, regression proof, scope limits, merge delegation and recovery. Existing supervised routes retain their stops. The bounded `lighthouse-unattended-<run>-<attempt>` artifact contains delivery receipts; full engine and check logs are retained separately as `lighthouse-unattended-diagnostics-<run>-<attempt>`.
|
|
@@ -50,6 +50,8 @@ See the source repository's `src/examples/opencode-engine/ENVIRONMENTS.md` for l
|
|
|
50
50
|
|
|
51
51
|
Implementation and independent validation each create a local Git repository containing one candidate snapshot commit, without remotes, checkout configuration or hooks. This supports Git-based working-tree checks without exposing the original checkout. It does not certify earlier commits; full-history security checks remain a separate repository CI responsibility.
|
|
52
52
|
|
|
53
|
+
Tracked source symlinks remain opaque: the host authenticates their path, mode and blob identity from the admitted revision and excludes them from the executable filesystem. A separate temporary index combines that metadata with the checked regular-file tree; command evidence binds the metadata digest, and its reader independently reconstructs it from the original commit. Publication still requires equality with the complete checked tree. Link target contents are never read through this mechanism.
|
|
54
|
+
|
|
53
55
|
Agent evidence is bounded to 200 regular files and 64 MiB per collection, including static previews, screenshots and reports. Symbolic links at the collection root or within it are rejected. An exceeded budget reports the file count or byte count that crossed its limit; larger collections must be curated before handoff.
|
|
54
56
|
|
|
55
57
|
## Resource limits and command completion
|
package/github-actions.md
CHANGED
|
@@ -134,17 +134,19 @@ The `apply-review` worker is installed with proposal support. It also handles im
|
|
|
134
134
|
|
|
135
135
|
## Worker maintenance
|
|
136
136
|
|
|
137
|
-
Install the optional deterministic workflow with `--with-maintenance`. After reviewing its permissions, set `LIGHTHOUSE_MAINTENANCE_ENABLED=true` and the existing `LIGHTHOUSE_AUTOMATION_ENABLED=true` to observe
|
|
137
|
+
Install the optional deterministic workflow with `--with-maintenance`. After reviewing its permissions, set `LIGHTHOUSE_MAINTENANCE_ENABLED=true` and the existing `LIGHTHOUSE_AUTOMATION_ENABLED=true` to observe owner issues every 30 minutes, or dispatch a single issue manually. Native `review` completion also wakes maintenance for its authenticated before-admission rejection; unrelated or uncertain completions select no issue. Observation alone performs no retry. Set `LIGHTHOUSE_RECOVERY_ENABLED=true` separately to permit bounded recovery; removing it also stops admission of already-requested retries.
|
|
138
138
|
|
|
139
139
|
For a scoped acceptance, set `LIGHTHOUSE_MAINTENANCE_ISSUES` to a JSON array of issue numbers before enabling maintenance or recovery. `[]` selects no issues; an absent value retains the open-owner-issue scan. Invalid configuration stops admission. Preserve prior variable values and disable recovery before removing a temporary scope. Report publication remains separately configured.
|
|
140
140
|
|
|
141
|
+
A confirmed automatic final-review rejection before admission has a separate limit of one linked retry. Completion wakes the existing reconciler and retains 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
|
+
|
|
141
143
|
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.
|
|
142
144
|
|
|
143
145
|
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.
|
|
144
146
|
|
|
145
147
|
For a completed triage or refinement whose agent failed or was cancelled before publication, maintenance can release `agent-working` only when the authenticated request artifact, job results and unchanged bot label event identify that reservation. A human hold, newer dispatch, changed intent or source, missing evidence, uncertain publication, or an already published failure notice prevents cleanup. The cleanup does not authorize a retry.
|
|
146
148
|
|
|
147
|
-
Cancellation, review execution, human decisions, stale intent/source, expired artifacts, incomplete jobs, uncertain dispatch or publication, and reservations without the evidence above require operator inspection. When an authenticated triage or refinement preparation failed and both the agent and publisher were skipped, maintenance can record that failure and restore its notice without retrying. An unclaimed dispatch additionally requires exactly one matching authenticated execution. Missing or ambiguous confirmation never authorizes resend. Inspect the linked run and its actual effects before making a new owner request. Retries never clear another execution's reservation. Current receipt and Actions observations determine the decision; raw agent prose cannot grant retry authority.
|
|
149
|
+
Cancellation, admitted review execution, human decisions, stale intent/source, expired artifacts, incomplete jobs, uncertain dispatch or publication, and reservations without the evidence above require operator inspection. When an authenticated triage or refinement preparation failed and both the agent and publisher were skipped, maintenance can record that failure and restore its notice without retrying. An unclaimed dispatch additionally requires exactly one matching authenticated execution. Missing or ambiguous confirmation never authorizes resend. Inspect the linked run and its actual effects before making a new owner request. Retries never clear another execution's reservation. Current receipt and Actions observations determine the decision; raw agent prose cannot grant retry authority.
|
|
148
150
|
|
|
149
151
|
Implementation and correction workers retain `ci-requests.json` beside `published-pr.json`. CI launch records its send state before the API call. Recovery rechecks the candidate, owner intent, policy and review, then observes matching native CI runs before doing anything else. A confirmed unsent or rejected request may use the same two-retry, 30-minute limit. An unknown or acknowledged request without a matching run stops for inspection. Legacy publications without send-state evidence also stop. Recovery never reruns the agent or edits the candidate to start CI. A technical retry of a CI correction retains its original correction round and budget.
|
|
150
152
|
|
|
@@ -152,7 +154,7 @@ After a confirmed integration, maintenance can use the original authenticated re
|
|
|
152
154
|
|
|
153
155
|
A complete router rerun can remove the original dispatch artifact. Maintenance identifies the original run, attempt and expected digest and leaves an unconfirmed dispatch stopped. Restore only authenticated original bytes; otherwise use a fresh supported owner request after inspecting actual effects. Updating the default branch or npm package does not replace workflow definitions carried by an existing PR. Record the event, candidate, router, worker and harness revisions separately when qualifying an upgrade.
|
|
154
156
|
|
|
155
|
-
Maintenance bounds are 100 open owner issues, 500 scanned issue/PR entries, 1,000 comments per issue and 100 jobs per execution. Exceeding a bound fails visibly. Original dispatch artifacts retain their existing 14-day lifetime. Recovery does not outlive missing evidence.
|
|
157
|
+
Maintenance bounds are 100 open owner issues, 500 scanned issue/PR entries, 1,000 comments per issue and 100 jobs per execution. Exceeding a bound fails visibly. Original dispatch artifacts retain their existing 14-day lifetime. Recovery does not outlive missing evidence. The scheduled scan includes open owner issues and recent closed owner issues whose final-review receipt remains unresolved.
|
|
156
158
|
|
|
157
159
|
An active or queued execution without an Actions update for two hours is reported as stalled. Maintenance does not cancel it or release its reservation.
|
|
158
160
|
|
|
@@ -170,4 +172,4 @@ Reports group failures by worker and a fixed cause code. They contain source iss
|
|
|
170
172
|
|
|
171
173
|
The index prevents duplicate creation when a GitHub response is lost. A later pass links a uniquely matching bot-owned report. If creation is still unconfirmed, reporting stops for inspection instead of sending again. Disable reporting, inspect the maintenance run and search open and closed reports for that worker/cause before editing the index. Preserve a pending entry until a report can be linked or the owner has established that no creation occurred; deleting it permits a new create. Resume only after reconciling actual effects.
|
|
172
174
|
|
|
173
|
-
The reporter scans at most 500 issue/PR entries and retains at most 100 worker/cause entries and 200 distinct observations per report, within a 60 KB body. Overflow fails visibly and requires operator archival; nothing is silently evicted. Counts reflect observations made while reporting was enabled.
|
|
175
|
+
The reporter scans at most 500 issue/PR entries and retains at most 100 worker/cause entries and 200 distinct observations per report, within a 60 KB body. Overflow fails visibly and requires operator archival; nothing is silently evicted. Counts reflect observations made while reporting was enabled. Closed source issues outside the recent unresolved final-review inventory require an explicit maintenance dispatch. All report writes share one repository-wide Actions concurrency group. Existing version 1 reports migrate when next updated. CI-request failures retain allowlisted method/path, HTTP status or exception class, candidate and execution identities in the publication artifact, issue/PR handoff and job log; response bodies and credentials are excluded.
|
package/issue-control.md
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Issue-control SDK
|
|
2
|
+
|
|
3
|
+
The `./issue-control` export supplies `createIssueControl`, `parseIssueComment`, `parseIssueIntent` and `validateIssueIntent`. The [intent schema](schemas/issue-control-intent.schema.json) describes version 1; runtime validation also checks canonical JSON and UTF-8 byte limits. This implementation is awaiting packed-consumer and actual-user native qualification. Source availability does not establish a published or adopted release.
|
|
4
|
+
|
|
5
|
+
## Adoption
|
|
6
|
+
|
|
7
|
+
Install the selected package, review an immutable compatible workflow source pin, then preview:
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
node node_modules/@juangcarmona/lighthouse-sdlc/src/install-workflows.mjs . <immutable-lighthouse-commit> --with-propose --with-issue-control
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
After reviewing the diff, repeat with `--apply`; differing existing workflows require `--replace-reviewed`. The installer enables the source-owned `client-control` job in the existing router and writes `.lighthouse/issue-control.json`, binding its exact bytes and selected stages. It inventories existing or selected unattended/epic workflows for reservation coverage. Automation, credentials, provider access and execution readiness still require the [operator setup](github-actions.md). The installer preserves existing policy. Without verified version 1 adoption, the SDK reports unsupported and never falls back to legacy commands.
|
|
14
|
+
|
|
15
|
+
## Authenticated caller
|
|
16
|
+
|
|
17
|
+
```js
|
|
18
|
+
import { createIssueControl } from '@juangcarmona/lighthouse-sdlc/issue-control';
|
|
19
|
+
|
|
20
|
+
const control = createIssueControl({
|
|
21
|
+
repository: 'owner/repository',
|
|
22
|
+
transport, // authenticated provider adapter described below
|
|
23
|
+
readArtifact, // bounded authenticated artifact reader described below
|
|
24
|
+
readAuthority // trusted acting-user/token permission evidence
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
const state = await control.observe({ number: 7 });
|
|
28
|
+
const prepared = await control.prepare({ number: 7, action: 'refine', id: crypto.randomUUID() });
|
|
29
|
+
// Persist the whole prepared value before its first write.
|
|
30
|
+
const submitted = await control.submit(prepared, { claim });
|
|
31
|
+
// A recreated SDK uses the persisted prepared value and the same durable claim.
|
|
32
|
+
const reconciled = await control.reconcile(prepared);
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
`prepare` returns either a prepared object with `version`, `intent`, `key`, `payloadDigest` and `effect`, or an explicit unavailable/rejected state. Call `submit` only for a prepared object. `observe` and `prepare` perform reads only. They report source eligibility separately from execution readiness and can become stale while a request queues; source admission rechecks current authority.
|
|
36
|
+
|
|
37
|
+
The transport receives `{scope, repository?, path, method, body?, optional?, apiVersion?}`. Account scope uses `GET user`; repository paths are relative to the explicitly bound repository. Use the actual connected user's credentials, honor the requested API version, return parsed provider JSON, and map optional 404 to `null`. HTTP failures expose a numeric `status`; uncertain network failures retain uncertainty. No credentials, default transport, environment token lookup or ambient network access is supplied by this module. Comments are posted directly as that user. A bot or installation token cannot substitute for the acting account.
|
|
38
|
+
|
|
39
|
+
`readAuthority({api, repository, actor, metadata})` must return verified `actorId`, `repositoryId`, and boolean `commentWrite`/`dispatchWrite` capabilities for the actual credentials. Missing or mismatched evidence denies writes. The current contract supports the personal repository owner; other identities are explicitly unsupported. Reading repository variables may require additional token permission; a denial makes policy unavailable, rather than assuming automation is enabled.
|
|
40
|
+
|
|
41
|
+
`readArtifact(api, repository, runId, exactName, member, optional)` returns parsed JSON from exactly one unexpired artifact in that authenticated run. Return `null` only when an optional artifact is absent. Enforce the existing 2 MiB archive bound, complete inventory of at most 100 artifacts, safe ZIP member paths and duplicate rejection; never execute archive contents. Nested API operations are clamped to GET. The caller owns authenticated download and archive decoding. Do not use the internal operator reader as a browser transport: it uses ambient `gh` credentials.
|
|
42
|
+
|
|
43
|
+
`claim({key, payloadDigest, intent})` must atomically persist and return `{state:'claimed'}`, `{state:'existing'}` for the same payload, or `{state:'conflict'}`. Share this journal across tabs, processes and restarts. A claimed intent may make one POST; an existing claim only reconciles. No automatic resend follows an uncertain outcome. Uncoordinated journals cannot guarantee exactly-once comment creation.
|
|
44
|
+
|
|
45
|
+
## Actions and source proof
|
|
46
|
+
|
|
47
|
+
| Action | Scope and effect |
|
|
48
|
+
| --- | --- |
|
|
49
|
+
| `refine` / `propose` | One stage-only typed router dispatch, bound to repository/issue/actor, current source, input, capability and policy digests. Global automatic implementation, Product Change and merge grants are not inherited. |
|
|
50
|
+
| `comment` | Direct-user comment with a strict attributable footer. Body text remains data even if it resembles a command or approval; publication never resumes a wait. |
|
|
51
|
+
| `continue` | Direct-user answer bound to the exact verified question, original request and grant. Source admits only the current supported question and the intersection of its original grant with current policy. |
|
|
52
|
+
|
|
53
|
+
The full comment, including metadata, is limited to 48 KiB UTF-8; CRLF becomes LF and other text is preserved. `parseIssueComment` returns `typed`, `legacy` or `invalid`; show parsed typed body as source text, and treat invalid metadata as unsupported. Never strip invalid metadata then re-enter a legacy command parser. Typed comments must have the actual immutable user ID that the footer names.
|
|
54
|
+
|
|
55
|
+
The source records the immutable intent and exact key/payload lookup artifacts before admission. It reuses the native per-issue concurrency group, dispatch artifact and worker receipt. A repeated key reconciles its original result before current freshness checks; a changed payload conflicts. An equivalent new key gets a durable source alias, which reconciliation follows to its authenticated original. A deleted bot comment can be recovered through exact artifact indexes. Missing, expired, ambiguous or incomplete history remains unknown and cannot authorize a resend. Artifacts are retained for 90 days; callers retain their own prepared intents and journal.
|
|
56
|
+
|
|
57
|
+
`submitted` identifies the exact router run returned by GitHub API `2026-03-10`, or the exact published user comment. Its worker ID is unconfirmed. `source-admitted` establishes the source dispatch grant and receipt. `execution` separately exposes authenticated worker run/attempt, source status and validated published result when available. `questionConsumed` requires the matching continuation snapshot and validated source result; `questionResolved` additionally requires that result to pass. Posting an answer or admitting a worker alone never clears the wait.
|
|
58
|
+
|
|
59
|
+
Current v1 limitations include custom-model, handoff, epic and Product Change pending contexts. Repositories with epic admission enabled return explicit unsupported eligibility. Active background runs without authenticated issue binding make reservation coverage unavailable. Question text remains readable when its action is unsupported. No host scheduler, execution control, automatic approval or UI persistence is introduced.
|
|
60
|
+
|
|
61
|
+
Unmarked GitHub labels, comments and dispatches retain their existing lifecycle meaning. Typed client requests use their separate strict source admission and cannot pass through legacy routing. Actual-user OAuth/App-user permission, native source correlation and packed-package behavior must be qualified independently of fixture tests.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@juangcarmona/lighthouse-sdlc",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Provider-neutral SDLC skills, commands and route contracts for Lighthouse adopters",
|
|
6
6
|
"repository": {
|
|
@@ -45,7 +45,8 @@
|
|
|
45
45
|
"unattended.md",
|
|
46
46
|
"LICENSE",
|
|
47
47
|
"NOTICE",
|
|
48
|
-
"telemetry.md"
|
|
48
|
+
"telemetry.md",
|
|
49
|
+
"issue-control.md"
|
|
49
50
|
],
|
|
50
51
|
"bin": {
|
|
51
52
|
"lighthouse-sdlc": "./src/sdlc.mjs"
|
|
@@ -98,7 +99,9 @@
|
|
|
98
99
|
"./unattended": "./src/unattended.mjs",
|
|
99
100
|
"./telemetry": "./src/telemetry.mjs",
|
|
100
101
|
"./telemetry-opencode": "./src/telemetry-opencode.mjs",
|
|
101
|
-
"./schemas/telemetry-event.schema.json": "./schemas/telemetry-event.schema.json"
|
|
102
|
+
"./schemas/telemetry-event.schema.json": "./schemas/telemetry-event.schema.json",
|
|
103
|
+
"./issue-control": "./src/issue-control.mjs",
|
|
104
|
+
"./schemas/issue-control-intent.schema.json": "./schemas/issue-control-intent.schema.json"
|
|
102
105
|
},
|
|
103
106
|
"license": "Apache-2.0"
|
|
104
107
|
}
|
|
@@ -0,0 +1,408 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "Lighthouse issue-control intent v1",
|
|
4
|
+
"description": "Wire shape. The SDK validator also enforces canonical sorted JSON, exact UTF-8 byte bounds, repository identity, and attributable comment binding. Maximum serialized intent: 128000 bytes.",
|
|
5
|
+
"oneOf": [
|
|
6
|
+
{
|
|
7
|
+
"type": "object",
|
|
8
|
+
"additionalProperties": false,
|
|
9
|
+
"required": [
|
|
10
|
+
"version",
|
|
11
|
+
"id",
|
|
12
|
+
"repository",
|
|
13
|
+
"issue",
|
|
14
|
+
"actorId",
|
|
15
|
+
"action",
|
|
16
|
+
"scope",
|
|
17
|
+
"binding"
|
|
18
|
+
],
|
|
19
|
+
"properties": {
|
|
20
|
+
"version": {
|
|
21
|
+
"const": 1
|
|
22
|
+
},
|
|
23
|
+
"id": {
|
|
24
|
+
"type": "string",
|
|
25
|
+
"pattern": "^[a-f0-9]{8}-[a-f0-9]{4}-[1-8][a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$"
|
|
26
|
+
},
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "object",
|
|
29
|
+
"additionalProperties": false,
|
|
30
|
+
"required": [
|
|
31
|
+
"id",
|
|
32
|
+
"name"
|
|
33
|
+
],
|
|
34
|
+
"properties": {
|
|
35
|
+
"id": {
|
|
36
|
+
"type": "integer",
|
|
37
|
+
"minimum": 1,
|
|
38
|
+
"maximum": 9007199254740991
|
|
39
|
+
},
|
|
40
|
+
"name": {
|
|
41
|
+
"type": "string",
|
|
42
|
+
"pattern": "^[a-z0-9_.-]{1,100}/[a-z0-9_.-]{1,100}$"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"issue": {
|
|
47
|
+
"type": "object",
|
|
48
|
+
"additionalProperties": false,
|
|
49
|
+
"required": [
|
|
50
|
+
"id",
|
|
51
|
+
"number"
|
|
52
|
+
],
|
|
53
|
+
"properties": {
|
|
54
|
+
"id": {
|
|
55
|
+
"type": "integer",
|
|
56
|
+
"minimum": 1,
|
|
57
|
+
"maximum": 9007199254740991
|
|
58
|
+
},
|
|
59
|
+
"number": {
|
|
60
|
+
"type": "integer",
|
|
61
|
+
"minimum": 1,
|
|
62
|
+
"maximum": 9007199254740991
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
"actorId": {
|
|
67
|
+
"type": "integer",
|
|
68
|
+
"minimum": 1,
|
|
69
|
+
"maximum": 9007199254740991
|
|
70
|
+
},
|
|
71
|
+
"action": {
|
|
72
|
+
"const": "refine"
|
|
73
|
+
},
|
|
74
|
+
"scope": {
|
|
75
|
+
"const": "stage-only"
|
|
76
|
+
},
|
|
77
|
+
"binding": {
|
|
78
|
+
"type": "object",
|
|
79
|
+
"additionalProperties": false,
|
|
80
|
+
"required": [
|
|
81
|
+
"sourceRevision",
|
|
82
|
+
"defaultBranch",
|
|
83
|
+
"inputDigest",
|
|
84
|
+
"policyDigest",
|
|
85
|
+
"capabilityDigest"
|
|
86
|
+
],
|
|
87
|
+
"properties": {
|
|
88
|
+
"sourceRevision": {
|
|
89
|
+
"type": "string",
|
|
90
|
+
"pattern": "^[a-f0-9]{40}$"
|
|
91
|
+
},
|
|
92
|
+
"defaultBranch": {
|
|
93
|
+
"type": "string",
|
|
94
|
+
"minLength": 1,
|
|
95
|
+
"maxLength": 256,
|
|
96
|
+
"pattern": "^[^\\u0000-\\u001f\\u007f]+$"
|
|
97
|
+
},
|
|
98
|
+
"inputDigest": {
|
|
99
|
+
"$ref": "#/$defs/hash"
|
|
100
|
+
},
|
|
101
|
+
"policyDigest": {
|
|
102
|
+
"$ref": "#/$defs/hash"
|
|
103
|
+
},
|
|
104
|
+
"capabilityDigest": {
|
|
105
|
+
"$ref": "#/$defs/hash"
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"type": "object",
|
|
113
|
+
"additionalProperties": false,
|
|
114
|
+
"required": [
|
|
115
|
+
"version",
|
|
116
|
+
"id",
|
|
117
|
+
"repository",
|
|
118
|
+
"issue",
|
|
119
|
+
"actorId",
|
|
120
|
+
"action",
|
|
121
|
+
"scope",
|
|
122
|
+
"binding"
|
|
123
|
+
],
|
|
124
|
+
"properties": {
|
|
125
|
+
"version": {
|
|
126
|
+
"const": 1
|
|
127
|
+
},
|
|
128
|
+
"id": {
|
|
129
|
+
"type": "string",
|
|
130
|
+
"pattern": "^[a-f0-9]{8}-[a-f0-9]{4}-[1-8][a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$"
|
|
131
|
+
},
|
|
132
|
+
"repository": {
|
|
133
|
+
"type": "object",
|
|
134
|
+
"additionalProperties": false,
|
|
135
|
+
"required": [
|
|
136
|
+
"id",
|
|
137
|
+
"name"
|
|
138
|
+
],
|
|
139
|
+
"properties": {
|
|
140
|
+
"id": {
|
|
141
|
+
"type": "integer",
|
|
142
|
+
"minimum": 1,
|
|
143
|
+
"maximum": 9007199254740991
|
|
144
|
+
},
|
|
145
|
+
"name": {
|
|
146
|
+
"type": "string",
|
|
147
|
+
"pattern": "^[a-z0-9_.-]{1,100}/[a-z0-9_.-]{1,100}$"
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
"issue": {
|
|
152
|
+
"type": "object",
|
|
153
|
+
"additionalProperties": false,
|
|
154
|
+
"required": [
|
|
155
|
+
"id",
|
|
156
|
+
"number"
|
|
157
|
+
],
|
|
158
|
+
"properties": {
|
|
159
|
+
"id": {
|
|
160
|
+
"type": "integer",
|
|
161
|
+
"minimum": 1,
|
|
162
|
+
"maximum": 9007199254740991
|
|
163
|
+
},
|
|
164
|
+
"number": {
|
|
165
|
+
"type": "integer",
|
|
166
|
+
"minimum": 1,
|
|
167
|
+
"maximum": 9007199254740991
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
"actorId": {
|
|
172
|
+
"type": "integer",
|
|
173
|
+
"minimum": 1,
|
|
174
|
+
"maximum": 9007199254740991
|
|
175
|
+
},
|
|
176
|
+
"action": {
|
|
177
|
+
"const": "propose"
|
|
178
|
+
},
|
|
179
|
+
"scope": {
|
|
180
|
+
"const": "stage-only"
|
|
181
|
+
},
|
|
182
|
+
"binding": {
|
|
183
|
+
"type": "object",
|
|
184
|
+
"additionalProperties": false,
|
|
185
|
+
"required": [
|
|
186
|
+
"sourceRevision",
|
|
187
|
+
"defaultBranch",
|
|
188
|
+
"inputDigest",
|
|
189
|
+
"policyDigest",
|
|
190
|
+
"capabilityDigest"
|
|
191
|
+
],
|
|
192
|
+
"properties": {
|
|
193
|
+
"sourceRevision": {
|
|
194
|
+
"type": "string",
|
|
195
|
+
"pattern": "^[a-f0-9]{40}$"
|
|
196
|
+
},
|
|
197
|
+
"defaultBranch": {
|
|
198
|
+
"type": "string",
|
|
199
|
+
"minLength": 1,
|
|
200
|
+
"maxLength": 256,
|
|
201
|
+
"pattern": "^[^\\u0000-\\u001f\\u007f]+$"
|
|
202
|
+
},
|
|
203
|
+
"inputDigest": {
|
|
204
|
+
"$ref": "#/$defs/hash"
|
|
205
|
+
},
|
|
206
|
+
"policyDigest": {
|
|
207
|
+
"$ref": "#/$defs/hash"
|
|
208
|
+
},
|
|
209
|
+
"capabilityDigest": {
|
|
210
|
+
"$ref": "#/$defs/hash"
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
"type": "object",
|
|
218
|
+
"additionalProperties": false,
|
|
219
|
+
"required": [
|
|
220
|
+
"version",
|
|
221
|
+
"id",
|
|
222
|
+
"repository",
|
|
223
|
+
"issue",
|
|
224
|
+
"actorId",
|
|
225
|
+
"action",
|
|
226
|
+
"scope",
|
|
227
|
+
"body"
|
|
228
|
+
],
|
|
229
|
+
"properties": {
|
|
230
|
+
"version": {
|
|
231
|
+
"const": 1
|
|
232
|
+
},
|
|
233
|
+
"id": {
|
|
234
|
+
"type": "string",
|
|
235
|
+
"pattern": "^[a-f0-9]{8}-[a-f0-9]{4}-[1-8][a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$"
|
|
236
|
+
},
|
|
237
|
+
"repository": {
|
|
238
|
+
"type": "object",
|
|
239
|
+
"additionalProperties": false,
|
|
240
|
+
"required": [
|
|
241
|
+
"id",
|
|
242
|
+
"name"
|
|
243
|
+
],
|
|
244
|
+
"properties": {
|
|
245
|
+
"id": {
|
|
246
|
+
"type": "integer",
|
|
247
|
+
"minimum": 1,
|
|
248
|
+
"maximum": 9007199254740991
|
|
249
|
+
},
|
|
250
|
+
"name": {
|
|
251
|
+
"type": "string",
|
|
252
|
+
"pattern": "^[a-z0-9_.-]{1,100}/[a-z0-9_.-]{1,100}$"
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
},
|
|
256
|
+
"issue": {
|
|
257
|
+
"type": "object",
|
|
258
|
+
"additionalProperties": false,
|
|
259
|
+
"required": [
|
|
260
|
+
"id",
|
|
261
|
+
"number"
|
|
262
|
+
],
|
|
263
|
+
"properties": {
|
|
264
|
+
"id": {
|
|
265
|
+
"type": "integer",
|
|
266
|
+
"minimum": 1,
|
|
267
|
+
"maximum": 9007199254740991
|
|
268
|
+
},
|
|
269
|
+
"number": {
|
|
270
|
+
"type": "integer",
|
|
271
|
+
"minimum": 1,
|
|
272
|
+
"maximum": 9007199254740991
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
},
|
|
276
|
+
"actorId": {
|
|
277
|
+
"type": "integer",
|
|
278
|
+
"minimum": 1,
|
|
279
|
+
"maximum": 9007199254740991
|
|
280
|
+
},
|
|
281
|
+
"action": {
|
|
282
|
+
"const": "comment"
|
|
283
|
+
},
|
|
284
|
+
"scope": {
|
|
285
|
+
"const": "comment-only"
|
|
286
|
+
},
|
|
287
|
+
"body": {
|
|
288
|
+
"type": "string",
|
|
289
|
+
"minLength": 1,
|
|
290
|
+
"maxLength": 49152,
|
|
291
|
+
"description": "Runtime validation additionally enforces Unicode validity, nonblank text, LF normalization and the complete formatted comment limit of 48 KiB UTF-8."
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
"type": "object",
|
|
297
|
+
"additionalProperties": false,
|
|
298
|
+
"required": [
|
|
299
|
+
"version",
|
|
300
|
+
"id",
|
|
301
|
+
"repository",
|
|
302
|
+
"issue",
|
|
303
|
+
"actorId",
|
|
304
|
+
"action",
|
|
305
|
+
"scope",
|
|
306
|
+
"body",
|
|
307
|
+
"question"
|
|
308
|
+
],
|
|
309
|
+
"properties": {
|
|
310
|
+
"version": {
|
|
311
|
+
"const": 1
|
|
312
|
+
},
|
|
313
|
+
"id": {
|
|
314
|
+
"type": "string",
|
|
315
|
+
"pattern": "^[a-f0-9]{8}-[a-f0-9]{4}-[1-8][a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$"
|
|
316
|
+
},
|
|
317
|
+
"repository": {
|
|
318
|
+
"type": "object",
|
|
319
|
+
"additionalProperties": false,
|
|
320
|
+
"required": [
|
|
321
|
+
"id",
|
|
322
|
+
"name"
|
|
323
|
+
],
|
|
324
|
+
"properties": {
|
|
325
|
+
"id": {
|
|
326
|
+
"type": "integer",
|
|
327
|
+
"minimum": 1,
|
|
328
|
+
"maximum": 9007199254740991
|
|
329
|
+
},
|
|
330
|
+
"name": {
|
|
331
|
+
"type": "string",
|
|
332
|
+
"pattern": "^[a-z0-9_.-]{1,100}/[a-z0-9_.-]{1,100}$"
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
},
|
|
336
|
+
"issue": {
|
|
337
|
+
"type": "object",
|
|
338
|
+
"additionalProperties": false,
|
|
339
|
+
"required": [
|
|
340
|
+
"id",
|
|
341
|
+
"number"
|
|
342
|
+
],
|
|
343
|
+
"properties": {
|
|
344
|
+
"id": {
|
|
345
|
+
"type": "integer",
|
|
346
|
+
"minimum": 1,
|
|
347
|
+
"maximum": 9007199254740991
|
|
348
|
+
},
|
|
349
|
+
"number": {
|
|
350
|
+
"type": "integer",
|
|
351
|
+
"minimum": 1,
|
|
352
|
+
"maximum": 9007199254740991
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
},
|
|
356
|
+
"actorId": {
|
|
357
|
+
"type": "integer",
|
|
358
|
+
"minimum": 1,
|
|
359
|
+
"maximum": 9007199254740991
|
|
360
|
+
},
|
|
361
|
+
"action": {
|
|
362
|
+
"const": "continue"
|
|
363
|
+
},
|
|
364
|
+
"scope": {
|
|
365
|
+
"const": "original-grant"
|
|
366
|
+
},
|
|
367
|
+
"body": {
|
|
368
|
+
"type": "string",
|
|
369
|
+
"minLength": 1,
|
|
370
|
+
"maxLength": 49152,
|
|
371
|
+
"description": "Runtime validation additionally enforces Unicode validity, nonblank text, LF normalization and the complete formatted comment limit of 48 KiB UTF-8."
|
|
372
|
+
},
|
|
373
|
+
"question": {
|
|
374
|
+
"type": "object",
|
|
375
|
+
"additionalProperties": false,
|
|
376
|
+
"required": [
|
|
377
|
+
"commentId",
|
|
378
|
+
"requestId",
|
|
379
|
+
"questionDigest",
|
|
380
|
+
"grantDigest"
|
|
381
|
+
],
|
|
382
|
+
"properties": {
|
|
383
|
+
"commentId": {
|
|
384
|
+
"type": "integer",
|
|
385
|
+
"minimum": 1,
|
|
386
|
+
"maximum": 9007199254740991
|
|
387
|
+
},
|
|
388
|
+
"requestId": {
|
|
389
|
+
"$ref": "#/$defs/hash"
|
|
390
|
+
},
|
|
391
|
+
"questionDigest": {
|
|
392
|
+
"$ref": "#/$defs/hash"
|
|
393
|
+
},
|
|
394
|
+
"grantDigest": {
|
|
395
|
+
"$ref": "#/$defs/hash"
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
],
|
|
402
|
+
"$defs": {
|
|
403
|
+
"hash": {
|
|
404
|
+
"type": "string",
|
|
405
|
+
"pattern": "^[a-f0-9]{64}$"
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { productModelDirectoryFromConfig } from './product-change.mjs';
|
|
2
|
+
import { readActionsJson } from './actions-artifact.mjs';
|
|
2
3
|
import { digest } from './digests.mjs';
|
|
3
4
|
import { inspectCompletion, assertChecks, postMergeRuns } from './completion-state.mjs';
|
|
4
5
|
import { deliveryAfterChecks } from './delivery-events.mjs';
|
|
@@ -19,6 +20,22 @@ async function rejectedJobs(api, { dispatch, run }) {
|
|
|
19
20
|
return jobs;
|
|
20
21
|
}
|
|
21
22
|
|
|
23
|
+
// Completion is a wake-up only: admission still rechecks the original grant and current authority.
|
|
24
|
+
export async function admissionCompletion(api, repository, owner, event, readArtifact = readActionsJson) {
|
|
25
|
+
const signal = event.workflow_run;
|
|
26
|
+
if (event.action !== 'completed' || signal?.repository?.full_name !== repository || !Number.isSafeInteger(signal.id) || signal.id < 1 || signal.run_attempt !== 1 || signal.status !== 'completed' || signal.conclusion !== 'failure') return null;
|
|
27
|
+
const run = await api(`actions/runs/${signal.id}/attempts/${signal.run_attempt}`);
|
|
28
|
+
if (run?.repository?.full_name !== repository || run.path !== stagePath('review') || run.event !== 'workflow_dispatch' || run.head_sha !== signal.head_sha || run.run_attempt !== signal.run_attempt || run.status !== 'completed' || run.conclusion !== 'failure') return null;
|
|
29
|
+
const match = /^review #([1-9][0-9]*) · request ([1-9][0-9]*)$/.exec(run.display_title ?? '');
|
|
30
|
+
if (!match) return null;
|
|
31
|
+
let rejection;
|
|
32
|
+
try { await loadDispatch(api, repository, owner, Number(match[1]), Number(match[2]), run, readArtifact); }
|
|
33
|
+
catch (error) { rejection = error.rejection; }
|
|
34
|
+
const request = rejection?.dispatch.request;
|
|
35
|
+
if (!request || request.recovery || request.stage !== 'review' || request.worker || request.handoff || request.completionRecovery || !isBotContinuation(request.event, rejection.parent.event, rejection.parent.actor?.login, rejection.parent.triggering_actor?.login) || !await rejectedJobs(api, rejection)) return null;
|
|
36
|
+
return { issue: Number(match[1]), runId: String(run.id), attempt: run.run_attempt, revision: run.head_sha, commentId: Number(match[2]) };
|
|
37
|
+
}
|
|
38
|
+
|
|
22
39
|
// A changed ref never admits work; only a terminal native job inventory can establish skipped effects.
|
|
23
40
|
export async function observeAdmissionRejection(api, repository, owner, rejection, issue, comments) {
|
|
24
41
|
const { dispatch, parent, run } = rejection, request = dispatch.request;
|
|
@@ -65,7 +82,7 @@ export async function reconcileAdmissionRejection(api, repository, observation)
|
|
|
65
82
|
|
|
66
83
|
export function admissionRetryRequest(observation, parent) {
|
|
67
84
|
const { request } = observation.dispatch;
|
|
68
|
-
const recovery = { kind: 'before-admission', rootId: observation.rootId, previousComment: observation.dispatch.commentId, attempt: 1 };
|
|
85
|
+
const recovery = { kind: 'before-admission', rootId: observation.rootId, previousComment: observation.dispatch.commentId, attempt: 1, ...(observation.wake ? { wake: observation.wake } : {}) };
|
|
69
86
|
const next = { ...request, id: digest(`${request.repository}:${recovery.rootId}:retry:1`), sourceRevision: observation.revision, workflowRevision: observation.revision, routerRunId: String(parent.id), routerAttempt: parent.run_attempt, routerRevision: parent.head_sha, routerRef: parent.head_branch, routerEventName: parent.event, recovery };
|
|
70
87
|
next.intent = dispatchIntent(next);
|
|
71
88
|
return next;
|
|
@@ -82,7 +99,12 @@ export async function verifyAdmissionRecovery(api, repository, owner, dispatch,
|
|
|
82
99
|
catch (error) { rejection = error.rejection; }
|
|
83
100
|
if (!rejection || rejection.dispatch.request.recovery || retry.rootId !== rejection.dispatch.request.id || run.path !== stagePath('review')) throw Error('Invalid original admission rejection');
|
|
84
101
|
if (!await rejectedJobs(api, rejection)) throw Error('Original admission rejection effects are unconfirmed');
|
|
85
|
-
|
|
102
|
+
let wake;
|
|
103
|
+
if (parent.event === 'workflow_run') {
|
|
104
|
+
wake = { issue: request.issue, runId: String(run.id), attempt: run.run_attempt, revision: run.head_sha, commentId: Number(comment.id) };
|
|
105
|
+
if (![owner, 'github-actions[bot]'].includes(parent.actor?.login) || parent.triggering_actor?.login !== parent.actor?.login || !same(retry.wake, wake)) throw Error('Invalid admission completion wake');
|
|
106
|
+
} else if (retry.wake !== undefined) throw Error('Unexpected admission completion wake');
|
|
107
|
+
const expected = admissionRetryRequest({ dispatch: rejection.dispatch, rootId: retry.rootId, revision: request.sourceRevision, wake }, parent);
|
|
86
108
|
if (!same(request, expected)) throw Error('Before-admission recovery authorization changed');
|
|
87
109
|
if (!revalidate) return;
|
|
88
110
|
const issue = await api(`issues/${request.issue}`);
|
|
@@ -90,5 +112,6 @@ export async function verifyAdmissionRecovery(api, repository, owner, dispatch,
|
|
|
90
112
|
// The current retry is allowed; any other newer dispatch supersedes the original request.
|
|
91
113
|
const originalComments = comments.filter(item => item.id !== dispatch.commentId);
|
|
92
114
|
const observation = await observeAdmissionRejection(api, repository, owner, rejection, issue, originalComments);
|
|
115
|
+
observation.wake = wake;
|
|
93
116
|
if (observation.state !== 'retryable' || !same(request, admissionRetryRequest(observation, parent))) throw Error('Before-admission recovery authority changed');
|
|
94
117
|
}
|