Skip to content

ci(main): run the PR gate suite on every push to main (S28) - #4595

Merged
Daniel Meppiel (danielmeppiel) merged 11 commits into
mainfrom
p-s28-main-watch
Nov 21, 2026
Merged

Daniel Meppiel (danielmeppiel) merged 11 commits into
mainfrom
p-s28-main-watch

Conversation

@danielmeppiel

@danielmeppiel Daniel Meppiel (danielmeppiel) commented Nov 21, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Regent order S28 ("watch gap"). Main was red on Lifecycle Smoke shard 4 for about 90 minutes and nobody saw it. ci.yml and merge-gate.yml trigger only on pull_request and merge_group, and the push workflows on main stayed green.

This PR runs the whole PR tier-1 suite on main's head after every merge:

  • New .github/workflows/main-push-gate.yml, with triggers push: branches: [main] and workflow_dispatch (no inputs). Jobs:
    • base: the push's before SHA, or HEAD^1 when it is all zeros. It refuses any ref that is not main.
    • tier1: uses: ./.github/workflows/ci.yml (the workflow_call trigger from ci(merge-train): exact-SHA train proof with train-gate (merge-queue v2 step 1) #4582) with base_sha. That means EVERY ci.yml job, including all four Lifecycle Smoke shards, derived from ci.yml rather than duplicated. Only contents: read, and no secrets (ci.yml uses none).
    • main-push-gate: if: always(). It needs base and tier1 and fails on any non-success, so main goes visibly red.
  • Concurrency: the caller group is main-push-gate-<run_id> with cancel-in-progress: false. The callee group becomes ci-<caller run_id>, which never collides with PR runs (ci-pr-N) or merge-train runs, and push runs are never cancelled.
  • merge-gate.yml and the ruleset are untouched; this adds no new required check.

Caches: no new default-branch saves

Every setup-uv step in ci.yml gains save-cache: ${{ (github.event_name == 'pull_request' || github.event_name == 'merge_group') && 'auto' || 'false' }}. pull_request and merge_group behave exactly as today. Every other event is restore-only: push, dispatch, and calls from this workflow or from merge-train. The pinned setup-uv 68559e9... (v10.3.3) supports save-cache. setup-node steps get package-manager-cache: false; there is no root package.json, so this is a no-op today. ci.yml has no setup-python cache: and no actions/cache.

ci.yml job step before after (step / added line)
lint setup-uv :47 :52 / :54
windows-compat-gate-1..3 setup-node :84 :91 / :94
windows-compat-gate-1..3 setup-uv :102 :110 / :113
windows-native-standard-user-symlink-gate setup-uv :213 :222 / :224
windows-git-discovery setup-uv :266 :277 / :279
test-architecture-contracts setup-uv :339 :352 / :355
test-architecture-scaling setup-uv :380 :394 / :397
build-and-test-shard setup-node :451 :466 / :469
build-and-test-shard setup-uv :469 :485 / :488
pr-binary-smoke setup-uv :607 :624 / :627
apm-self-check setup-uv :662 :680 / :683
lifecycle-smoke-shard-1..4 setup-node :767 :786 / :789
lifecycle-smoke-shard-1..4 setup-uv :772 :792 / :795
gate-cell-coverage setup-uv :860 :881 / :884

main-architecture-ratchets.yml:44 mirrors the same line, so the existing exact-match ratchet contract holds. On push it now saves FEWER main-scope caches than before.

Main-scope saves that already exist today, unchanged by this PR:

  • build-release.yml :105, :198, :395, :503, :691, :785, :849, and :1364 (default auto);
  • ci-runtime.yml :51;
  • gate-machine-nightly.yml :44;
  • mutation-pilot.yml :37, plus actions/cache :44;
  • crlf-invariance.yml :64;
  • copilot-setup-steps.yml :48;
  • auth-acceptance.yml :71 and :158 (dispatch on main).

Contracts (tests/quality/test_ci_topology.py, 19 new tests)

  • Triggers are exactly push to main plus a dispatch with no inputs.
  • Every ci.yml job runs on push, derived from ci.yml.
  • The aggregate needs all with always(), checked across result combinations.
  • No cancellation.
  • No cache-saving step is reachable from a main push, including callees and the lint-chain action.
  • Mutation cases that fail:
    • adding pull_request_target;
    • another branch;
    • dropping a need or always();
    • cancel set to true;
    • gating lifecycle-smoke-shard-4 to pull_request;
    • an if: on tier1;
    • a dispatch input;
    • dropping save-cache;
    • adding actions/cache;
    • setup-python cache: pip;
    • dropping package-manager-cache.

Docs: .apm/instructions/cicd.instructions.md (source) plus its deployed copy and the lock hash, and contributing/integration-testing.md.

Stacked on #4582, which adds the ci.yml workflow_call trigger. Until #4582 lands, the diff vs main includes it. Land #4582 first.

Issue and approved scope

Issue: Refs #4574 (the merge-queue v2 CI topology; S28 depends on its workflow_call trigger)

Human scope-approval comment: Regent order S28 for Daniel, relayed by [OPS] Lead, Delivery on 2026-11-21. It asks to run the PR merge-gate suite on main's head after every merge, reusing jobs via workflow_call, with push runs never cancelled and no new default-branch cache saves.

Does this PR complete the issue, or what remains? It completes S28. #4574 completes with #4582.

Type of change

  • Bug fix
  • New feature
  • Documentation
  • Maintenance / refactor

Testing

  • Tested locally (guarded, no xdist):
    • test_ci_topology.py -k "main_push or ratchet or merge_train or train or lint_chain or uv_environments or shared_cache or merge_group or merge_time or full_integration or quality_module or heavy_pr": 122 passed;
    • -k main_push: 19 passed;
    • 13 workflow-contract and quality files: 266 passed;
    • ruff 0.15.12 clean; actionlint clean;
    • apm audit --ci (tree apm): 15/15;
    • taxonomy --changed ok; complexity ratchet clean.
  • All existing tests pass (CI)
  • Added tests for new functionality

Changelog

  • One line in one section under ## [Unreleased] in CHANGELOG.md
  • N/A -- internal-only change (CI, tests, refactor).

Spec conformance (OpenAPM v0.1)

  • N/A -- this PR does not change OpenAPM-observable behaviour.

Scope add (de55c11): Tier 2 on every push to main

Main went red twice on 2026-11-21 in the Integration suite, which ran only on merge_group and dispatch. main-push-gate.yml now also calls ci-integration.yml (every shard, secrets: inherit) as tier2, and main-push-gate reads its result. The push path adds no new default-branch cache saves:

  • setup-uv in ci-integration.yml saves only on pull_request and merge_group;
  • setup-node package-manager caching is off;
  • the APM fetch cache is split into a restore step and a save step that never runs on push.

tests/quality/test_ci_topology.py pins the tier2 coverage and the no-save rule, with mutation cases (drop-tier2, integration-save-on-push, integration-uv-save).

Main went red on Lifecycle Smoke shard 4 for about 90 minutes unseen:
ci.yml and merge-gate.yml run only on pull_request and merge_group.

Add .github/workflows/main-push-gate.yml (push to main, workflow_dispatch).
A base job resolves the lint base (the push's `before`, else HEAD^1), tier1
calls ci.yml unchanged through workflow_call, and the main-push-gate
aggregate (if: always()) fails the run when any Tier 1 job fails, every
Lifecycle Smoke shard included. Runs group by run_id and are never
cancelled; it is not a required check.

No new default-branch cache saves: every setup-uv step in ci.yml sets
save-cache to 'auto' only on pull_request and merge_group and 'false'
otherwise (PR and merge_group behaviour unchanged), and setup-node sets
package-manager-cache: false. main-architecture-ratchets.yml mirrors the
contract job's setup-uv input so the two stay identical.

tests/quality/test_ci_topology.py pins the triggers, full ci.yml coverage
(derived), the aggregate, no cancellation and the no-cache-save rule over
every step reachable from a main push, with mutation cases. Document it in
the cicd instructions source (redeployed with the tree apm) and the
contributing integration-testing page.

Co-authored-by: Copilot App <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Static topology tests cannot verify the new workflow graph’s event propagation, execution, failure aggregation, or cache behavior, and hosted Actions validation on the integrated SHA remains pending with prerequisite #4582 still open.

No open issues 🎉

What changed in this PR

Closes the post-merge monitoring gap by running the full Tier 1 CI suite on every push to main, including all Lifecycle Smoke shards. It builds on #4582's reusable workflows without changing required checks.

Changes:

  • Adds a non-cancelling main-push workflow with base-SHA resolution and an aggregate failure check.
  • Prevents new default-branch cache saves while preserving existing PR and merge-group cache behavior.
  • Includes the stacked merge-train and shared lint-chain infrastructure, with topology contracts and documentation.
File Description
tests/​workflow_contracts.py Adds composite-action loading and step expansion helpers.
tests/​unit/​test_windows_native_symlink_workflow.py Checks lint coverage through the shared composite action.
tests/​quality/​test_ci_topology.py Adds main-push, merge-train, cache, and lint ownership contracts.
scripts/​check_complexity_ratchet.py Updates a comment identifying the lint scope's owner.
docs/​src/​content/​docs/​contributing/​integration-testing.md Documents main-push validation and merge-train usage.
apm.lock.yaml Refreshes deployed CI/CD instruction hashes.
.github/​workflows/​merge-train.yml Adds exact-SHA train validation from the stacked prerequisite.
.github/​workflows/​main-push-gate.yml Runs Tier 1 on main and aggregates failures.
.github/​workflows/​main-architecture-ratchets.yml Disables cache saves for the main-push ratchet job.
.github/​workflows/​ci.yml Enables reuse, shares lint steps, and restricts cache saves.
.github/​workflows/​ci-integration.yml Enables Tier 2 reuse by merge trains.
.github/​instructions/​cicd.instructions.md Updates deployed pipeline guidance.
.github/​actions/​lint-chain/​action.yml Centralizes lint checks for CI and merge trains.
.apm/​instructions/​cicd.instructions.md Updates the source pipeline guidance.

Review effort: Balanced

# Conflicts:
#	apm.lock.yaml
#	tests/quality/test_ci_topology.py
Main went red twice in the Integration suite, which ran on merge_group and dispatch only. main-push-gate.yml now also calls ci-integration.yml (every shard, secrets: inherit) as tier2, and the aggregate reads its result. ci-integration.yml adds no default-branch cache save on push: setup-uv saves only on pull_request and merge_group, setup-node caching is off, and the APM fetch cache is restored, then saved on no push. The topology tests pin coverage and the no-save rule, with mutation cases.

Co-authored-by: Copilot App <[email protected]>
…atch

# Conflicts:
#	.apm/instructions/cicd.instructions.md
#	.github/instructions/cicd.instructions.md
#	apm.lock.yaml
…atch

# Conflicts:
#	.apm/instructions/cicd.instructions.md
#	.github/instructions/cicd.instructions.md
#	apm.lock.yaml
@danielmeppiel
Daniel Meppiel (danielmeppiel) merged commit 488a4b1 into main Nov 21, 2026
49 checks passed
@danielmeppiel
Daniel Meppiel (danielmeppiel) deleted the p-s28-main-watch branch November 21, 2026 20:56
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.

2 participants