Repository navigation
ci: make the merge queue the live merge-time gate (#4116) - #4149
Merged
Daniel Meppiel (danielmeppiel) merged 16 commits intoNov 20, 2026
Merged
Conversation
- ci-integration.yml: build-release planner (scripts/ci_sharding.py, up to 8 shards) for hermetic integration, a retrying network lane, release validation in parallel, and a workflow_dispatch rehearsal trigger. - merge-gate.yml / ci.yml: correct the comments that describe the gate; ci.yml Coverage Combine stays the global 80% floor, required on merge_group. - tests/quality/test_ci_topology.py: every merge_group EXPECTED_CHECKS name has exactly one merge_group producer; planner, trigger, floor and freshness guards with mutation tests. - merge-queue-freshness.yml + scripts/merge_queue_freshness.py: daily alarm that fails when main moves without a merge_group run in 3 days. - Owner ci-validation-topology with guards contracts-tooling-ci-merge-time-topology and contracts-tooling-ci-merge-queue-freshness, mutation cases, frozen ids. - Ledger row #4116 (PERF-H1, PERF-H9); docs; changelog. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Daniel Meppiel (danielmeppiel)
requested a review
from Sergio Sisternes (sergio-sisternes-epam)
as a code owner
November 20, 2026 08:48
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Critical gaps allow an always-false required producer to pass topology validation and skipped checks to pass the runtime gate, while architecture contract failures can leave the required gate successful because their aggregate is not required.
2 open issues
What changed in this PR
Updates APM’s in-repository merge-time validation for #4116. Repository ruleset enforcement remains a separate maintainer action.
Changes:
- Uses duration-planned integration shards, a retrying network lane, parallel release validation, and manual rehearsal runs.
- Adds a daily alarm for activity on
mainwithout recent merge-queue validation. - Adds topology guards and regression coverage, and clarifies the existing coverage-floor authority.
| File | Description |
|---|---|
tests/unit/scripts/test_merge_queue_freshness.py |
Tests freshness decisions and diagnostic output. |
tests/unit/scripts/test_architecture_runner.py |
Registers two new frozen rule identifiers. |
tests/quality/test_ci_topology.py |
Adds merge-time topology and freshness contracts. |
tests/integration/test_architecture_owner_rule_mutations.py |
Adds mutation cases for both guards. |
tests/fixtures/lifecycle_bug_ledger.json |
Records #4116 and its regression checks. |
scripts/merge_queue_freshness.py |
Evaluates queue activity and reports stale validation. |
scripts/architecture_linter/groups/contracts_tests.py |
Includes the new topology rules. |
scripts/architecture_linter/checks/contracts_ci_topology.py |
Adds structural topology and freshness guards. |
docs/src/content/docs/contributing/integration-testing.md |
Documents integration lanes and coverage enforcement. |
CHANGELOG.md |
Records the CI changes. |
apm.lock.yaml |
Refreshes deployed CI instruction hashes. |
.github/workflows/merge-queue-freshness.yml |
Schedules and exposes the freshness alarm. |
.github/workflows/merge-gate.yml |
Updates comments explaining checks and polling budget. |
.github/workflows/ci.yml |
Corrects comments about coverage authority and integration selection. |
.github/workflows/ci-integration.yml |
Adds planned shards, network retries, parallel validation, and dispatch. |
.github/instructions/cicd.instructions.md |
Updates deployed CI guidance. |
.apm/instructions/cicd.instructions.md |
Updates canonical CI guidance. |
.apm/architecture/owners/contracts-tooling.json |
Declares topology ownership and its guards. |
Review effort: Balanced
This was referenced Nov 20, 2026
… shards - ci-integration.yml: label-gated pull_request trigger on every job (from #4177); planner weights the in-process architecture suites 3x for --cov and plans up to 12 shards (target 300 s); shard cap 25 min. - merge-gate.yml: three-context EXPECTED_CHECKS; poll budget 80 min. - test_ci_topology.py and the merge-time-topology rule accept the label-gated pull_request trigger, still reject pull_request_target and push. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…gate additions) Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
4 of 10 tasks
Measured on dispatch 44719321796: --cov costs ~1.6x beyond the 3x architecture weighting, so 12 shards ran 24 min end to end. 16 shards target ~16-18 min. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…regate
- test_ci_topology: a producer counts only with no condition, always(), the full-integration label gate, or always() && (label gate); ${{ false }} and unknown conditions are rejected (mutation test).
- merge-gate.yml: 'Test Architecture Ratchets' is required at PR time (labeled and unlabeled) and on merge_group, so the tests/quality guards, including the merge-time topology checks, block the merge.
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
The steward keeps the wall-clock scaling ratio non-required (timing asserts flake). Test Architecture Ratchets now needs only test-architecture-contracts; Architecture Scaling (Linux) stays its own non-required check. test_ci_topology pins it, with negative controls for re-adding the scaling dependency or result and for requiring the scaling check. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…ic-robot # Conflicts: # tests/fixtures/lifecycle_bug_ledger.json
Co-authored-by: Copilot App <[email protected]>
# Conflicts: # tests/fixtures/lifecycle_bug_ledger.json
Daniel Meppiel (danielmeppiel)
deleted the
danielmeppiel-fantastic-robot
branch
November 20, 2026 14:31
4 of 14 tasks
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 20, 2026
Accept #4149's test consolidation; the consolidated copies carry #4143 wording (catalog sentences, stderr errors, #4184 local installed=0, null-logger adapter warnings). Ledger rebuilt as main's rows plus #4143's. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 20, 2026
… audit details on their header's stream Failed-check details follow their header to stderr, so two checks with the same detail no longer print it as consecutive duplicate stdout lines (I9). New tests assert through check/expect helpers; pure hint tests move to the unit module; the console test patches rich's Table, not the owner. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
2 of 9 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Description
The
mainruleset declares a merge queue, andci.yml,ci-integration.ymlandmerge-gate.ymldescribemerge_groupas the merge-time gate: full integration, binary build, release validation and the global 80% coverage floor. In practice nomerge_grouprun has happened since 2026-09-09 (last run). Nothing failed, so regressions outside lifecycle smoke surfaced only in the 04:00 UTC nightly, and the coverage floor gated no merge.This PR does the in-repo side. A maintainer applies the ruleset change after it lands green (remove the admin bypass,
merge_method: MERGE).ci-integration.yml:scripts/ci_sharding.py, nightly durations or the committed seed). It replaces the fixed--splits 4layout. Those durations are measured without--cov, and coverage slows the in-processtests/integration/test_architecture*suites about 3x, so their weights are tripled before planning (merge-queue.json,--shard-target-seconds 300 --shard-max 16, which gives 16 shards).build-release.yml. Both lanes reuse the build-releaseHERMETIC_MARK_EXPR/NETWORK_MARK_EXPRpartition.workflow_dispatchand thefull-integrationPR label came from ci: allow manual dispatch of full integration #4177, merged here. Every job is label-gated, andpull_request_target/pushstay forbidden by the topology guard and the architecture rule.merge-gate.yml: themerge_groupEXPECTED_CHECKSnames are unchanged. A guard now proves each one is produced by exactly onemerge_groupjob. The comments now describe the real gate, the guard and the new poll budget.ci.yml: corrects four comments that saidci-integration.ymlenforces the 80% floor.Coverage Combine (Linux)is the floor authority, andmerge-gate.ymlrequires it onmerge_group.merge-queue-freshness.yml+scripts/merge_queue_freshness.py: a daily alarm (05:30 UTC, also dispatchable). It fails whenmainreceived commits but nomerge_grouprun ofci-integration.ymlcompleted in the last 3 days. The failure output names the lastmerge_grouprun (id, URL, date) and lists themainSHAs pushed since then. Againstmaintoday it fails and names run 34349326054, as intended. It turns green once the queue is enforced.ci-validation-topology(steward-approved) has two guards, each with its own MutationCase and frozen rule id:contracts-tooling-ci-merge-time-topologycontracts-tooling-ci-merge-queue-freshnesscicd.instructions.md,integration-testing.md) and one CHANGELOG line.Merge-time wall clock, measured:
Note:
live-marked integration tests (26) no longer run at merge time, matching the build-release.yml lanes.auth-acceptance.ymlowns live runs.Issue and approved scope
Issue: Fixes #4116
Human scope-approval comment: #4116 (comment)
Does this PR complete the issue, or what remains? The in-repo side is complete. What remains belongs to the issue's done-when: after the maintainer applies the ruleset change, the first landing through the queue must produce a green
merge_grouprun, and its link goes on #4116.Type of change
Testing
Red before (
main@ 27eb7b3, new guards only):uv run pytest tests/quality/test_ci_topology.py -k "merge_group or merge_time or merge_queue or global_coverage or pr_time"-> 7 failed, 15 passed, includingtest_merge_time_integration_uses_the_release_plannerandtest_merge_queue_freshness_alarm_is_scheduled.Green after (merged with
main@ 74a9dd6):uv run pytest -n 4 tests/quality/test_ci_topology.py tests/quality/test_lifecycle_bug_ledger.py tests/unit/scripts/test_merge_queue_freshness.py tests/unit/scripts/test_architecture_runner.py tests/unit/test_windows_compat_gate_workflow.py tests/unit/test_security_workflow_contracts.py tests/unit/test_push_ci_gates.py tests/unit/test_platform_contract_workflow.py tests/quality/test_test_taxonomy.py-> 468 passeduv run pytest tests/integration/test_architecture_owner_rule_mutations.py tests/unit/scripts/test_architecture_runner.py -k "ci-merge or ci_merge or matrix or inventory or registered or case_order"-> 26 passed (both new mutation cases are caught by their rule)ci.yml(ruff check, ruff format --check, complexity ratchet, pylint R0801,lint-auth-signals.sh,lint-architecture-boundaries.sh, file-length, relative_to): all passuv run apm audit --ci: 11/11 pass (deployedcicd.instructions.mdhash updated)REPOSITORY=microsoft/apm python3 scripts/merge_queue_freshness.py-> exit 1, names run 34349326054 and lists themainSHAs since then (expected while the queue is bypassed)--shard-target-seconds 420 --shard-workers 4 --shard-max 8on.github/ci-durations/linux-x86_64.json-> 8 shards x 1675 s serial (~7 min each at 4 workers)workflow_dispatch of
ci-integration.yml: the latest is https://github.com/microsoft/apm/actions/runs/44719321796 (12 shards). Planner, build, smoke, release validation, scaling guards and the network lane are green; the shards are red only on main regressions present without this PR (this PR has nosrc/changes), and those are routed to their owners. A green dispatch link goes here once main is green.Changelog
## [Unreleased]inCHANGELOG.md:user-visible effect first, 25 words or fewer, ending with
(#PR);breaking changes only under upgrade notes; no Highlights; see
.github/instructions/changelog.instructions.md.Spec conformance (OpenAPM v0.1)
docs/src/content/docs/specs/openapm-v0.1.mdupdated(new/changed
<a id="req-XXX"></a>anchor + prose + Appendix Crow).
docs/src/content/docs/specs/manifests/openapm-v0.1.requirements.ymlupdated.
@pytest.mark.req("req-XXX")test undertests/spec_conformance/added or extended.CONFORMANCE.{md,json}regenerated viauv run --extra dev python -m tests.spec_conformance.gen_statementand committed.