Repository navigation
fix(arm): a non-green head is reported, never completed as a failed check run - #314
Conversation
…heck run `validate / arm` could deadlock a pull request permanently (#313). Measured on opencharly/gst-wayland-display#12, head 7071384: the ruleset's three required checks all SUCCESS, the verdict a PASS, and the only red run on the head `validate / arm` itself. GitHub computes `mergeable_state` over EVERY check run on the head, so one COMPLETED FAILURE of that NON-required check run leaves the PR `unstable`; `enablePullRequestAutoMerge` is refused while unstable, and the job that must clear it has to complete in order to fail. The gate poisoned the condition it waits on — the POISON class scripts/check-stalled-automerge.sh shape 3 already documents for the REQUIRED context, one level down. The contract that closes it, in three parts: * `Head check-runs` carries `continue-on-error: true`, so its non-green classes (1 NOT-PASSED, 2 IN-FLIGHT, 3 UNREAD, 4 EMPTY) no longer complete as a FAILED check run. The exit codes and the annotations are UNCHANGED, so the class table and the remedies the job prints stay exactly as they were; the step also writes `green=true|false` and `class=<n>` to `$GITHUB_OUTPUT`. * `Enable auto-merge` is gated on `green == 'true'` (continue-on-error alone would let a class 1-4 head reach the mutation) and carries `continue-on-error: true` too. * A new `Report an unarmed head` step runs when either did not succeed and updates ONE marker comment with the class and its remedy — a check run that is green by design can no longer be the alarm, so the comment is, and marker-keying means a retried job does not spam the PR. `scripts/head-settle_test.sh` keeps its per-class assertions (the exits did not move), gains a `GITHUB_OUTPUT` in its harness plus an `expect_class` assertion per class, and gains section (I), which asserts all three parts of the new contract. The harness update is itself the RCA of a failure this change caused: without a `GITHUB_OUTPUT` the step's own output writes were a redirect error, and case (A) failed on the first run. *Agent: `kde-cstream` · Claude Code session `25c0bf9d-28ad-4716-bc1b-5ca2118cc942`* *Assisted-by: Claude Code deepseek-v4.1-flash (fully tested and validated)*
|
T4 maintainer-account sign-off — head This change is the gate itself ( What is signed: the gate stops being able to veto a verdict it already gave. Agent: |
Review — PASSHead SHA: Security screen: PASS — self-modifying gate change (T4) carries a valid maintainer-account sign-off from @aitrawog (in the configured set), naming this head, posted at operator direction; authorship is irrelevant under the account-gated model. The required Checklist: All applicable rules PASS or NA.
Verdict: PASS ollama-cloud/deepseek-v4.1-flash — action-review. |
* fix(arm): a CLEAN head is a report, not an arming failure #313's follow-up, measured on opencharly/gst-wayland-display#12 after #314 merged. GitHub refuses `enablePullRequestAutoMerge` in TWO states, and only one of them is a fault: * `unstable` — some check on the head did not pass (the poison #314 removed), and * `Pull request is in clean status` — every required check PASSED and the merge is available NOW, so there is nothing for auto-merge to wait for. The second refusal is not a failure, but the step treated every non-`unstable` error as one: the 180 s budget was spent retrying the single state in which arming is unnecessary, and the session was told the gate had failed on a pull request that was simply ready to merge. Measured directly on that PR once its head settled: ``` $ gh api graphql -f query='mutation { enablePullRequestAutoMerge(…) }' {"errors":[{"type":"UNPROCESSABLE","message":"Pull request Pull request is in clean status"}]} ``` The enable step now recognises that message, logs a notice naming the state and the remedy ("a maintainer merges this pull request") and returns — no retry, no thrown error, and therefore no unarmed-head comment either, because nothing is unarmed: the merge button is live. *Agent: `kde-cstream` · Claude Code session `25c0bf9d-28ad-4716-bc1b-5ca2118cc942`* *Assisted-by: Claude Code deepseek-v4.1-flash (fully tested and validated)* * test(arm): prove both arming refusals against the shipped step Review Block 1 on #316 is correct: the new clean-status branch shipped no test that would fail without it, and the body's only "proof" was the hope that the PR's own arm job would take the path. This adds the deterministic coverage. `Enable auto-merge` is shipped JAVASCRIPT (`uses: actions/github-script`), so the shell `run:` extraction does not reach it. `scripts/lib-org.sh` gains `extract_step_script`, the same one-algorithm/different-selector helper the shell steps use, and `scripts/arm-enable_test.sh` runs the EXTRACTED text under node with mocked `github`/`context`/`core`: 1. `Pull request is in clean status` -> the step returns and emits the CLEAN notice (fails without this change); 2. the pre-#316 shape, with EXACTLY that branch removed, THROWS on the same input — the negative control, so the coverage can fire and cannot rot into a tautology; 3. an unrelated refusal ("Resource not accessible by integration") still throws, so the recogniser is narrow rather than a blanket swallow. Registered in `workflow-checks.yml` beside the head-settle test, which it mirrors. *Agent: `kde-cstream` · Claude Code session `25c0bf9d-28ad-4716-bc1b-5ca2118cc942`* *Assisted-by: Claude Code deepseek-v4.1-flash (fully tested and validated)* * test(arm): the happy path is asserted too, and the header says only what runs Review round 2 on #316, three findings, all in the test and the body: * R1/QUAL — the test's header listed "no refusal -> arms and verifies" as assertion 3 while the implementation's third case was the narrow-recogniser case, and the harness could never reach its success path at all (the mutation branch returned before the `armed` branch). The header claimed coverage the code did not have. Fixed by ADDING the assertion rather than by trimming the claim: the harness's mutation now SUCCEEDS for `mode=armed` and the following read reflects the armed state, so case (4) runs the verification line (`Native squash auto-merge verified`) and asserts it was reached. * A1 — the Summary now accounts for every file in the diff (`pr-validator.yml`, the `extract_step_script` helper, the test, and its registration in `workflow-checks.yml`). * A1/A3 — "How tested" pastes `arm-enable_test.sh`'s own output and drops the conditional ("will take the clean-status path if its head is green"), which was never evidence. *Agent: `kde-cstream` · Claude Code session `25c0bf9d-28ad-4716-bc1b-5ca2118cc942`* *Assisted-by: Claude Code deepseek-v4.1-flash (fully tested and validated)*
Summary
validate / armcould deadlock a pull request permanently, and the only visible remedy from inside a session was an empty push — which R3 forbids. Closes #313.Measured on
opencharly/gst-wayland-display#12, head7071384: the ruleset's three required checks (cargo fmt,harness (lint · build · unit),validate / validate) all SUCCESS, the verdict a PASS, and the only red run on the headvalidate / armitself — which then failed withGitHub still reports the pull request as unstable after 180s. A re-run of the failed job reproduced it (3m8s), because by then the first arm failure was itself a failing check run on the head.The mechanism: GitHub computes
mergeable_stateover every check run on the head. One COMPLETED FAILURE of this non-required check run leaves the PRunstable;enablePullRequestAutoMergeis refused while unstable; and the job that must clear it has to complete in order to fail. The gate poisoned the condition it waits on — the POISON classscripts/check-stalled-automerge.shshape 3 already documents for the REQUIRED context, one level down.The fix is three parts, and all three are asserted:
Head check-runscarriescontinue-on-error: true. Its non-green classes (1 NOT-PASSED, 2 IN-FLIGHT, 3 UNREAD, 4 EMPTY) no longer complete as a FAILED check run. The exit codes and the annotations are unchanged, so the class table, the titles and the remedies the step prints stay exactly as they were; the step additionally writesgreen=true|falseandclass=<n>to$GITHUB_OUTPUT.Enable auto-mergeis gated ongreen == 'true'—continue-on-erroralone would let a class 1–4 head reach the mutation — and carriescontinue-on-error: trueitself, so an arming failure (head moved, auth, a persistentunstable) is reported rather than poisoning the head.Report an unarmed headstep runs when either did not succeed and updates ONE marker-keyed comment with the class and its remedy. A check run that is green by design can no longer be the alarm, so the comment is; marker-keying keeps a retried job from spamming the PR.The required
validate / validateverdict check is untouched: a BLOCK still fails it, and it is still the merge gate. What changes is that the arm job — a convenience that arms the merge the verdict already authorised — stops being able to veto it permanently.How tested
The repo's own gate on this tree, every script
workflow-checks.ymlruns, run locally on the committed tree:scripts/head-settle_test.sh— the coverage that extracts the shippedrun:and runs THAT:expect_classis new in the harness: every case now also asserts theclass=<n>the step REPORTS, because the report comment is what replaces the failing check run.Mutation proofs (R7) — each part of the new contract removed from a copy of the tree, the suite run against that copy:
RCA of a failure this change itself produced (R1), already fixed in the tree: the first run of the updated step failed case (A) with
step.sh: line 169: : No such file or directory. Mechanism: the step now writes$GITHUB_OUTPUT, and the harness — like the pre-change step — never exported one; on a runner GitHub always sets it, in the harness nothing did. Missed control: the harness must mirror the runner's environment for every variable the shipped text reads, not only the ones it read yesterday. Fix: the harness exports a per-caseGITHUB_OUTPUT(andexpect_classreads it), which is what makes the class assertions possible at all.Live proof of the deadlock itself is on
opencharly/gst-wayland-display#12(the measurement quoted above). Live proof of the FIX is that PR's arm job after this merges: its head still carries the failedvalidate / armrun from before, so the first attempt there may still be refused — the honest expectation is that a new head (or a re-run creating a fresh job) arms, and that no future head can reach this state.Rulebook compliance
/charly-internals:git-workflow,/charly-internals:repo-setup,/charly-internals:strict-policy,/charly-internals:root-cause-analyzer,/charly-check:check.#313) is root-caused to the mechanism (mergeability counts every run; the non-required job's own failure is the poison); the one failure this change caused is RCA'd above and fixed; the stale claim "Arming errors fail this required check" and the step name "… then fail on any check that did not pass" both became false the moment the step learnedcontinue-on-error, and both are corrected in this same commit (claim-keyed grep:grep -n 'then fail on any check' .github/workflows/pr-validator.yml→ no hit).scripts/lib-org.sh, and the report step is the one place the non-green class is described to a human.mergeable_statepolling reintroduced; the existing boundedunstabletolerance is untouched.feat/arm-does-not-poison-mergeabilityoff freshorigin/main(6c43b85); no force-push, no direct push tomain.workflow-checks.yml, reproduced above on the committed tree; the validator itself runs live on this PR.Change classification
fully tested and validated— the repo's full local gate passed on the committed tree, and every new assertion is mutation-proven.failuretosuccesson a non-green head (which is the fix). Rollback: revert this commit; the gate returns to poisoning its own heads.Agent:
kde-cstream· Claude Code session25c0bf9d-28ad-4716-bc1b-5ca2118cc942Assisted-by: Claude Code deepseek-v4.1-flash (fully tested and validated)