Skip to content

CI v2: required checks + merge queue, generated data off main (one writer), prove only what moved, one PR workflow #4825

Closed

Description

@squid-protocol

Why (measured 2026-10-09). A day of merges turned into a dance of re-merges and restarted 40-min CI runs. Root causes, from a review of all 39 workflows and the day's 300 runs:

  1. Nothing is required to merge. main has no required status checks and no rulesets; repo auto-merge is on. Every gate is a convention (pr_check, the shepherd). Bot PRs merge with --auto before their tests mean anything: evidence: refresh stale records and the evidence report #4820 landed a refresh computed on an older main and turned main red for every PR.
  2. Generated data lives on main with several writers. PRs commit evidence records, the coverage ledger, rendered evidence pages, the register page and spec status. Seven workflows auto-commit to main after pushes (Evidence Refresh, Mainframe Ground Truth, Archetype Validation, and the call-resolution / graph-comparison / tree-sitter-accuracy / tri-comparison histories). Every bot commit stales or dirties open PRs and re-runs main's CI (19% of the day's minutes; the bot's own runs another 15%).
  3. Every PR proves everything. The full det sweep, golden masters and ~32 workflows run even for a one-line change. Our own PRs were 65% of the minutes, much of it restarts.
  4. Db2 cases are never tested on PRs; their verdicts come from local sweeps and the nightly bot.
  5. Third-party actions that build Docker images per run (muninn) fail together when Docker Hub throttles GitHub's runners (429/504, 2026-10-09 21:06Z onward).

Interim (done 2026-10-09): Evidence Refresh disabled (owner) and its in-flight run cancelled; #4813 (no timestamp churn); CI shepherd + digest (#4819, #4823: infra reruns ×3 15 min apart, registry rate limits = infra).

Plan, in order (each step independently safe)

  1. Required checks that always report + a merge queue.
    • One always-running aggregator job, ci-gate, on pull_request and merge_group, required by a ruleset on main.
    • Path-filtered workflows decide inside the job (skip → success) instead of at trigger level, so a required check can never sit "expected" forever.
    • Merge queue on, so every merge is tested against the real main.
    • Bots go through the queue like everyone else.
  2. Generated facts off main, one writer.
  3. Prove only what moved (det sweep: copy forward verdicts by content key, prove only what moved, work-sized shards up to 20 #4814): content-keyed verdict cache, work-sized shards up to 20, and a nightly no-cache audit. Db2 cases are included through the cache plus a nightly Db2 job.
  4. One PR workflow:
    • plan → affected shards → one result;
    • the small audits (ruff, mypy, dead-key, AST/tree-sitter accuracy, golden guard…) folded into one job;
    • path filters that match what each check actually reads (audit in progress);
    • cancel-in-progress already holds on 36/39.
  5. Shepherd step 3 (CI shepherd: wait/merge/re-merge/rerun deterministically, failure digest + local repro, bounded fixer hook (was: merge watcher upgrades) #4790): "failing on main too" triage (one note, not one per PR); a fixer hook; auto re-merge when only generated files conflict. Mostly moot after step 2.
  6. Brittle third-party actions: run muninn from a prebuilt pinned image (or weekly + main only), so a Docker Hub hiccup can't block PRs.

While the bot is off: a nightly Db2-only det sweep (local or a small scheduled job), so Db2 cases stay checked.

Owner, 2026-10-09: "we just need to fix this mess with your plan so take over". Executed by the orchestrator + agy.

🤖 Generated with Claude Code

Activity

  1. added
    enhancement
    ci-cd
    priority: high
    on Oct 9, 2026
  2. squid-protocol commented on Oct 9, 2026

    @squid-protocol
    OwnerAuthor

    Step 2 design: generated facts off main (draft, needs owner decisions)

    Inventory (agy map, 2026-10-09): 10 generated families, all committed by PRs today:

    • evidence records (tests/equivalence/*/evidence.json, crucible ports);
    • the det coverage ledger (per-case files since feat(#4789): per-case det-sweep coverage ledger; CICS spec status page bot-generated #4811);
    • rendered evidence pages and the report;
    • the register page (oracle_assumptions.md);
    • CICS spec status (.md/.json);
    • blockers_history.jsonl;
    • the *-history workflow outputs (call-resolution, graph-comparison, tree-sitter accuracy, tri-comparison);
    • archetype validation;
    • the ground-truth ledger.

    Writers are a tool run in the PR and a bot on main. Blocking checks read most of them.

    Split them into two kinds; they need different treatment:

    Kind Families Proposal
    A. Pure derived output: a deterministic render of other committed data rendered evidence pages + report, register page, spec status page, history charts/tables, blockers_history.jsonl Off main. One writer (a bot), on a generated data branch (or gh-pages for the docs site). PRs never commit them; the freshness tests become a bot-side check plus the release gate.
    B. Measured facts that gate merges: what a PR proved evidence records (incl. human approvals), det coverage ledger, ground-truth ledger, archetype validation Stay on main, but only the PR that changes their inputs writes them, and the bot only re-proves stale ones nightly through the merge queue (never pushed under open PRs).

    Why B stays: records carry evidence.py approve sign-offs (a person's decision, owner policy #4048), and blocking checks compare a PR's proof against them. Moving them off main would move approvals and change the evidence policy; that's a bigger decision than plumbing.

    Owner decisions needed:

    1. OK to take kind A off main (data branch for derived pages, docs site published from it)?
    2. Kind B stays on main; the bot's refresh of B runs nightly only, and its PR goes through required checks (and a merge queue once enabled). OK?
    3. Once 1+2 land, re-enable Evidence Refresh?

    The remaining dance after this: only PRs that change the same case touch the same B files (per-case since #4811), which is a real conflict, not churn.

  3. squid-protocol commented on Oct 10, 2026

    @squid-protocol
    OwnerAuthor

    Owner decisions (2026-10-09): yes to all three. (1) Rendered pages / charts off main to a generated data branch with one writer; (2) evidence records + ledgers stay on main, the bot refreshes stale ones nightly only, through required checks; (3) re-enable Evidence Refresh once 1+2 land. Building step 2 now.

    🤖 Generated with Claude Code

  4. squid-protocol commented on Oct 10, 2026

    @squid-protocol
    OwnerAuthor

    Step 1b done (2026-10-10): ruleset 24824983 "main: required checks (#4825)" active on the default branch: det, full-suite, ground-truth, mypy-audit, ruff-audit (GitHub Actions), not strict, no bypass (bots included). Step 1a (#4826) made these report on every PR; step 2 (#4827) took the evidence pages off main; Evidence Refresh is re-enabled nightly-only.

    Remaining: history bots off main (step 2 v2), cached base translation for the port diff, folded small audits (step 4), muninn without per-run Docker Hub pulls, merge queue later.

    🤖 Generated with Claude Code

  5. squid-protocol commented on Oct 10, 2026

    @squid-protocol
    OwnerAuthor

    Status + trimmed plan (owner, 2026-10-10).

    Done:

    PR push → all green went from 40–52 min to ~13 min.

    Remaining, in order:

    1. Path filters match what each check reads. A missed trigger means a gate silently doesn't run (correctness).
    2. Nightly carried-forward check (det sweep: copy forward verdicts by content key, prove only what moved, work-sized shards up to 20 #4814): the nightly full det sweep compares its fresh verdicts with what PRs carried forward.
    3. Speed up ground-truth, now the slowest required check (8–13 min).
    4. Merge queue, if main breaks again despite required checks.

    Nice to have (later): fold the small audits into one job; history bots off main; shepherd fixer hook / auto re-merge / scheduled routine.

    Dropped: evidence report off main (only the nightly bot writes it, so no dance); muninn prebuilt image (the shepherd merges past infra-only failures of non-required checks).

    🤖 Generated with Claude Code

  6. squid-protocol commented on Oct 10, 2026

    @squid-protocol
    OwnerAuthor

    Next batch (owner, 2026-10-10): PRs first, post-merge work when idle. After a merge, main's push-triggered workflows (the OS × Python matrix, crucibles, ground-truth, history bots…) take runners from PRs waiting on checks. GitHub has no job priority, so we control what runs after a merge and when:

    1. Cancel superseded main runs. A newer main commit makes an older commit's check runs pointless. Use cancel-in-progress on push runs of read-only check workflows; workflows that write commits keep their no-cancel rule.
    2. OS × Python matrix (Full Suite Gate) to nightly + on demand, not every push. main-watch reports it.
    3. Post-merge checks run when the runners are idle, on the latest main. A small scheduled dispatcher (~20 min) checks whether main moved since the last post-merge batch and whether PR jobs are queued. If PRs are waiting, it defers; if idle, it runs one batch of the post-merge checks on the latest main SHA. Five quick merges become one run, and PRs always go first. main-watch still opens an issue for any red result.

    Plus, from this round:

    Delegated to Haiku / agy; orchestrator reviews before merge.

    🤖 Generated with Claude Code

  7. squid-protocol commented on Oct 10, 2026

    @squid-protocol
    OwnerAuthor

    Batch update: pip cache consolidation dropped. My diagnosis was wrong. Only smoke-test and full-suite-gate use cache: pip, and they already share pyproject.toml as key. The 22 caches are OS × Python matrix legs × refs (setup-python keys include OS + version). Fewer matrix runs (nightly-only OS matrix, Haiku B's PR) is the real lever; re-measure cache usage after it lands. Small audits folded: #4844.

    🤖 Generated with Claude Code

  8. squid-protocol commented on Oct 10, 2026

    @squid-protocol
    OwnerAuthor

    Done; closing. CI v2, delivered 2026-10-09/10:

    PR push → green went from 40–52 min to ~13 min. Leftover nice-to-haves: #4847

    🤖 Generated with Claude Code

  9. added
    scope:infra
    on Oct 16, 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

    ci-cdenhancementpriority: highscope:infra

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions