Skip to content

Wire the merge-on-approval guard harness into CI #44

Closed

Description

@dustfeather

merge-on-approval.yml's bump-token guard is shell inside a run: block. It is tested by extracting that block verbatim from the YAML and running it against a stubbed gh — 21 cases, of which several are positive controls, plus five mutation checks. That harness currently lives OUTSIDE the repo (it was removed from PR #42 in 06945c0) because a committed suite that no CI step runs reads as coverage without being any.

To wire it, pr-checks.yml needs a step that re-extracts the block and runs the suite. Re-extraction on every run is the point: a stale copy of the shell passing is worse than no test.

This cannot land through a normal PR. pr-checks.yml names itself in its own paths-ignore, so a PR whose changed files are all excluded produces NO run object — no run, no review, no approval, and pr-merge.yml triggers on pull_request_review. Bundling with another path is worse, not a fallback: the run then exists but claude-code-action rejects its OIDC exchange when the PR edits the workflow that triggered the run, swallows the 401 and exits 0, giving a green run that reviewed nothing. It needs its own direct push to main.

Raised in review on PR #42: a test suite wired into nothing is false confidence, and the generated guard.sh snapshot drifts stale silently.

Activity

  1. added
    enhancement
    on Sep 14, 2026
  2. dustfeather commented on Sep 14, 2026

    @dustfeather
    OwnerAuthor

    Scope update from PR #42 round 12/13: d1d81e9 added a second harness alongside the shell suite described above. The stubbed shell suite tests the guard's SHELL and is structurally blind to the jq program embedded in it — that program lives in the argv the stub only pattern-matches, so it is never executed. The new harness extracts the jq program verbatim from the YAML and runs real jq over a fixture (empty message, CRLF subject carrying a token, subject-plus-body, subject-only commit): 5 assertions plus 2 controls, one per failure mode.

    Both suites currently live outside the repo for the same paths-ignore/OIDC reason described above, and this issue now tracks wiring both into pr-checks.yml, not just the shell one. Until this lands, both are run by hand before each push and results quoted in commit messages.

  3. dustfeather commented on Sep 15, 2026

    @dustfeather
    OwnerAuthor

    Verified done on `main`.

    Landed in PR #42 (squash commit 1063907, merged 2026-09-14T16:22:18Z), specifically the sub-change documented in that PR's pre-squash commit `5828791` ("fix(merge-on-approval): three round-15 objections, all real"), whose own message states: "while #44 tracks wiring that same harness into CI — which the rule made impossible. The harness moves into tests/guard/: both suites re-extract from the shipped YAML... The harness moves into tests/guard/."

    What shipped, checked directly on `main`:

    • `.github/workflows/guard-tests.yml` — new dedicated workflow (not a step added to `pr-checks.yml`; see below), job `guard`, triggers on `push: branches:[main]` and `pull_request`, single step `bash tests/guard/all.sh`.
    • `tests/guard/all.sh` — runs `run.sh` (stubbed-`gh` shell suite) then `jqtest.sh` (real-jq suite), satisfying the comment's scope update that both harnesses, not just the shell one, get wired in.
    • `tests/guard/extract.sh` — re-extracts the guard verbatim from `.github/workflows/merge-on-approval.yml` between the `# guard-slice-begin`/`# guard-slice-end` markers (present at lines 218/587) on every run; `run.sh` refuses to run if extraction fails ("refusing to run against a stale guard.sh"). `tests/guard/.gitignore` excludes the generated `guard.sh`, so there is no committed snapshot that could drift stale — the exact risk the issue raised.
    • Branch protection on `main` (added same day) now requires status check `"guard"` — this job is the enforcement, confirmed via `gh api repos/.../branches/main/protection`.
    • `gh run list --workflow=guard-tests.yml`: green (`success`) on every push since landing, including current `main` HEAD `a64017f`.

    One deliberate deviation from the issue's literal wording: the body and the comment both say "wire ... into `pr-checks.yml`", but that file names itself in its own `paths-ignore`, so a PR touching only it produces no run at all and can't land itself (the same constraint the issue itself describes for why this "needs its own direct push to main"). The actual fix used a separate file, `guard-tests.yml`, which has no such self-exclusion and could land through a normal PR — functionally satisfies the issue title ("wire the guard harness into CI") without the blocker the literal instruction would have hit. Not tracked elsewhere; this is the complete fix, no remainder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions