Skip to content

ci(owner-surface): run the integration slice an owner or install change can reach on every PR - #4627

Merged
Daniel Meppiel (danielmeppiel) merged 5 commits into
mainfrom
p-owner-surface-check
Nov 21, 2026
Merged

Daniel Meppiel (danielmeppiel) merged 5 commits into
mainfrom
p-owner-surface-check

Conversation

@danielmeppiel

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

Copy link
Copy Markdown
Collaborator

Description

Adds Owner Surface Check, a cheap PR check that runs only the slice of the merge-time integration suite an owner or install-path change can reach. Today both main reds (the lockfile-read owner test after #4067, the codex bundle e2e after #4007) lived in integration shards that run only on merge_group or dispatch, so the PRs that caused them never ran those tests.

  • .github/workflows/owner-surface.yml runs on pull_request and merge_group with no paths: filter, so it always reports:
    • select plans the slice;
    • slice runs in 3 shards, only when the select job sets run=true;
    • Owner Surface Check is an always() aggregate. It passes when the slice is skipped or green, and fails when the select job fails or the slice is red, cancelled or missing.
  • scripts/owner_surface.py:
    • plan is stdlib only: it writes the changed paths and decides run;
    • run builds the selection keys and runs pytest with the module as a deselection plugin. The plugin also splits the slice into 3 shards with scripts.ci_sharding.partition; a slice too small to split runs whole on shard 1, and empty shards pass.

Trigger (owner surfaces):

  • src/apm_cli/install/* and src/apm_cli/deps/lockfile*;
  • .apm/architecture/* and scripts/architecture_linter/*;
  • tests/integration/test_architecture_*.py and tests/integration/test_install_*.py;
  • every file an owner registry selector names (.apm/architecture/owners/*.json);
  • the check's own files.

Selection keys:

  • changed .py paths and their apm_cli.* module names;
  • owners that select a changed file, or whose registry entry changed against the base;
  • those owners' guard ids;
  • the rule ids that own those guards or whose check module changed.

Slice:

  • owner-rule mutation cases (test_architecture_owner_rule_mutations.py) whose parameters name a key;
  • that file's structural tests (no rule run), and its rule-running tests that name a key;
  • test_architecture_*.py files whose text names a key;
  • every test_install_*.py file for install-path changes;
  • any changed test file in those groups, whole.

Only the hermetic marker expression runs, with no secrets. The full integration suite stays once per train head (merge_group, or merge-train refs after #4582).

The check is advisory: it is not in EXPECTED_CHECKS and not in the ruleset. Making it required is a maintainer gate, prepared but not executed. Per cicd.instructions.md, the in-repo route is a merge-gate.yml EXPECTED_CHECKS edit; a ruleset 9294522 diff is prepared as the alternative.

Replay evidence (CI durations seed .github/ci-durations/linux-x86_64.json)

PR replayed Changed files Items selected Est. CPU Est. wall per shard (3 shards, -n 4) Catches the main red
#4067 (owner selector change) 11 656 1227 s about 2 min yes: test_architecture_pack_lockfile_read.py (owner read-only-lockfile-path)
#4007 (install path) 25 1138 3351 s about 4.6 min (shards 1188/1166/996 s) yes: test_install_local_bundle_e2e.py

Shards are disjoint, and their union equals the slice (verified with --collect-only per shard; #4007: 1209/1155/987 s). This PR's own slice is 3 tests on shard 1. With setup, wall clock is about 7 min.

Issue and approved scope

Issue: Fixes #4625 (Refs #4117, the broader coverage-map slice, which stays open)

Human scope-approval comment: requested through Intake (record_req #4625); pending.

Does this PR complete the issue, or what remains? It completes #4625. Making the check required is a separate maintainer gate.

Type of change

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

Testing

  • Tested locally
  • All existing tests pass
  • Added tests for new functionality (if applicable)

Commands (local, shared host guard):

  • pytest tests/unit/scripts/test_owner_surface.py: 33 passed.
  • pytest tests/unit/test_workflow_actor_contract.py tests/integration/test_triage_advisory.py tests/unit/scripts/test_owner_surface.py: 73 passed.
  • pytest tests/quality/test_ci_topology.py tests/unit/test_shared_apm_workflow_contract.py tests/unit/test_guardrailing_hero_topology.py tests/unit/test_devcontainer_feature_retired.py tests/unit/test_push_ci_gates.py tests/unit/scripts/test_architecture_runner.py: 520 passed. 2 failed and 6 errored, all in collection tests that subprocess the shared local venv (it imports another worktree's apm_cli); they do not involve this change.
  • ruff check / ruff format --check (0.15.12), check_complexity_ratchet.py --base-ref main, python -m tests.quality.taxonomy --changed: clean.
  • Replay: python -m scripts.owner_surface run --base <M>^1 --changed <file> -- --collect-only at the merge commits of [0.38] fix(policy): required-package checks read explicit proxy-URL lock rows (#4037) #4067 and [0.38] feat(install): render bundle agents to Codex TOML at install (#3714) #4007 (table above).

Changelog

  • One line in one section under ## [Unreleased] in CHANGELOG.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.
  • N/A -- internal-only change (CI, tests, refactor).

Spec conformance (OpenAPM v0.1)

N/A: no req-XXX behaviour changes.

…ge can reach on every PR (#4625)

Owner Surface Check (owner-surface.yml) triggers on owner surfaces and runs only the hermetic integration slice the change can reach, selected by scripts/owner_surface.py: owner-rule mutation cases and test_architecture_* files naming a changed file or an affected owner, guard or rule, plus test_install_* for install-path changes. It runs in 3 duration-balanced shards. One always() aggregate reports a stable check: it passes on a skipped slice and on merge_group. The check is advisory; making it required is a maintainer gate.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

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.

🟡 Changes recommended

The test-selection logic omits changed install tests, affected rule cases, and removed-guard coverage, allowing checks to miss relevant regressions.

3 open issues
What changed in this PR

Adds an advisory PR-time integration check to catch owner and install-path regressions earlier, complementing the full merge-time suite and addressing the coverage gaps behind #4067 and #4007.

Changes:

  • Adds an always-reporting Owner Surface Check with three conditional test shards.
  • Introduces selection based on changed paths, owner registries, guards and rules.
  • Adds selection and workflow tests, documents the check, and updates deployed instruction hashes.
File Description
tests/​unit/​scripts/​test_owner_surface.py Tests triggers, selection, deselection and aggregate results.
scripts/​owner_surface.py Plans the integration slice and filters pytest items.
docs/​src/​content/​docs/​contributing/​integration-testing.md Documents the advisory check and local usage.
apm.lock.yaml Updates hashes for deployed CI instructions.
.github/​workflows/​owner-surface.yml Adds planning, three test shards and the aggregate check.
.github/​instructions/​cicd.instructions.md Updates deployed workflow guidance.
.apm/​instructions/​cicd.instructions.md Updates canonical workflow guidance.

Review effort: Balanced

Comment thread scripts/owner_surface.py Resolved
Comment thread scripts/owner_surface.py Resolved
Comment thread scripts/owner_surface.py Resolved
…annot crash xdist (#4625)

scripts.ci_sharding refuses empty shards, and on xdist workers that UsageError crashed the run. owner_surface now splits the slice into as many nonempty group-preserving shards as it allows (at most 3); surplus shards run nothing and pass.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…es and body-named rules (#4625)

Review fixes: guards come from both registry revisions, so a removed or replaced guard still selects the tests naming it; a changed test_architecture_* or test_install_* file is always collected; a parametrized rule test is kept when its params, its body or a module string constant it references (e.g. _VR_RULE) names a key.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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.

[FEATURE] ci: a cheap Owner Surface Check on PRs that runs the integration slice an owner or install change can reach

2 participants