Skip to content

feat(pr-require-checks): run ci-status and its lanes on merge_group - #820

Merged
kyle-sexton merged 2 commits into
mainfrom
feat/ci-status-merge-group
Oct 20, 2026
Merged

kyle-sexton merged 2 commits into
mainfrom
feat/ci-status-merge-group

Conversation

@kyle-sexton

@kyle-sexton kyle-sexton commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

Refs: #661

Summary

Part 1 of #661: pr-require-checks.yml now runs on merge_group (checks_requested only), so ci-status reports on the merge-group commit once a queue is required. This PR does not turn the queue on; that is part 2, UsesMergeQueue for ci-workflows in github-iac.

Fix

  • pr-require-checks.yml: adds merge_group: { types: [checks_requested] }. No job gate needed changing. A merge-group payload has no github.event.pull_request, so the contract-only predicate is false and every lane ci-status aggregates runs in full. The concurrency group falls back to github.run_id, so queued runs never cancel each other. pr-review, pr-review-security and pr-automerge-dependabot keep their github.event_name == 'pull_request' gate, so they stay off on merge groups and stay advisory. check-managed-files is still pull_request-only; its merge-group handling is check-managed-files: re-verify sync PRs in merge-group runs #710.
  • check-contract: a merge-group path. It reads the queued PR number from merge_group.head_ref ([refs/heads/]gh-readonly-queue/<base>/pr-<N>-<40-hex>) and re-reads that PR live. It re-runs the Conventional Commits title check and fails when the PR carries the do-not-merge label, so the queue drops it; either can change after enqueue. It reports linkage as skipped and writes no comment or label. The head ref names only the group's last PR, so the README states the queue must use grouping_strategy: ALLGREEN. It fails closed when the ref cannot be parsed or the PR cannot be read. pr-number is ignored on merge_group.
  • aggregate-results: the sha default is now pull_request.head.sha || merge_group.head_sha || github.sha. On a merge group, github.sha is already the group head, so this only names it explicitly. ci-lanes is recorded on the group commit, where the ci-status check run also reports.
  • gitleaks git mode: a merge group defaults to merge_group.base_sha..HEAD, the same way a PR uses its base SHA. A missing base SHA fails closed. This repo's own dogfood scans in dir mode, so this change affects git-mode consumers only.
  • actions-expression.cjs (test helper): adds fromJSON, cancelled() (always false) and element-wise contains over arrays. With these, the test can evaluate the real job gates under a merge-group context.

Verification

  • node --test .github/scripts/*.test.cjs: 479 pass, 0 fail. New tests in ci-fanout-consolidation.test.cjs:
    • the trigger is merge_group with checks_requested only;
    • under a merge-group context, every job in ci-status's needs, and ci-status itself, evaluates true;
    • the review lanes, the Dependabot arm and the issue labeler evaluate false;
    • the concurrency group resolves to pr-require-checks-<run_id>.
    • Mutation check: adding && github.event_name == 'pull_request' to ruff's gate fails the lanes test, which names ruff.
  • node --test .github/actions/*/*.test.cjs: 88 pass, 0 fail.
  • check-contract/run.test.sh: all pass. The new cases run run.sh itself:
    • a queued PR with do-not-merge fails;
    • a queued PR with a good title passes, skips linkage, and makes no POST or DELETE;
    • a queued PR with a non-conventional title fails, with no POST or DELETE;
    • four unparsable refs (empty, refs/heads/main, non-numeric PR, short SHA) fail closed with no API call;
    • a 404 on the PR read fails.
    • Run against the old run.sh, every new case fails.
  • aggregate-results/run.test.sh and gitleaks/scan.test.sh (new merge_group range case and missing-base case): pass.
  • actionlint: clean. zizmor --offline .: no findings. shellcheck, shfmt -d, composite-run-shellcheck.sh and Biome 2.5.11 ci .github/scripts: clean.
  • Not yet verified: ci-status on a real merge-group commit. That needs the queue from part 2.

Live probes on pr-pipeline-sandbox (queue: merge_method: SQUASH, ALLGREEN)

  • (a) stale --match-head-commit: refused, not enqueued. In #180, the first head b85280c went green. I then pushed ec7de8d, waited until every check on it was green, and ran gh pr merge 180 -R melodic-software/pr-pipeline-sandbox --match-head-commit b85280cc18966310e6fcabd0bd4759a5e72e7e43 (gh 2.102.0):
    GraphQL: Failed to add PR #180: expected head oid does not match the current head oid (enablePullRequestAutoMerge)
    
    Afterwards GraphQL showed isInMergeQueue: false and autoMergeRequest: null, so the queue path enforces expectedHeadOid. An earlier try, while checks on ec7de8d were still pending, was stopped by the local guardrails block-unresolved-pr-merge hook before it reached GitHub.
  • (b) non-squash method: inconclusive, not run. In #181, head 0e01991 was green. The local Claude Code permission system denied gh pr merge 181 -R melodic-software/pr-pipeline-sandbox --merge --match-head-commit 0e019915a7a063f3b7fc0e45596e24f599699c62 before it reached GitHub: Permission to use Bash with command ... has been denied. No other shape was tried. refactor: extract shared find-tracking-issue core into one generated source #181 was closed unmerged.

Both probe PRs are closed and their branches deleted.

Related

🤖 Generated with Claude Code

Add `merge_group: { types: [checks_requested] }` so a required merge queue
gets a ci-status report on the group head instead of waiting out the check
timeout. The contract-only predicate is already false without a pull request
payload, so every aggregated lane runs in full; the Claude review lanes and
the Dependabot arm stay pull_request-only and advisory.

check-contract gains a merge-group path: it reads the queued pull request
number from the gh-readonly-queue head ref, fails when that pull request
carries the do-not-merge label, skips title and linkage, writes nothing, and
fails closed on an unparsable ref or an unreadable pull request.

gitleaks git mode scopes a merge group to merge_group.base_sha..HEAD, and the
ci-status sha default names merge_group.head_sha explicitly.

Refs: #661

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-20T19:29:35.395871Z b1e7f0a Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

…LGREEN

A merge-group run now applies the Conventional Commits title check to the
queued pull request as well as its live do-not-merge label, since either can
change after enqueue; linkage stays skipped and nothing is written.

The head ref names only the group's last pull request, so document that the
merge queue must use grouping_strategy ALLGREEN: under HEADGREEN an earlier
entry that failed, a do-not-merge one included, can still merge.

Refs: #661

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton
kyle-sexton merged commit 97b2030 into main Oct 20, 2026
76 of 79 checks passed
@kyle-sexton
kyle-sexton deleted the feat/ci-status-merge-group branch October 20, 2026 19:45
kyle-sexton added a commit that referenced this pull request Oct 20, 2026
…group (#823)

Closes #710

## Summary

In a `merge_group` run, `check-managed-files` passed without checking
anything. The payload carries no pull request, so `base-ref` and
`head-ref` both resolved to `github.sha` and the mode step fell through
to `hand-edit`. `run.sh` then diffed an empty range and printed "No
managed-file hand-edits in this diff". claude-code-plugins' gating job
already runs on `merge_group`, so the gap is live there today.

## Fix

The action now handles the merge group itself, so callers need only a
pin bump.

- **Mode step.** On `merge_group` it selects `merge-group`. The
pull-request steps' gates are unchanged, so non-`merge_group` events
behave as before.
- **New step `Map the merge group to its pull requests`**
(`merge-group.cjs`, via github-script):
- Parses `pr-<N>` from `gh-readonly-queue/<base>/pr-<N>-<sha>`, using
the same pattern as `check-contract/run.sh`. An unparsable ref fails and
the error names the ref.
- Reads each pull request with `pulls.get`. A stack lands as one group,
so while a pull request targets another branch instead of the queue's
base, it finds the single open pull request from that branch and
continues down to the base.
- Selects each pull request's mode by the mode step's rules. A parity
test holds the bash and JS copies together.
- **Hand-edit:** its own `pulls.listFiles` paths, both sides of a rename
included, are checked against the managed set by `run.sh`, through the
new `CHANGED_PATHS_FILE` input.
- **Dependabot:** skipped only when its commits pass the existing
Dependabot check against its own `head.sha`.
- **Sync:** must be queued alone. Its commit identity is re-checked, and
`verify-sync.sh` verifies the group's `base_sha...head_sha` against
standards `main` as resolved at run time.
  - Fails closed when:
    - the ref cannot be parsed;
    - `pulls.get`, `pulls.list` or `pulls.listFiles` fails;
    - the file list reaches the 3000-file API cap;
    - the walk does not reach the base;
    - a sync pull request shares its group;
- any path in `merge_group.base_sha...head_sha` belongs to none of the
group's pull requests.
- **README.** Documents merge-group behavior and the `grouping_strategy:
ALLGREEN` requirement, as check-contract's README does.
- **Dogfooding.** ci-workflows' own advisory `check-managed-files` job
now also runs on `merge_group`. It is still outside `ci-status`, and its
contract-only predicate is unchanged.

**Security review requested.** This changes a trust-boundary guard. #710
rates the risk LOW. Please review the fail-closed paths in
`merge-group.cjs` and the stack walk in particular.

## Verification

- `node --test .github/scripts/*.test.cjs`: 496/496 pass.
- `node --test .github/actions/*/*.test.cjs`: 101/101 pass.
- New tests in `.github/scripts/check-managed-files-sync.test.cjs`
exercise `resolveMergeGroup` against a real git fixture and then run
`run.sh` or `verify-sync.sh` as the action does:
- an unparsable ref fails, naming the ref; a `pulls.get` failure fails;
- a sync pull request that matched standards main passes, and fails once
standards main moves past it;
  - a sync pull request with foreign commits fails;
- a hand-edit pull request touching a managed path fails. The test also
shows that the pre-fix head-only diff passes the same fixture;
  - a non-sync pull request touching no managed path passes;
  - a verified Dependabot pull request is skipped;
- in a two-PR stack, a managed edit in either pull request fails and
names only that pull request;
- a group path in neither pull request fails closed; a stack whose base
has no open pull request fails closed; a sync pull request sharing its
group fails closed.
- `.github/scripts/check-managed-files-skip.test.cjs`:
  - the mode step yields `merge-group` on `merge_group`;
  - the bash and JS mode rules agree across the existing case table;
  - the gate assertions cover the new steps.
- shellcheck (scripts and composite `run:` blocks via
`composite-run-shellcheck.sh`), actionlint, `zizmor --offline` (no
findings), shfmt, `biome ci .github/scripts` and markdownlint: all
clean.

## Related

- Refs #661: merge_group support, part 1 landed in #820. This PR copies
#820's queue-ref pattern and does not edit `check-contract/run.sh`.
- Refs #729: it touches the same mode step, but its fix lands in
dotfiles, so no ci-workflows change is expected.
- The queue must use `grouping_strategy: ALLGREEN`: the head ref names
only the group's last pull request.
- claude-code-plugins picks this up after a ci-workflows tag and a pin
bump there. Its `check-managed-files` job comment ("A merge group …
passes") becomes stale at that bump.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
kyle-sexton added a commit to melodic-software/standards that referenced this pull request Oct 20, 2026
…hape (#825)

Refs: melodic-software/ci-workflows#736

## Summary

`check-pr-convention-copies` fails on every standards PR and on `main`

([job](https://github.com/melodic-software/standards/actions/runs/39484573331/job/118841536250)).

[ci-workflows#815](melodic-software/ci-workflows#815)
rewrote two parts of
`check-contract/run.sh` that the static parsers in `lockstep-drift.mjs`
anchor on. The behavioral
tests still passed; only the text parsers broke:

- `drift: gate composite: closing-keyword / no-issue-marker match
expressions not found in run.sh`
- `drift: gate composite (negated closers): negation_trigger's window,
"not only" exception, trigger words, or suffix test not found in run.sh`

## Fix

- Keyword scan: the parser now also accepts the #815 form, where
`scan_line` applies `closing_regex`
  in one pass (`marked = lower`, `gsub(closing_regex, "\n&\n", marked)`,
`count = split(marked, pieces, "\n")`). The `match(chunk,
closing_regex)) break` loop is no longer
required. Before, the scan had to run over the lowercased line; it still
must.
- Negation window: the parser accepts either shape, and each must keep
all of its anchors.
  - Pre-#815: `first = (count > N) ...`, unchanged.
  - #815: `++seen == N) break` plus the window slice
`tail = substr(line, start, keyword_index - start)`. The punctuation set
(`. ! ? ; ,`) is left to
the behavioral layer, as before; an existing test asserts that changing
it is behavioral drift
    only.

`N` is still compared against `policy.json`'s `wordWindow` (5). The "not
only" exception, the
  trigger words and the `n't` suffix test are read as before.
- The pre-#815 shape stays accepted. Older consumer pins still run it,
and so does the head of

[ci-workflows#820](melodic-software/ci-workflows#820).
- New fixture
`fixtures/lockstep/check-contract-run-bounded-scan.sh.txt`: the #815
run.sh, plus the
`spellchecker:ignore-next-line` comment the existing fixture carries.
New tests:
- The #815 fixture passes `checkPinnedComposite` and `checkCopies`, and
the negation parser reads
    the policy values from it.
- Each new anchor, mutated away, is drift: window 5→4, an unbounded
slice, `gsub` applied to a
different regex, and `marked` taken from the raw line. A dropped `,`
stop is behavioral drift.

## Verification

- `npm run lint:pr-convention-copies` against live ci-workflows `main`:
`every copy matches policy.json`.
- `checkPinnedComposite` on each run.sh, with that ref's `action.yml`,
ran locally: 0 findings for
ci-workflows `main`, for #820's head
`f43d19ee492d3f8f53e72109023cb50071f92b0c`, and for the
  pre-#815 parent of `cc7613fbf8bacca72700d6498c32145c05fe1f09`.
- New mutation test: passes locally.
- `npm run test:pr-convention-lockstep`: not green locally. The host was
overloaded (load average
83 on 32 cores), so the hook validator's behavioral harness hit its 10s
limit
(`the validator did not finish within 10s`). That harness also threw one
`spawnSync bash EPIPE`.
Neither involves the composite parsers. CI's hermetic run on this PR is
the authoritative result.
- Pre-commit hooks passed: editorconfig, typos, biome, gitleaks.

## Related

-
[ci-workflows#815](melodic-software/ci-workflows#815):
the rewrite this tracks.
-
[ci-workflows#820](melodic-software/ci-workflows#820):
merge_group title check; its head parses under this change.
-
[standards#822](#822)
-
[ci-workflows#736](melodic-software/ci-workflows#736)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant