diff --git a/changelog.d/gsta203-pr8-clear-red-run.md b/changelog.d/gsta203-pr8-clear-red-run.md index 87a4d6e1f..bf64949a7 100644 --- a/changelog.d/gsta203-pr8-clear-red-run.md +++ b/changelog.d/gsta203-pr8-clear-red-run.md @@ -1 +1 @@ -- **`gstack-pregate clear --run-url` needs a green run.** On a lane with no run profile, a run of the lane's own workflow that failed, was cancelled or timed out now refuses `PREGATE_RECEIPT_INVALID` (`run_not_success`), and one still queued or running refuses `run_in_progress`. The fix line says to rerun the workflow and clear with the green run. The check reads the run's newest attempt, so a job or attempt link is judged by the whole run. A green run still clears as before. docs/pregate.md now names `windows-smoke.yml/windows-smoke` as the free tier's Windows smoke lane, beside the narrower `free-tests.yml/cso-windows-launcher` and `windows-setup-e2e.yml/windows-setup` lanes. `test/pregate-clear-runs.test.ts` failed before the fix. +- **`gstack-pregate clear --run-url` needs a green run.** On a lane with no run profile, a run of the lane's own workflow that failed, was cancelled or timed out now refuses `PREGATE_RECEIPT_INVALID` (`run_not_success`), and one still queued or running refuses `run_in_progress`. The fix line says to rerun the workflow and clear with the green run. The check reads the run's newest attempt, so a job or attempt link is judged by the whole run, and the lane records the attempt it judged (`…/actions/runs//attempts/`) instead of the link you passed. A green run still clears. docs/pregate.md now names `windows-smoke.yml/windows-smoke` as the free tier's Windows smoke lane, beside the narrower `free-tests.yml/cso-windows-launcher` and `windows-setup-e2e.yml/windows-setup` lanes. `test/pregate-clear-runs.test.ts` failed before the fix. diff --git a/docs/pregate.md b/docs/pregate.md index b0c0aa52a..ac2a713e0 100644 --- a/docs/pregate.md +++ b/docs/pregate.md @@ -765,7 +765,9 @@ refuses with `run_in_progress`, and one that concluded anything but `success` (`failure`, `cancelled`, `timed_out`, …) with `run_not_success`; each fix line says to rerun the workflow and clear with the green run. The check reads the run's newest attempt, so a `/job/` or `/attempts/` link is judged by -the whole run, not that job or attempt. The job, tree and age are not +the whole run, not that job or attempt, and the lane records +`https://github.com//actions/runs//attempts/` for the attempt it +judged rather than the link you passed. The job, tree and age are not checked there; that is what a run profile adds. `test_backend/` lanes and `--bundle-lane` are unchanged. When the base config or the GitHub origin cannot be read, `--run` fails, and so do `--run-url` and `--bundle-lane` unless the base was read and diff --git a/lib/pregate/index.ts b/lib/pregate/index.ts index ac1302184..c91915986 100644 --- a/lib/pregate/index.ts +++ b/lib/pregate/index.ts @@ -221,7 +221,8 @@ export type ClearDecision = { receipt: string; attested: boolean; substitution?: * evidence is readable, a run URL must name a run of this repository whose * workflow file is the lane's own and that completed with success; a run of * another workflow, a red or unfinished run, an unreadable run or a URL that - * is not an Actions run refuses (GSTA-203). + * is not an Actions run refuses (GSTA-203), and a green run is recorded as the + * attempt URL it judged. * * `--run` (and `--run-url` on a lane the base branch profiles) goes to * clearByRuns, which accepts only verified Actions runs; a profiled lane @@ -270,6 +271,7 @@ export function clearDecision(file: PregateFile, lane: string, input: ClearInput const green = `then gstack-pregate clear --remote ${lane} --run-url `; if (run.status !== 'completed') return invalid(`run_in_progress — run ${id} attempt ${run.run_attempt} is ${run.status}`, `wait for run ${id} to finish green (or rerun ${target.workflow} if it fails), ${green}`); if (run.conclusion !== 'success') return invalid(`run_not_success — run ${id} attempt ${run.run_attempt} concluded ${run.conclusion}`, `rerun ${target.workflow} (gh run rerun ${id}, or gh workflow run ${target.workflow} --ref ), ${green}`); + return { receipt: `https://github.com/${repo}/actions/runs/${id}/attempts/${run.run_attempt}`, attested: false }; } const receipt = input.runUrl ?? (input.bundleLane ? `bundle-lane:${input.bundleLane}` : undefined); if (!receipt) return { refused: 'usage', message: `${lane} clears with --run-url or --bundle-lane