Skip to content

improve(ci): merge queue on main instead of strict up-to-date — 37 merge-main commits in the last 40 PRs #1350

Closed

Description

@admarble

Summary

Turn on GitHub merge queue for main in place of the strict "require branches to be up to date" setting. On a busy main, strict mode puts every open PR into a loop: merge main, wait for CI, repeat.

Current State

Proposed Change

  • Add merge_group: to the on: block of every workflow whose checks are required (ci.yml: test, canary). Without it, queued PRs never get their checks run. (GitHub docs)
  • Add the merge_queue rule to the ruleset through scripts/ruleset-main.sh and its doc docs/internal/graph-2026-09-guard/ruleset.md. Drop strict up-to-date: the queue tests each PR against the latest main itself.
  • Merge queue is free for public repos owned by an org, which covers sequant-io/sequant.
  • Update anything that merges PRs (/merger, /release Step 6, gh pr merge sites in skills) to queue the PR (gh pr merge --auto) instead of merging directly.
  • This does not fix CHANGELOG.md conflicts. A conflicting PR is removed from the queue. See the linked changelog-fragments issue.

Acceptance Criteria

  • AC-1: ci.yml runs on merge_group and the job names test and canary are unchanged — Evidence: grep -n "merge_group" .github/workflows/ci.yml
  • AC-2: scripts/ruleset-main.sh --print emits a merge_queue rule and no strict up-to-date flag — Evidence: scripts/ruleset-main.sh --print | jq '.rules[].type'
  • AC-2b: the script's merge_queue rule merges by squash, and nothing applies it in this PR (it ships --print output and docs only) — Evidence: scripts/ruleset-main.sh --print | jq '.rules[] | select(.type=="merge_queue")'
  • AC-3 / AC-4 moved to gate(owner): enable the main merge queue after /release waits for queued merges (#1350 follow-up) #1368 by the owner, 2026-10-08: applying the queue waits until /release Step 6 waits for a queued merge (it would tag the wrong commit), and skill edits wait for the plugin-directory review (plugin/ freeze). No file under .claude/skills, templates/skills or plugin/ changes in this issue.

Context

  • Location: .github/workflows/ci.yml, scripts/ruleset-main.sh, merge sites in skills
  • Type: Infrastructure
  • Effort: Quick win → Medium (AC-3 is an owner action)
  • Identified by: /improve analysis (tooling research, 2026-10-07)

Related

Activity

  1. added
    enhancement
    github_actions
    on Oct 7, 2026
  2. admarble commented on Oct 7, 2026

    @admarble
    ContributorAuthor

    Paired with #1351 (changelog fragments). The queue fixes the up-to-date loop, but a CHANGELOG conflict still removes a PR from the queue.

  3. admarble commented on Oct 8, 2026

    @admarble
    ContributorAuthor

    Runner note (sequant run, 2026-10-08):

  4. admarble commented on Oct 8, 2026

    @admarble
    ContributorAuthor

    Complexity: Standard (3 ACs, 3 directories)

    AC Quality Check

    • AC-1 Evidence (grep -n merge_group ci.yml) fails today, so it gates something. It does not check the job names. Tighten: also grep -nE '^ (test|canary):' .github/workflows/ci.yml returns both.
    • AC-2 Evidence (jq '.rules[].type') only lists types and cannot fail. Tighten: scripts/ruleset-main.sh --print | jq -e '([.rules[].type]|index("merge_queue")) != null and ([.rules[]|select(.type=="required_status_checks").parameters.strict_required_status_checks_policy]|first) != true'.
    • AC-2b Evidence prints the rule but does not assert merge_method. Tighten: pipe to jq -e '.parameters.merge_method=="SQUASH"'. "Nothing applies it" is checked by grep -n 'gh api.*-X PUT\|--method PUT' scripts/ruleset-main.sh returning nothing.
    • AC-3/AC-4 moved to gate(owner): enable the main merge queue after /release waits for queued merges (#1350 follow-up) #1368 by the owner. No change to .claude/skills, templates/skills or plugin/.

    Scope Assessment

    Non-Goals: ⚠️ No Non-Goals section in the issue. Implied from the runner note: no skill edits, no applying the ruleset, no changelog fragments (#1351).

    Metric Value Status
    Feature count 1 ✅
    AC items 3 ✅
    Directory spread 3 (.github/workflows, scripts, docs/internal) plus CLAUDE.md ✅

    Verdict: ✅ SCOPE_OK

    Acceptance Criteria

    AC-1: ci.yml runs on merge_group, job names unchanged

    Verification: Unit Test (file-content assertion) plus the grep
    Scenario: Given ci.yml → When the on: block is parsed → Then it has merge_group and the jobs test and canary still exist with no strategy.matrix
    Assumptions: merge_group takes no branches: filter in the same form as pull_request. Leave it bare, as gitleaks.yml already does.

    AC-2: --print emits a merge_queue rule and no strict flag

    Verification: Integration Test (run the script, parse the JSON)
    Scenario: Given the script → When --print runs → Then rules[].type includes merge_queue and required_status_checks.parameters.strict_required_status_checks_policy is false/absent
    Assumptions: The GitHub API still accepts required_status_checks alongside merge_queue. The required_status_checks rule stays, since the queue uses it to decide which checks gate a merge group.

    AC-2b: queue merges by squash, nothing applied

    Verification: Integration Test
    Scenario: Given --print → When filtered to the merge_queue rule → Then parameters.merge_method=="SQUASH" and the script has no mutating call
    Assumptions: Other parameters take explicit values so the payload is reviewable: grouping_strategy: ALLGREEN, max_entries_to_build: 5, max_entries_to_merge: 5, min_entries_to_merge: 1, min_entries_to_merge_wait_minutes: 5, check_response_timeout_minutes: 60.

    Implementation Plan

    Phase 1: Workflow

    1. .github/workflows/ci.yml: add merge_group: to on:. Extend the load-bearing-job comment (lines 10-23) to say the queue also needs these contexts to report on merge_group.
    2. gitleaks.yml already has merge_group, so no change. opencode-smoke.yml is pull_request-only with path filters and is not a required check, so leave it. scorecard.yml, plugin-install-test.yml and plugin-eval.yml are not required.

    Phase 2: Ruleset script and doc

    1. scripts/ruleset-main.sh: set strict_required_status_checks_policy to false and add the merge_queue rule with the parameters above. Update the header comment and the REQUIRED_CHECK_CONTEXT comment, which cite strict mode as the reason a renamed job blocks main. The reason is now the queue timeout.
    2. docs/internal/graph-2026-09-guard/ruleset.md: update the field table (strict row, new merge_queue rows), the "context name" paragraph, and "Applying it". State that applying waits on gate(owner): enable the main merge queue after /release waits for queued merges (#1350 follow-up) #1368. Do not add an apply command to the script.
    3. CLAUDE.md: the Branch protection and Red main paragraphs say "strict up-to-date". Reword to describe the queue. Mark that the text applies once gate(owner): enable the main merge queue after /release waits for queued merges (#1350 follow-up) #1368 lands, since the live ruleset is unchanged until then.

    Phase 3: Tests

    1. New scripts/ruleset-main.test.ts, named so it runs in the integration project. Cover the AC-1 file-content checks and the AC-2/AC-2b JSON checks. Scope the ci.yml assertions to the on: block, not the whole file. Mutation-verify per CLAUDE.md: delete merge_group, confirm the AC-1 test fails; remove merge_queue, confirm AC-2 fails; set merge_method to MERGE, confirm AC-2b fails. Record the Mutation-verified: markers in the PR body with the file path first.

    Design Review

    1. Where does this logic belong? The workflow trigger lives in ci.yml. The ruleset payload lives in ruleset-main.sh, which is the single producer of that payload.
    2. Simplest correct approach? Add merge_group: and one rule object. Rejected alternative: keep strict and add a merge-main bot. That still costs a CI run per PR.
    3. Existing pattern and recurrence? This follows the print-only ruleset script from ci(gate): required checks on main, up-to-date rule, red-main revert, and mechanical proof for any "pre-existing failure" claim #1093/gate(owner): apply the main ruleset — target ~DEFAULT_BRANCH, require the test check, strict up-to-date #1109. git log -S strict_required_status_checks_policy shows only ci(gate): required checks on main, up-to-date rule, red-main revert, and mechanical proof for any "pre-existing failure" claim #1093 and gate(owner): apply the main ruleset — target ~DEFAULT_BRANCH, require the test check, strict up-to-date #1109, so fewer than 2 fixes and no class to fix.
    4. What would a senior reviewer challenge? "Why not require canary too?" See Open Question 1. "Does merge_group run test on a stale base?" No, the queue builds a temp branch on the latest main.
    5. Producers and consumers of the artifact. Whole-repo grep for ruleset-main / strict_required: producer is scripts/ruleset-main.sh. Consumers are ci.yml (comment), ruleset.md, CLAUDE.md, PLAN.md, issue-graph.md (historical, leave) and scripts/preexisting-claim-gate.test.ts:144 (asserts the script path in a section, unaffected). One producer, so no parity test is needed.

    Feature Quality Planning

    All standard checks pass. Notable items:

    • The issue says required checks are test and canary, but the script and doc require only test. A queue gating on test alone would merge without canary.
    • gitleaks already runs on merge_group. If it becomes a required check, it must report there; it does.
    • A job that fails to report on merge_group stalls the queue until check_response_timeout_minutes.

    Open Questions

    1. Add canary to required_status_checks in the payload? — Recommendation: yes, as the issue's Current State implies it is already required. Impact: if the live ruleset requires only test, adding it changes behaviour at apply time; the owner sees it in the diff step. Confirm what is live with gh api repos/sequant-io/sequant/rulesets/12393605.
    2. Queue sizing — Recommendation: the conservative defaults above (ALLGREEN, 5/5, wait 5 min). Impact: only throughput.

    Recommended Workflow

    Phases: exec → qa
    Quality Loop: disabled
    Reasoning: Small infra change, three files plus docs. Tests are file-content and JSON assertions written alongside the change, so testgen adds nothing. No UI. Do not run the full npm test (runner note); run only the new test file.

    Label Review

    Current: enhancement, github_actions
    Recommended: enhancement, github_actions, planned
    Quality Loop: Won't auto-enable (SCOPE_OK)

  5. added
    planned
    on Oct 8, 2026
  6. admarble commented on Oct 8, 2026

    @admarble
    ContributorAuthor

    QA Verdict: AC_MET_BUT_NOT_A_PLUS

    AC coverage: 2/3 met

    Gaps:

    • Missing CHANGELOG [Unreleased] entry for a user-facing feat commit
    • toBeDefined on execFileSync output is tautological; the call itself is the syntax check
    • Required test check still pending at review time

    Suggestions:

    • In the "never applies" test, expect(execFileSync("bash", ["-n", SCRIPT])).toBeDefined() always passes. execFileSync throws on a syntax error, so the call itself is the check and the expect adds nothing.
    • ruleset.md §Applying has one long unwrapped line ("…strict up-to-date. An agent never applies it: …").
    • Applying this payload adds canary as a required check. If the live ruleset requires only test, that changes what blocks a merge. Step 1 of the docs now tells the owner to check this before step 2.
  7. added 2 commits that reference this issue on Oct 8, 2026
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

    enhancementgithub_actionsplanned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions