CI: a failed change classifier runs the full suite, then fails (PLAT-986) #345

Merged
stephen merged 4 commits from ci-opt/plat-986-scope-fail-closed into main 2026-12-02 22:40:12 +00:00
Owner

PLAT-986 follow-up to #344. Before this PR, a failed change classifier left ci / check red but skipped the Rust steps and both dependent jobs, so the full suite never ran. It now falls back to the full suite and still fails, the same fix gerri asked for on regent#399.

What changes in .forgejo/workflows/ci.yml.

  • Classifier step: Classify the change has continue-on-error: true.
  • Gated steps: each of the 9 runs unless the classifier succeeded and said content (steps.scope.outcome != 'success' || steps.scope.outputs.scope != 'content').
  • Final step: Fail when classification failed turns check red when the classifier failed or gave no valid scope (content or full).
  • Job outputs:
    • scope is full unless the classifier succeeded.
    • classified is ok only for a successful classifier with a valid scope.
  • Dependent jobs: coverage and live-e2e now run when check passed, or when check failed after a failed or empty classification. A check that is red for any other reason still skips them, as before.

Testing.

  • scripts/ci-scope-fj.test.sh checks each condition in the workflow text. Eight deliberate breakages were all caught: dropping the outcome check, dropping continue-on-error, the final step without always(), the final step without the scope check, the job output without its fallback, classified ignoring the scope, the inverted dependent condition, and the dependent condition without !cancelled().
  • I ran the same expressions through forgejo-runner exec (v13.2.1) in a synthetic workflow:
    Classifier Steps check coverage
    fails all run red runs, scope=full
    exits 0, no scope all run red runs, scope=full
    content skipped green skipped
    full all run green runs
    full, a step fails stop there red skipped (as before)

Time to green. No change to any successful path. A content-only PR still runs only the classifier, and a full one runs exactly what it ran before.

Self-review: two rounds. The first found that the dependent jobs still skipped after a classifier failure, and a test run surfaced the empty-scope case; both are fixed here.

PLAT-986 follow-up to #344. Before this PR, a failed change classifier left `ci / check` red but skipped the Rust steps and both dependent jobs, so the full suite never ran. It now falls back to the full suite and still fails, the same fix gerri asked for on regent#399. **What changes in `.forgejo/workflows/ci.yml`.** - **Classifier step:** `Classify the change` has `continue-on-error: true`. - **Gated steps:** each of the 9 runs unless the classifier succeeded and said `content` (`steps.scope.outcome != 'success' || steps.scope.outputs.scope != 'content'`). - **Final step:** `Fail when classification failed` turns `check` red when the classifier failed or gave no valid scope (`content` or `full`). - **Job outputs:** - `scope` is `full` unless the classifier succeeded. - `classified` is `ok` only for a successful classifier with a valid scope. - **Dependent jobs:** `coverage` and `live-e2e` now run when `check` passed, or when `check` failed after a failed or empty classification. A `check` that is red for any other reason still skips them, as before. **Testing.** - `scripts/ci-scope-fj.test.sh` checks each condition in the workflow text. Eight deliberate breakages were all caught: dropping the outcome check, dropping `continue-on-error`, the final step without `always()`, the final step without the scope check, the job output without its fallback, `classified` ignoring the scope, the inverted dependent condition, and the dependent condition without `!cancelled()`. - I ran the same expressions through `forgejo-runner exec` (v13.2.1) in a synthetic workflow: | Classifier | Steps | `check` | coverage | | --- | --- | --- | --- | | fails | all run | red | runs, scope=full | | exits 0, no scope | all run | red | runs, scope=full | | content | skipped | green | skipped | | full | all run | green | runs | | full, a step fails | stop there | red | skipped (as before) | **Time to green.** No change to any successful path. A content-only PR still runs only the classifier, and a full one runs exactly what it ran before. Self-review: two rounds. The first found that the dependent jobs still skipped after a classifier failure, and a test run surfaced the empty-scope case; both are fixed here.
CI: a failed change classifier runs every check step, then fails the job (PLAT-986)
Some checks failed
ci / check (pull_request) Failing after 31m15s
ci / coverage (pull_request) Successful in 6m48s
ci / live-e2e (pull_request) Successful in 3m54s
3c6c55f332
The classifier step continues on error; each gated step runs unless the
classifier succeeded and said content; a final step fails the job when the
classification failed or gave no valid scope. The repo self-test checks
these conditions. Same fix as regent#399.

The check job's scope output is 'full' unless the classifier succeeded.
gerri requested changes 2026-12-02 16:26:32 +00:00
Dismissed
gerri left a comment

Automated Codex review (read-only) of head 3c6c55f332.

  • Medium .forgejo/workflows/ci.yml:126 (also line 186): The invariant is that dependent jobs run after a failed check only when classification itself failed or returned an invalid scope. If checkout or the preceding classifier tests fail, the classifier is skipped, leaving classified as failed. Both coverage and live-e2e then run despite an unrelated check failure. For example, a regression caught by ci-scope-fj.test.sh starts both dependent jobs, consuming runner capacity and invoking the live API when the PR says they would remain skipped. This is introduced by the new fallback condition. Export a distinct state for a classifier that actually ran and failed or returned an invalid scope, and require that state when allowing dependent jobs after a failed check. Cover the skipped-classifier path for both jobs.

BLOCKING: 1

Reviewed head 3c6c55f332 at 2026-12-02T16:26:31Z by codex exec (read-only sandbox).

Automated Codex review (read-only) of head 3c6c55f33240540648ab3d93a6794dbc75be3068. - **Medium** `.forgejo/workflows/ci.yml:126` (also line 186): The invariant is that dependent jobs run after a failed `check` only when classification itself failed or returned an invalid scope. If checkout or the preceding classifier tests fail, the classifier is skipped, leaving `classified` as `failed`. Both coverage and live-e2e then run despite an unrelated `check` failure. For example, a regression caught by `ci-scope-fj.test.sh` starts both dependent jobs, consuming runner capacity and invoking the live API when the PR says they would remain skipped. This is introduced by the new fallback condition. Export a distinct state for a classifier that actually ran and failed or returned an invalid scope, and require that state when allowing dependent jobs after a failed `check`. Cover the skipped-classifier path for both jobs. BLOCKING: 1 --- Reviewed head 3c6c55f33240540648ab3d93a6794dbc75be3068 at 2026-12-02T16:26:31Z by codex exec (read-only sandbox).
Merge remote-tracking branch 'origin/main' into ci-opt/plat-986-scope-fail-closed
All checks were successful
ci / check (pull_request) Successful in 23m16s
ci / live-e2e (pull_request) Successful in 7m9s
ci / coverage (pull_request) Successful in 8m6s
2561e748ff
gerri requested changes 2026-12-02 18:56:09 +00:00
Dismissed
gerri left a comment

Automated Codex review (read-only) of head 2561e748ff.

  • Medium .forgejo/workflows/ci.yml:126 and .forgejo/workflows/ci.yml:186: The invariant is that dependent jobs run after a failed check only when classification failed. If checkout or the classifier test step fails before the classifier runs, classified and scope do not indicate a successful classification. Both dependent conditions therefore pass, starting coverage and live E2E despite an unrelated check failure. A transient checkout or network failure can trigger two expensive jobs and live API calls that previously would have been skipped. This belongs in the PR because both dependent conditions changed and the body explicitly promises the old behavior for other failures. Export a distinct state that proves the classifier ran and failed, and require that state in both conditions. Add a workflow-level test for a failure before classification.

BLOCKING: 1

Reviewed head 2561e748ff at 2026-12-02T18:56:08Z by codex exec (read-only sandbox).

Automated Codex review (read-only) of head 2561e748ff3621020c8a75295dc81576fc502c1d. - **Medium** `.forgejo/workflows/ci.yml:126` and `.forgejo/workflows/ci.yml:186`: The invariant is that dependent jobs run after a failed `check` only when classification failed. If checkout or the classifier test step fails before the classifier runs, `classified` and `scope` do not indicate a successful classification. Both dependent conditions therefore pass, starting coverage and live E2E despite an unrelated `check` failure. A transient checkout or network failure can trigger two expensive jobs and live API calls that previously would have been skipped. This belongs in the PR because both dependent conditions changed and the body explicitly promises the old behavior for other failures. Export a distinct state that proves the classifier ran and failed, and require that state in both conditions. Add a workflow-level test for a failure before classification. BLOCKING: 1 --- Reviewed head 2561e748ff3621020c8a75295dc81576fc502c1d at 2026-12-02T18:56:08Z by codex exec (read-only sandbox).
CI: coverage and live-e2e follow check only past a real classifier failure (PLAT-986)
Some checks failed
ci / check (pull_request) Has been cancelled
ci / coverage (pull_request) Has been cancelled
ci / live-e2e (pull_request) Has been cancelled
154220e113
classified is now ok, failed (the classifier ran and failed or gave no valid
scope) or not-run (check failed before it). coverage and live-e2e run after
a failed check only when it is failed, so a checkout or self-test failure
skips them as before. The final step fires only when the classifier ran.
Author
Owner

gerri's Medium at 2561e748 is fixed in 154220e, in one push.

The problem. A failure before the classifier (checkout, or the classifier self-test) left classified not ok, so coverage and live-e2e started after an unrelated check failure.

The fix.

  • Three states: classified is now ok (a valid scope), failed (the classifier ran and failed, or gave no valid scope) or not-run (check failed before it).
  • Dependent jobs: coverage and live-e2e follow a failed check only when classified is failed.
  • Final step: it fires only when the classifier ran, so a failure before it is not reported as a classifier failure.
  • Self-test: the previous assertions encoded != 'ok', and they now assert the new conditions and the final step's exit 1. Seven mutations were checked; all were caught.

Runner check. I ran these exact expressions through forgejo-runner exec v13.2.1 on a synthetic workflow (the repo's CI can't run a runner inside a job):

Case check coverage
classifier writes content, then fails red, all steps ran runs, scope=full, classified=failed
classifier exits 0 with no scope red, all steps ran runs, scope=full, classified=failed
content green, steps skipped skipped
full green runs, classified=ok
full, a step fails red skipped (as before)
failure before the classifier red, final step quiet skipped (as before)
gerri's Medium at 2561e748 is fixed in 154220e, in one push. **The problem.** A failure before the classifier (checkout, or the classifier self-test) left `classified` not `ok`, so coverage and live-e2e started after an unrelated `check` failure. **The fix.** - **Three states:** `classified` is now `ok` (a valid scope), `failed` (the classifier ran and failed, or gave no valid scope) or `not-run` (`check` failed before it). - **Dependent jobs:** coverage and live-e2e follow a failed `check` only when `classified` is `failed`. - **Final step:** it fires only when the classifier ran, so a failure before it is not reported as a classifier failure. - **Self-test:** the previous assertions encoded `!= 'ok'`, and they now assert the new conditions and the final step's `exit 1`. Seven mutations were checked; all were caught. **Runner check.** I ran these exact expressions through `forgejo-runner exec` v13.2.1 on a synthetic workflow (the repo's CI can't run a runner inside a job): | Case | `check` | coverage | | --- | --- | --- | | classifier writes `content`, then fails | red, all steps ran | runs, scope=full, classified=failed | | classifier exits 0 with no scope | red, all steps ran | runs, scope=full, classified=failed | | content | green, steps skipped | skipped | | full | green | runs, classified=ok | | full, a step fails | red | skipped (as before) | | failure before the classifier | red, final step quiet | skipped (as before) |
gerri requested changes 2026-12-02 20:11:19 +00:00
Dismissed
gerri left a comment

Automated Codex review (read-only) of head 154220e113.

  • Medium .forgejo/workflows/ci.yml:48: Invariant: a broken classifier must not prevent the full suite from running. The classifier tests run before the classifier and retain normal failure behavior. For example, a syntax error in scripts/ci-scope.sh makes those tests fail, so the classifier never runs, the Rust steps are skipped, and classified becomes not-run. Both coverage and live-e2e then skip. This is a plausible classifier regression on the supported PR workflow and leaves the failure mode this PR intends to fix. Make classifier-test failures trigger the full-suite fallback too, while keeping check red, and test that path through both dependent jobs.

BLOCKING: 1

Reviewed head 154220e113 at 2026-12-02T20:11:18Z by codex exec (read-only sandbox).

Automated Codex review (read-only) of head 154220e11351b175ed5dfc59a233a999ecc6d97f. - **Medium** [.forgejo/workflows/ci.yml:48](/home/dev/work/reviews/rasterstate-fj-345/.forgejo/workflows/ci.yml:48): **Invariant:** a broken classifier must not prevent the full suite from running. The classifier tests run before the classifier and retain normal failure behavior. For example, a syntax error in `scripts/ci-scope.sh` makes those tests fail, so the classifier never runs, the Rust steps are skipped, and `classified` becomes `not-run`. Both coverage and live-e2e then skip. This is a plausible classifier regression on the supported PR workflow and leaves the failure mode this PR intends to fix. Make classifier-test failures trigger the full-suite fallback too, while keeping `check` red, and test that path through both dependent jobs. BLOCKING: 1 --- Reviewed head 154220e11351b175ed5dfc59a233a999ecc6d97f at 2026-12-02T20:11:18Z by codex exec (read-only sandbox).
CI: classifier self-tests run inside the classifier step (PLAT-986)
All checks were successful
ci / check (pull_request) Successful in 36m42s
ci / coverage (pull_request) Successful in 6m39s
ci / live-e2e (pull_request) Successful in 6m15s
8a01ed0f41
A failing self-test or content-unread guard now falls back like a failed
classification: every step, coverage and live-e2e run and check fails.
The self-tests run without the step's CI_* variables, as before.
Author
Owner

gerri's Medium at 154220e is fixed in 8a01ed0, in one push.

The problem. The classifier self-tests and the content-unread guard ran in their own step before the classifier. A broken classifier failed them, so the classifier never ran and the suite skipped.

The fix.

  • One step: the self-tests and the guard now run inside the continue-on-error classifier step. Any failure there falls back like a failed classification: every Rust step, coverage and live-e2e run, and check fails.
  • Subshell: they run with CI_EVENT, CI_BASE_SHA, CI_HEAD_SHA and GITHUB_OUTPUT unset.
    • Self-review caught that without this, they append about 1,800 scope= lines to the step's output file. A classifier that exited 0 without writing would then have taken a stale value.
    • I checked locally: the output file now stays empty.
  • Self-test: it now asserts that all four scripts run in that step, that the self-tests run only there, and that the subshell unsets those variables. All mutations were caught.

Runner check (forgejo-runner exec, a synthetic workflow with the same expressions), new case: a self-test fails before any output is written. check goes red, every step runs, and coverage runs with scope=full and classified=failed. The earlier six cases are unchanged.

gerri's Medium at 154220e is fixed in 8a01ed0, in one push. **The problem.** The classifier self-tests and the content-unread guard ran in their own step before the classifier. A broken classifier failed them, so the classifier never ran and the suite skipped. **The fix.** - **One step:** the self-tests and the guard now run inside the `continue-on-error` classifier step. Any failure there falls back like a failed classification: every Rust step, coverage and live-e2e run, and `check` fails. - **Subshell:** they run with `CI_EVENT`, `CI_BASE_SHA`, `CI_HEAD_SHA` and `GITHUB_OUTPUT` unset. - Self-review caught that without this, they append about 1,800 `scope=` lines to the step's output file. A classifier that exited 0 without writing would then have taken a stale value. - I checked locally: the output file now stays empty. - **Self-test:** it now asserts that all four scripts run in that step, that the self-tests run only there, and that the subshell unsets those variables. All mutations were caught. **Runner check** (`forgejo-runner exec`, a synthetic workflow with the same expressions), new case: a self-test fails before any output is written. `check` goes red, every step runs, and coverage runs with scope=full and classified=failed. The earlier six cases are unchanged.
gerri approved these changes 2026-12-02 21:00:15 +00:00
gerri left a comment

Automated Codex review (read-only) of head 8a01ed0f41.

  • Low (edge case) .forgejo/workflows/ci.yml:131: The invariant is that dependent jobs skip when check fails for a reason other than classification. If classification fails and a later Rust step also fails, classified remains failed, so both coverage and live-e2e run despite the second failure. This is a simultaneous-failure case, but it contradicts the stated behavior. Export whether a non-classifier step failed and include that in both dependent-job conditions.

BLOCKING: 0

Reviewed head 8a01ed0f41 at 2026-12-02T21:00:14Z by codex exec (read-only sandbox).

Automated Codex review (read-only) of head 8a01ed0f414abaf03925eb1b4300c5074d1e9b63. - **Low** (edge case) [.forgejo/workflows/ci.yml:131](/home/dev/work/reviews/rasterstate-fj-345/.forgejo/workflows/ci.yml:131): The invariant is that dependent jobs skip when `check` fails for a reason other than classification. If classification fails and a later Rust step also fails, `classified` remains `failed`, so both coverage and live-e2e run despite the second failure. This is a simultaneous-failure case, but it contradicts the stated behavior. Export whether a non-classifier step failed and include that in both dependent-job conditions. BLOCKING: 0 --- Reviewed head 8a01ed0f414abaf03925eb1b4300c5074d1e9b63 at 2026-12-02T21:00:14Z by codex exec (read-only sandbox).
Sign in to join this conversation.
No description provided.