Skip to content

feat(policy): walk GitLab subgroups for org policy discovery (#2753) - #2933

Merged
Daniel Meppiel (danielmeppiel) merged 27 commits into
microsoft:mainfrom
rrazvd:feature/gitlab-subgroup-policy-discovery
Nov 12, 2026
Merged

Daniel Meppiel (danielmeppiel) merged 27 commits into
microsoft:mainfrom
rrazvd:feature/gitlab-subgroup-policy-discovery

Conversation

@rrazvd

@rrazvd Rafael Azevedo (rrazvd) commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Important

Semantics changed after maintainer rework (2026-11-12). The accepted scope for #2753 (apm-scope:v1 record) rules out closest-wins. This PR now composes every ancestor apm-policy with the tighten-only merge. The closest-wins description in the original text below is superseded; see "Maintainer rework" at the end.

TL;DR

GitLab org-policy auto-discovery only ever probed the top-level group (<top-level-group>/apm-policy), so a project nested under subgroups could not enforce its own governance without changing the whole organization. This PR walks the GitLab subgroup tree from the project's own group up to the top-level group and applies the closest apm-policy (closest wins), and lets extends: compose across nested namespaces. Flat <group>/<project> remotes are unchanged. Closes #2753.

Problem (WHY)

For a project at gitlab.com/acme/dept-a/team-x/my-project, discovery resolved only acme/apm-policy and discarded every intermediate subgroup:

Root cause: _parse_remote_url returned only path_parts[0] as the org, and _auto_discover passed that single org to the GitLab fetch — the full namespace was never derived.

Approach (WHAT)

Decision Choice
Leaf selection Walk namespaces deepest → top-level; first non-absent wins (closest)
No policy at a level absent (404) ascends to the parent group
Closer policy the token can't read GitLab 404s a private project the same as a missing one, so a denied closer apm-policy is skipped in favour of the next ancestor (404 == no policy, like GitHub/ADO) — a platform limitation, documented (grant the token read access).
Error / malformed / 403 Fail closed immediately — never coerced into "no policy"
Composition Opt-in via existing extends:; now accepts nested-namespace refs
Flat / personal namespace Probes only <group>/apm-policy — identical to prior behavior
Remote parsing Extracted to a dedicated policy/_remote.py owner (no split authority; architecture-guard enforced)

Implementation (HOW)

File Change
src/apm_cli/policy/_remote.py (new) The git-remote identity family, extracted from discovery.py (which grew past the 2100-line file-length ratchet): _git_remote_origin_url (single git remote get-url origin owner), _remote_url_parts (single host+segments splitter), _parse_remote_url (refactored to consume the splitter — behavior-preserving for GitHub/GHE/ADO/visualstudio), plus _extract_org_host_port_from_git_remote / _extract_org_from_git_remote. discovery.py re-exports them, so call sites/tests are unchanged.
src/apm_cli/policy/discovery.py New _gitlab_namespace_descending (deepest→top namespaces from the origin remote) and _gitlab_walk_candidate (the walk: first non-absent wins, absent ascends). Reads origin once and reuses it for identity + the walk.
src/apm_cli/policy/discovery.py (_extract_extends_host) Leaf-aware pre-fetch host-pin guard: a bare single-label first segment is a namespace only on GitLab leaves (acme/dept-a/apm-policy); on GitHub/ADO leaves it is still parsed as a (cross-)host, so extends: "evil/org/repo" remains rejected (Security Finding F1 preserved).
src/apm_cli/policy/_gitlab.py _fetch_gitlab_chain_parent accepts nested-namespace extends: refs (namespace = parts[:-1], repo = parts[-1]) after an optional leaf-host-prefix strip.
scripts/architecture_linter/checks/install_policy_gitlab_and_bundle.py, install_policy_intent.py, .apm/architecture/owners/install-deployment.json Add a static delegation guard (install-deployment-policy-remote-origin-owner), bound to a dedicated _remote.py owner-registry record: only _remote.py may read git remote get-url origin or define the remote-URL splitter/parsers. Also re-point the existing gitlab-facade-orchestration guard at _gitlab_walk_candidate.
tests New test_discovery.py coverage for the walk, nested extends:, and F1; an owner-guard mutation-break case in test_architecture_owner_rule_mutations.py and the frozen-inventory entry in test_architecture_runner.py for the new guard.
docs + CHANGELOG.md Updated apm-policy.md, governance-guide.md, policy-reference.md, apm-usage/governance.md; added the Unreleased changelog entry.

Note

The GitLab REST transport and AuthResolver auth already URL-encode a full multi-segment project_path, so no transport/auth changes were needed — org="acme/dept-a" was already fetchable.

Diagram

The GitLab branch of _auto_discover: each namespace level is probed closest-first; only a clean absent ascends, every other outcome returns immediately.

flowchart TD
    A[origin remote] --> B[_gitlab_namespace_descending]
    B --> C["deepest: acme/dept-a/team-x"]
    C -->|found / error| R[return result]
    C -->|absent| D["acme/dept-a"]
    D -->|found / error| R
    D -->|absent| E["acme (top-level)"]
    E -->|found / error| R
    E -->|absent| Z[outcome = absent, clean no-op]
Loading

Trade-offs

  • Up to N REST probes when no policy exists (N = subgroup depth). The common no-governance case costs a few extra REST calls; the walk short-circuits on the first hit, and logging stays at debug so --verbose is not spammed. Absent REST results are served from the existing per-namespace policy cache on warm runs; caching the absent REST outcome itself is a possible follow-up, out of scope. (The concealment Git probe, a separate path, is cached — see below.)
  • GitLab conceals private projects with 404. A closer apm-policy the token cannot read is indistinguishable from a missing one, so it is skipped in favour of the next ancestor — the same 404 == no policy behaviour GitHub/ADO discovery already have. An earlier revision tried to detect this via an authenticated git ls-remote probe; it was removed after review as scope creep (it caught only a narrow case, could not be soundly cached, and false-positived on an apm-policy project containing only a README). Mitigation: grant the CI token read access to every apm-policy it should honour.
  • Closest-wins is not tighten-only at the discovery layer. Anyone who can create an apm-policy project in an intermediate subgroup can publish a weaker policy that shadows a stricter ancestor for projects under it (only extends: chains enforce tighten-only). This is intrinsic to team-scoped governance; the mitigation (restrict apm-policy project creation via GitLab RBAC) is documented in the governance guide's sharp-edges list.
  • extends: "org" resolves to the top-level group, not the nearest ancestor — kept consistent with GitHub/ADO semantics and documented explicitly, rather than silently redefining the shorthand per host.
  • Nested-namespace vs cross-host ambiguity in extends: refs is resolved by an FQDN heuristic (a host has a . or :port); a GitLab group whose name literally contains a dot would fail closed (rejected). This is safe and rare, and the docs prescribe the host-qualified spelling (gitlab.com/acme.tools/..., with host:port when the origin uses a port) as the workaround.

Benefits

  1. A team under any subgroup depth can own its apm-policy without touching org-wide governance.
  2. A top-level acme/apm-policy still applies to every project with no closer policy — zero migration for existing setups.
  3. Cross-level composition works via extends: (including nested-namespace parents).
  4. Remote-URL splitting and the git-remote subprocess each now have a single canonical owner (architecture-rule aligned).

Validation

All CI-mirror gates pass locally on the merge base.

Lint, duplication, tests, architecture, conformance
$ uv run --extra dev ruff check src/ tests/            -> All checks passed!
$ uv run --extra dev ruff format --check src/ tests/   -> 1768 files already formatted
$ uv run --extra dev python -m pylint --disable=all --enable=R0801 \
    --min-similarity-lines=10 --fail-on=R0801 src/apm_cli/  -> 10.00/10
$ uv run python -m pytest tests/unit/policy tests/spec_conformance/test_policy_reqs.py
    -> 1246 passed, 1 xfailed
$ uv run python -m pytest tests/unit/install -k "policy or preflight or discover"
    -> 323 passed
$ uv run python -m pytest tests/integration/test_architecture_semantic_rule_mutations.py
    -> 148 passed
$ uv run python -m pytest tests/unit/scripts/test_architecture_runner.py
    -> 72 passed
$ bash scripts/lint-architecture-boundaries.sh          -> exit 0

Scenario evidence

User-promise scenario Proven by APM principle
Closest subgroup policy wins test_gitlab_subgroup_closest_wins Governance is scoped, not all-or-nothing
Absent level ascends to parent test_gitlab_subgroup_absent_ascends_to_parent Deterministic discovery order
No policy anywhere → clean absent test_gitlab_subgroup_all_absent_is_clean_absent Missing policy is not an error
Error fails closed (first and inner level) test_gitlab_subgroup_error_fails_closed, ..._error_at_inner_level_fails_closed Fail closed on ambiguity
Flat / personal namespace unchanged test_gitlab_flat_project_falls_back_to_top_level_org No regression
Nested extends: allowed, cross-host FQDN rejected TestValidateExtendsHostNestedNamespace Host-pin guard (F1) intact
_parse_remote_url refactor is behavior-preserving pre-existing TestParseRemoteUrl ADO/GHE/visualstudio cases Single-owner refactor, no behavior drift

Important

The nested-extends: host-pin fix was surfaced by the local apm-review-panel dogfood pass (supply-chain + auth personas, independently): the original tests exercised _fetch_chain_parent directly and bypassed _validate_extends_host, masking the reject. Regression tests now drive the real validation path.

How to test

  • Point a repo's origin at a nested GitLab remote (gitlab.com/acme/dept-a/team-x/my-project) and publish apm-policy.yml in acme/dept-a/apm-policy.
  • Run apm audit --ci (or apm install) and confirm the acme/dept-a policy is applied (closest wins), not the top-level one.
  • Remove that policy; confirm discovery falls through to acme/apm-policy.
  • Remove all policies; confirm a clean absent (no warning, no fetch-failure).
  • uv run python -m pytest tests/unit/policy/test_discovery.py.

Co-authored-by: Copilot [email protected]


Maintainer rework (W2 merge worker, 2026-11-12)

The contributor's closest-wins head (97767eb) was reworked on this branch to the accepted #2753 contract. The contributor's _remote.py single-owner extraction, its architecture guard, and nested extends: refs are kept.

Contract item Implementation Proven by
Compose company -> team; ancestors apply even when a closer policy omits extends: _gitlab._fetch_gitlab_ancestry probes every namespace; the existing chain owner _resolve_and_persist_chain merges root-first with resolve_policy_chain test_gitlab_ancestry_composition.py; installed-CLI test_install_and_audit_enforce_the_composed_ancestry[*]
Team-only works; none found keeps no-policy handling nearest discovered policy is the leaf; all-404 is a clean absent team-only, test_no_policy_in_any_namespace_is_clean_absence
Non-404 failure never applies a weaker partial chain, even under warn failure with another discovered level -> incomplete_chain; a complete cached chain follows stale-cache rules test_ancestor_failure_never_applies_a_weaker_partial_chain[403/500]
Leaf-only policy.hash, no silent repin the pin is checked only until the first non-404 level test_pin_follows_the_nearest_policy_and_never_silently_repins
Duplicate ancestors, cycles, five-policy limit parent refs are resolved via _gitlab_parent_coordinates; duplicates are reused without a second fetch, cycles raise, and depth counts the composed chain unit composition tests; extends-plus-ancestry e2e case
Cache-only / offline a dedicated #ancestry cache key; cache-only serves only the complete composed chain test_cache_only_*, test_cached_composition_enforces_offline
Install and audit agree; ordered redacted chain install Policy: <leaf> (extends chain: ...), audit JSON/SARIF policy.chain, apm policy status extends chain installed-CLI tests

Validation at this head: unit policy suites (1356 passed), installed-CLI GitLab lifecycle (12 passed against the installed apm binary over a loopback HTTPS gitlab.com fixture), owner-rule mutations (573 passed), semantic-rule mutations + runner (214 passed), lint-architecture-boundaries.sh exit 0, ruff check/format, pylint R0801 and auth-signal lint clean. Seven mutation-break gates each killed their mutant.

Closes #2753

…icrosoft#2753)

GitLab org-policy discovery previously probed only the top-level group
(`<top-level-group>/apm-policy`), so a project under nested subgroups
could not scope its own governance without changing the whole org.

Walk the subgroup tree from the project's own group up to the top-level
group and apply the closest `apm-policy` (closest wins); `absent` at an
inner level ascends to the parent group, while any error/malformed
outcome still fails closed. A flat `<group>/<project>` remote is
unchanged. `extends:` now accepts nested-namespace references
(`acme/dept-a/apm-policy`), and the pre-fetch host-pin guard no longer
misreads a bare nested namespace's first segment as a cross-host FQDN
(a real attacker FQDN is still rejected).

Remote-URL splitting is centralized in a single `_remote_url_parts`
owner (consumed by both `_parse_remote_url` and the new
`_gitlab_namespace_descending`), and the `git remote get-url origin`
subprocess in a single `_git_remote_origin_url` owner.

Co-Authored-By: Claude Opus 4.8 <[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.

🟡 Changes recommended

Unresolved critical host-pin and moderate GitLab discovery findings block approval.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds subgroup-aware GitLab policy discovery, selecting the closest policy and supporting nested extends: references.

Changes:

  • Walks GitLab namespaces from deepest subgroup to top-level.
  • Updates nested inheritance parsing and host validation.
  • Adds tests, conformance updates, documentation, and changelog entries.
File summaries
File Summary
tests/unit/policy/test_discovery.py Adds subgroup discovery and inheritance tests.
tests/spec_conformance/test_policy_reqs.py Adds conformance coverage.
src/apm_cli/policy/discovery.py Implements namespace walking and shared remote parsing. Critical (1 vote): single-label host prefixes can bypass the host-pin guard for non-GitLab leaves. Moderate (3 votes): origin is read twice during GitLab discovery.
src/apm_cli/policy/_gitlab.py Supports nested GitLab policy references. Moderate (1 vote): mismatched host-like prefixes and malformed ports are not safely rejected.
packages/apm-guide/.apm/skills/apm-usage/governance.md Updates usage guidance. Nit (1 vote): publishing checklist still describes top-level-only policies.
docs/src/content/docs/enterprise/policy-reference.md Updates policy reference behavior.
docs/src/content/docs/enterprise/governance-guide.md Updates governance guidance.
docs/src/content/docs/enterprise/apm-policy.md Documents subgroup policy resolution.
CONFORMANCE.md Updates generated conformance count.
CONFORMANCE.json Updates generated conformance mapping.
CHANGELOG.md Adds the feature entry.
Review details

Suppressed comments (2)

packages/apm-guide/.apm/skills/apm-usage/governance.md:431

  • The packaged usage guide still has a publishing checklist at governance.md:681-682 that says GitLab policy belongs under the top-level group only. With the subgroup walk described here, that omits the primary team-scoped deployment and leaves this user-facing guide incomplete; update the checklist to mention any ancestor namespace and closest-wins behavior.
to inherit it. A flat `<group>/<project>` remote probes only `<group>/apm-policy`.

src/apm_cli/policy/_gitlab.py:155

  • For nested host-qualified refs, this branch now reaches explicit.port for any 3+ segment ref. On a non-default-port leaf, gitlab.example.test/acme/... passes hostname-only validation but is not stripped and is then fetched as namespace gitlab.example.test/acme/...; a malformed port such as gitlab.example.test:not-a-port/... instead raises ValueError because only urlsplit is caught. Treat host-like first segments whose host/port does not exactly match the leaf as invalid (and safely catch port parsing) rather than falling through.
                and explicit.port == port
            ):
                parts = parts[1:]
  • Files reviewed: 11/11 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/apm_cli/policy/discovery.py Resolved
Comment thread src/apm_cli/policy/discovery.py Resolved
- host-pin (F1): scope the "single-label first segment is a namespace"
  relaxation to GitLab leaves only. On GitHub/ADO leaves a 3-segment ref
  is host/owner/repo, so `extends: "evil/org/repo"` is again rejected as
  cross-host instead of routing a credential to `evil`.
- GitLab extends: a host-like first segment must match the leaf host+port
  exactly or the ref is rejected (never folded into the namespace); a
  malformed port now fails closed instead of raising ValueError.
- discovery: read `git remote get-url origin` once and reuse it for both
  identity and the namespace walk (`_gitlab_namespace_descending` takes the
  URL), removing the double subprocess and the TOCTOU on a changing remote.
- docs: publishing checklist now says GitLab policy may live under any
  ancestor namespace (closest wins), not the top-level group only.
- tests: cover GitHub-leaf cross-host rejection, port-mismatch and
  malformed-port rejection, and the pure namespace helper.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@rrazvd

Copy link
Copy Markdown
Contributor Author

Thanks for the review — addressed all four findings in e9cf62ef4.

🔴 Critical — host-pin bypass for single-label prefixes (discovery.py)
Correct catch: my _extract_extends_host relaxation was too broad. It's now leaf-aware — a bare single-label first segment is treated as a namespace only when the leaf is GitLab (where nested subgroups make acme/dept-a/apm-policy valid). On GitHub/ADO leaves a 3-segment ref is host/owner/repo, so extends: "evil/org/.github" is again parsed as a cross-host ref and rejected (F1 preserved). Regression tests added: test_single_label_first_segment_stays_a_host_on_github_leaf, test_validate_rejects_single_label_cross_host_on_github_leaf.

🟠 Moderate — host-like prefix / malformed port (_gitlab.py)
A host-like first segment (FQDN or host:port) must now match the leaf host and port exactly; otherwise the ref is rejected as invalid instead of being folded into the namespace. Port parsing is inside the try, so a malformed port (gitlab.example.test:not-a-port/...) fails closed instead of raising ValueError. Tests: test_gitlab_parent_rejects_host_prefix_with_mismatched_port, test_gitlab_parent_rejects_malformed_port_without_crashing.

🟠 Moderate — origin read twice (discovery.py)
_auto_discover now reads git remote get-url origin once and reuses it for both identity and the namespace walk — _gitlab_namespace_descending takes the already-read URL, and _extract_org_host_port_from_git_remote accepts it via a sentinel so it never re-reads. Removes the double subprocess and the TOCTOU on a changing remote. The single-subprocess contract test (tests/unit/policy/test_discovery.py, ADO) still passes.

⚪ Nit — publishing checklist (governance.md)
Updated to say GitLab policy may live under any ancestor namespace (closest wins), not the top-level group only.

Local gates green: ruff check/format, pylint R0801 10/10, tests/unit/policy + tests/spec_conformance/test_policy_reqs.py (1247 passed), tests/unit/install -k "policy or preflight or discover" (323 passed), scripts/lint-architecture-boundaries.sh (exit 0).

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 canonical-owner guard is incomplete, conformance coverage is misclassified, and dotted GitLab namespace guidance is missing.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details

Suppressed comments (1)

Previously missed (1) — in code that hasn't changed since the last review.

tests/spec_conformance/test_policy_reqs.py:150

  • This marker overstates conformance coverage. req-pl-011 requires a registered, ordered provider list and per-project provider selection; this test only checks the implementation-specific namespace order inside one GitLab provider, which is already covered by the unit test. Remove this requirement marker/test from the conformance suite and regenerate CONFORMANCE.*, or replace it with an assertion that exercises the normative provider-registration contract.
  • Files reviewed: 11/11 changed files
  • Comments generated: 2
  • Review effort level: Balanced

Comment thread src/apm_cli/policy/discovery.py Resolved
- architecture: add a registered static delegation guard
  (install-deployment-policy-remote-origin-owner) enforcing that only
  discovery.py reads `git remote get-url origin` and defines the
  remote-URL splitter/parsers; no other policy-tree module may re-read or
  re-parse the remote. Backs the single-owner claim the refactor makes.
- docs: document that a bare nested `extends:` ref whose first segment
  contains a dot (group named e.g. `acme.tools`) must be host-qualified,
  since a dotted first segment is read as a host.
- conformance: drop the req-pl-011 test that only re-asserted the GitLab
  provider's namespace order. Per req-pl-011 that order is
  implementation-defined, so it is not a normative conformance property;
  the unit suite already covers it. Regenerated CONFORMANCE.*.

apm-spec-waiver: GitLab subgroup walk refines the existing req-pl-011 discovery provider (intra-provider search order is implementation-defined per spec 6.1.1); no new normative requirement, so no new anchor/manifest row/marker.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@rrazvd

Copy link
Copy Markdown
Contributor Author

Addressed the second review in 7ae2ce674.

Canonical-owner guard (incomplete) — discovery.py
Added a registered static delegation guard, install-deployment-policy-remote-origin-owner (in install_policy_gitlab_and_bundle.py, wired via install_policy_intent.EXTRA_RULES). It forbids any policy-tree module other than discovery.py from reading git remote get-url origin or defining the remote-URL splitter/parsers (_remote_url_parts, _parse_remote_url, _git_remote_origin_url), so a future caller cannot reintroduce the double-read/divergent-parse. Verified it has teeth (a planted violation in another policy file is flagged; removing it returns the linter to green). This mirrors the existing install-deployment-gitlab-policy-adapter guard, which likewise ships without a standalone owner-inventory record: discovery.py already has exactly one owner record (cached-policy-shape in contracts-tooling.json) and the registry rejects both a second record selecting the same file and a cross-group guard reference, so the guard is the enforcement mechanism here.

Dotted GitLab namespace guidance (missing) — apm-policy.md
Added a note: a bare nested extends: ref whose first segment contains a dot (group named e.g. acme.tools) is read as a host and rejected; users must spell it host-qualified (extends: "gitlab.com/acme.tools/team/apm-policy").

Conformance coverage misclassified — test_policy_reqs.py
Agreed — removed the req-pl-011 test that only re-asserted the GitLab provider's namespace order. Per req-pl-011 §6.1.1 that order is implementation-defined, so it isn't a normative conformance property, and the unit suite already covers it. Regenerated CONFORMANCE.* (req-pl-011 back to 2). The policy-tree change is covered under Mode B by an apm-spec-waiver: trailer (the walk refines the existing req-pl-011 provider; no new normative requirement) — the detector reports WAIVED.

Local gates: ruff check/format (src/tests) clean, scripts/lint-architecture-boundaries.sh exit 0, Mode B detector exit 0 (WAIVED), tests/unit/policy + tests/spec_conformance green (the one unrelated copilot_plugins failure is pre-existing on main).

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

Architecture mutation checks will fail or pass vacuously, and policy documentation remains internally inconsistent.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 10/10 changed files
  • Comments generated: 4
  • Review effort level: Balanced

Comment thread src/apm_cli/policy/discovery.py Resolved
- gitlab-facade-orchestration guard: the branch was renamed to
  `elif is_gitlab:` and the adapter call moved into
  `_gitlab_walk_candidate`, so the check scanned a stale `elif
  is_gitlab_hostname(host):` region and passed vacuously (its mutation
  case no longer produced a violation). Scope the orchestration scan to
  `_gitlab_walk_candidate`'s body instead; mutation case fires again.
- policy-remote-origin-owner guard: give it teeth the mutation matrix can
  exercise -- require discovery.py to define all three canonical
  read/parse helpers -- and add its guard-less mutation case so the
  frozen matrix set-equality holds.
- docs: reconcile policy-reference.md's `extends` table and the
  Discovery-vs-extends note with GitLab nested refs + closest-subgroup
  discovery; document that a host-qualified GitLab `extends:` ref must
  carry the exact `host:port` authority when the origin uses a port.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@rrazvd

Copy link
Copy Markdown
Contributor Author

Addressed the third review in 0eebdf871.

Vacuous facade guard + failing mutation (discovery.py)
Correct — hoisting is_gitlab renamed the branch to elif is_gitlab: and moved the adapter call into _gitlab_walk_candidate, so check_gitlab_facade_orchestration scanned a stale elif is_gitlab_hostname(host): region and passed vacuously (its mutation case install-deployment-gitlab-facade-orchestration no longer produced a violation). The check now scopes its orchestration scan to _gitlab_walk_candidate's body. Verified: test_semantic_rule_catches_its_mutation[install-deployment-gitlab-facade-orchestration] passes again.

Guard-less rule without a mutation case (install_policy_intent.py)
Correct — the frozen matrix asserts exact set-equality with every guard-less rule. Gave install-deployment-policy-remote-origin-owner teeth the matrix can exercise (it now also requires discovery.py to define all three canonical read/parse helpers) and added its mutation case (def _git_remote_origin_url( -> _impl). test_matrix_covers_every_guardless_rule_exactly_once and the new case's catches_its_mutation both pass. I kept it as a guard-less semantic rule rather than an owner-registry record because discovery.py already has exactly one owner record (cached-policy-shape) and the registry rejects a second record selecting the same file — this mirrors the sibling install-deployment-gitlab-policy-adapter/-facade guards.

policy-reference.md internal inconsistency
Updated the extends value table (added the GitLab namespace/.../repo ancestor form and the top-level-group meaning of org) and the Discovery-vs-extends note (now states GitLab discovers the closest apm-policy up the subgroup tree), so the page has one consistent contract.

Dotted-group workaround incomplete for explicit ports (apm-policy.md)
Documented that when the origin uses a port, the host-qualified extends: ref must carry the exact host:port authority (e.g. gitlab.example.com:8443/acme/team/apm-policy), since GITLAB_HOST is only the hostname and _fetch_gitlab_chain_parent requires host+port to match.

Local gates: ruff (src/tests) clean, scripts/lint-architecture-boundaries.sh exit 0, mutation matrix structural + the two affected cases green.

The frozen semantic-contract inventory in test_architecture_runner.py
(_EXPECTED_RULE_ID_TEXT) must list every registered rule id; add
install-deployment-policy-remote-origin-owner so the set-equality holds.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@rrazvd

Copy link
Copy Markdown
Contributor Author

Pre-emptive hardening in 7bcbc1854 (before requesting another review): ran the full architecture suite locally and caught one more gap the earlier per-case runs missed.

tests/unit/scripts/test_architecture_runner.py::test_registered_rule_inventory_matches_frozen_semantic_contract pins a frozen set of every registered rule id. The new install-deployment-policy-remote-origin-owner guard was missing from it, so this test would have failed in CI. Added it to _EXPECTED_RULE_ID_TEXT.

Full local runs now green:

  • tests/integration/test_architecture_semantic_rule_mutations.py — 148 passed
  • tests/unit/scripts/test_architecture_runner.py — 72 passed
  • registry / registry-conflicts / intent-guards / owner-rule-mutations / linter-entrypoint — all passed
  • ruff (src/tests), scripts/lint-architecture-boundaries.sh (exit 0)

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

The new canonical-owner rule is not registered and bound through the architecture owner registry.

Review details

Suppressed comments (1)

scripts/architecture_linter/checks/install_policy_intent.py:110

  • This new canonical-owner check is registered through _semantic_rule, which assigns guard_ids=(), and there is no matching owner record in .apm/architecture/owners/install-deployment.json. As a result, the owner registry cannot validate this guard bidirectionally or ensure it executes exactly once. Register the remote-origin decision in the owner registry and bind this rule to that guard ID rather than treating it as guard-less.
    _semantic_rule(
        RULE_REMOTE_ORIGIN_OWNER,
        "Policy discovery reads and parses the git remote through one owner (discovery.py).",
        check_policy_remote_origin_owner,
    ),
  • Files reviewed: 12/12 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

Copilot review: a canonical-owner rule should be an owner-guard bound to
an owner-registry record, not a guard-less semantic rule, so the registry
can validate it bidirectionally and enforce single execution.

- Register `install-deployment-policy-remote-origin-owner` with
  `guard_ids=(<id>,)` (a `Rule(...)`, not `_semantic_rule`), making it a
  known owner-guard that executes exactly once.
- Reference it from discovery.py's existing owner record
  (`cached-policy-shape` in contracts-tooling.json); discovery.py can hold
  only one owner record, and a guard's shard is independent of its id
  prefix, so the remote-origin decision joins that record's guard list.
- Move its mutation case from the guard-less matrix to the owner-guard
  matrix (test_architecture_owner_rule_mutations.py); both matrices'
  set-equality and the frozen inventory now hold.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@rrazvd

Copy link
Copy Markdown
Contributor Author

Addressed in fcacaa26e — bound the remote-origin guard to the owner registry as requested.

What changed

  • install-deployment-policy-remote-origin-owner is now a real owner-guard: registered with guard_ids=(<id>,) (a Rule(...), not _semantic_rule), so it is a known guard the registry validates bidirectionally and requires to execute exactly once.
  • It is referenced from discovery.py's existing owner record (cached-policy-shape in contracts-tooling.json). Note on the earlier back-and-forth: discovery.py can hold only one owner-registry record (selector uniqueness is global), and a guard's id-prefix is independent of the shard it's referenced from, so the remote-origin decision joins that record's guard list rather than getting a second record.
  • Moved its mutation-break case from the guard-less matrix to the owner-guard matrix (test_architecture_owner_rule_mutations.py).

Verification — full architecture suite green:

  • test_architecture_owner_rule_mutations.py + test_architecture_semantic_rule_mutations.py + test_architecture_runner.py + test_architecture_registry.py + test_architecture_registry_conflicts.py + test_architecture_intent_guards.py -> 603 passed
  • scripts/lint-architecture-boundaries.sh -> exit 0 (guard executes once, bound to its owner record)
  • The guard's mutation case fires (test_owner_rule_catches_its_guard_mutation[install-deployment-policy-remote-origin-owner]), and HEAD is clean.

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

Concealed GitLab 404s can select a weaker ancestor policy, and the ownership guard does not fully enforce single-reader delegation.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 13/13 changed files
  • Comments generated: 2
  • Review effort level: Balanced

Comment thread src/apm_cli/policy/discovery.py Resolved
…uard

Copilot review:

- Concealed-404 fail-open (discovery.py): GitLab returns 404 both for a
  missing project and for a private one the token cannot read, so the
  subgroup walk could silently apply a weaker ancestor policy over a
  closer team policy the token was denied. Before applying an ancestor
  over skipped closer levels, verify via authenticated Git
  (`_gitlab.first_concealed_closer_policy`) that no skipped closer
  `apm-policy` project exists; if one is confirmed, fail closed. The
  residual case (token blind to both REST and Git) is indistinguishable
  from genuinely absent and still ascends -- documented.
- Origin-read guard: the guard only required the three helper names to
  exist, so a second `git remote get-url origin` elsewhere in
  discovery.py would pass. Add an exact-count clause (one origin-read
  argv in the owner) and switch the owner-guard mutation to introduce a
  duplicate read, so the single-reader invariant is enforced and proven.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@sergio-sisternes-epam Sergio Sisternes (sergio-sisternes-epam) added triage/recommended Automated advice completed; not human scope approval. status/deferred Not invited for implementation now; no release commitment. theme/governance area/enterprise Air-gapped/GHE configurability, registry proxy, rulesets, adoption playbook. area/audit-policy apm-policy.yml schema, custom_checks, install-time enforcement. type/feature New capability, new flag, new primitive. labels Sep 17, 2026
…eppiel-w2-pr-2933

# Conflicts:
#	.apm/architecture/owners/install-deployment.json
#	tests/unit/policy/test_discovery.py
The accepted microsoft#2753 scope (apm-scope:v1, 2026-10-20) rejects closest-wins
replacement: a team policy may only tighten applicable ancestors. GitLab
discovery now probes apm-policy at every namespace of the project's
ancestry and the chain owner (_resolve_and_persist_chain) composes them
company-to-team with the existing tighten-only merger, so an ancestor
restriction survives a closer policy that omits extends. The nearest
discovered policy stays the policy.hash leaf; non-404 failures with any
discovered policy become incomplete_chain (fail closed under warn);
duplicate ancestors reuse one fetch without false cycles; the five-policy
limit counts the composed chain; a dedicated ancestry cache key backs
warm, stale and cache-only reads. Install, audit JSON/SARIF and policy
status expose the ordered redacted chain. The walk moves into the GitLab
adapter (_fetch_gitlab_ancestry) so discovery.py stays under the length
guard, and the facade guard again scans the elif is_gitlab_hostname
branch. Addresses Copilot inline on discovery.py (warn-mode partial
chain) and test_install_logger_policy.py (URL substring assertion).

apm-spec-waiver: GitLab discovery provider composes namespace ancestry through the existing tighten-only extends merge; req-pl-001/011/012 semantics unchanged

Co-authored-by: Rafael Azevedo <[email protected]>
Co-authored-by: Copilot App <[email protected]>
Replace the closest-wins description with the accepted contract: every
ancestor apm-policy combines top-down with tighten-only merging, the
nearest discovered policy is the policy.hash leaf (no silent repin),
non-404 failures fail closed, offline uses only the complete cached
chain, and GitLab's 404-for-unreadable limitation requires read access
across the namespace ancestry. Drop two stale microsoft#2706 CHANGELOG lines the
main merge resurrected under Unreleased.

Co-authored-by: Rafael Azevedo <[email protected]>
Co-authored-by: Copilot App <[email protected]>
Drive the installed apm binary against a loopback HTTPS gitlab.com
fixture: company-only, team-only, company plus team with a missing
intermediate, multiple subgroup levels, empty and weaker children keep
ancestor restrictions in both install and audit --ci; clean absence;
403/500 ancestor failures fail closed under warn; a new closer policy
never silently repins; a complete cached chain enforces without
contacting GitLab. The GitHub fixture's certificate minting now accepts
the served host list so both fixtures share it.

Co-authored-by: Rafael Azevedo <[email protected]>
Co-authored-by: Copilot App <[email protected]>
@danielmeppiel

Copy link
Copy Markdown
Collaborator

APM Review Panel: ship_with_followups

Community GitLab subgroup policy discovery now lands the accepted ancestor-composition contract (#2753) with fail-closed partial chains, leaf-only pinning, and installed-CLI regressions; seven lenses found no correctness or security regressions.

panel-mode=full; personas=python-architect,test-coverage-expert,doc-writer,cli-logging-expert,supply-chain-security-expert,auth-expert,performance-expert,apm-ceo

cc Rafael Azevedo (@rrazvd) Sergio Sisternes (@sergio-sisternes-epam) -- a fresh advisory pass is ready for your review.

The contributor's head (97767eb) implemented closest-wins selection, which the 2026-10-20 apm-scope:v1 approve record on #2753 explicitly put out of scope. This pass reviews the reworked head: GitLab discovery probes apm-policy at every namespace of the project's own host/port ancestry, and the existing chain owner composes company -> department -> team with the existing tighten-only merger, so an ancestor restriction survives a closer policy that is empty, weaker, or omits extends:. The contributor's _remote.py single-owner extraction, its architecture guard, and nested extends: refs are kept. All seven panelists recommend shipping with no blocking-severity findings; supply-chain and auth confirm fail-closed partial chains, leaf-only pin scoping, cache-only safety, and that credentials only route to the project's own host. The merge worker is folding every in-scope item below before the terminal pass; three scope-crossing items become follow-up issues.

Aligned with: Secure by default -- non-404 failures never apply a weaker partial chain, even under warn. Governed by policy -- install, audit, and apm policy status share one effective policy and its ordered, redacted source chain. Multi-host -- the GitLab adapter keeps host/port credential isolation with no GitHub/ADO side effects. OSS community driven -- the contributor's extraction and guard work survive the maintainer-guided rework.

Panel summary

Persona B R N Takeaway
Python Architect 0 0 2 Chain composition stays single-owner; the GitLab adapter boundary and _remote.py owner are respected.
Test Coverage Expert 0 0 1 Every scope-contract scenario has a regression trap (unit) and the CLI surfaces have installed-binary e2e coverage.
Doc Writer 0 2 1 Docs match the code; fix the Inheritance and pin notes in policy-reference and shorten the CHANGELOG line.
CLI Logging Expert 0 1 2 Chain rendering works; enforcement: off must stay silent at default verbosity.
Supply Chain Security Expert 0 0 2 Fail-closed invariants, pin scoping, and cache-only safety are sound.
Auth Expert 0 0 1 Credential isolation (F1) holds; cross-host refs are rejected before any credential fill.
Performance Expert 0 1 2 Requests are bounded and warm runs make zero requests; sequential probes are a follow-up.

B = blocking-severity findings, R = recommended, N = nits.
Counts are signal strength, not gates. The maintainer ships.

Top 5 follow-ups

  1. [Performance Expert] Parallelize GitLab namespace probes -- deep hierarchies pay one round trip per level on cold or stale runs; deferred as a new concurrency surface beyond the accepted bounded-fetch contract (follow-up issue).
  2. [Performance Expert] Negative caching for absent GitLab namespaces -- absent levels are re-probed on stale runs; a new cache record type is outside this PR's reuse of existing cache owners (follow-up issue).
  3. [CLI Logging Expert] Unify the provider-wide org: source-label convention -- touches GitHub and ADO output, beyond this GitLab scope (follow-up issue).
  4. [Supply Chain Security Expert] Document that policy.hash pins only the nearest policy -- ancestor additions, removals, or edits are enforced through refresh and the tighten-only merge, not pin-detected; being folded into the docs now.
  5. [Test Coverage Expert] Add an installed-CLI hierarchy that mixes extends: with discovered ancestors -- promotes the duplicate-ancestor guard to e2e; being folded now.

Architecture

classDiagram
    direction TB
    class PolicyFetchResult {
        <<Dataclass>>
        +policy: ApmPolicy or None
        +source: str
        +outcome: str
        +ancestry_parents: list~PolicyFetchResult~ or None
        +chain_sources: list~str~
        +subgroup_scoped: bool
    }
    class discovery {
        <<Module>>
        +discover_policy_with_chain()
        -_resolve_and_persist_chain()
        -_auto_discover()
        -_validate_extends_host()
    }
    class _gitlab {
        <<Adapter>>
        -_fetch_gitlab_ancestry()
        -_gitlab_parent_coordinates()
        -_gitlab_ancestry_cached_result()
        -_fetch_from_gitlab_repo()
        -_fetch_gitlab_chain_parent()
    }
    class _remote {
        <<SingleOwner>>
        -_git_remote_origin_url()
        -_remote_url_parts()
        -_parse_remote_url()
        -_extract_org_host_port_from_git_remote()
    }
    class inheritance {
        <<Pure>>
        +resolve_policy_chain()
        +merge_policies()
        +MAX_CHAIN_DEPTH: 5
    }
    discovery ..> _gitlab : GitLab ancestry walk
    discovery ..> inheritance : tighten-only merge
    discovery ..> _remote : reads origin once
    _gitlab ..> _remote : splits URL
    _gitlab ..> PolicyFetchResult : returns
    discovery ..> PolicyFetchResult : composes in place
    class PolicyFetchResult:::touched
    class discovery:::touched
    class _gitlab:::touched
    class _remote:::touched
    classDef touched fill:#fff3b0,stroke:#d47600
Loading
flowchart TD
    A["install / audit / policy status<br/>discover_policy_with_chain"] --> B["_auto_discover: read origin once"]
    B --> E{"GitLab host?"}
    E -- "no" --> G["GitHub / ADO discovery (unchanged)"]
    E -- "yes" --> F["_gitlab._fetch_gitlab_ancestry"]
    F --> I{"nested namespace?"}
    I -- "no: flat" --> J["single apm-policy fetch (unchanged)"]
    I -- "yes" --> K{"fresh composed cache?"}
    K -- "yes" --> L["serve composed chain, zero requests"]
    K -- "no" --> M["probe every namespace, deepest first"]
    M --> S{"non-404 failure?"}
    S -- "stale composed cache" --> T["cached_stale (complete chain)"]
    S -- "another level found" --> U["incomplete_chain: fail closed"]
    S -- "none" --> V["leaf = nearest, ancestry_parents = farther"]
    V --> X["_resolve_and_persist_chain: company to team, each with its extends chain"]
    X --> Y["resolve_policy_chain + write composed cache + ordered redacted chain"]
Loading

Recommendation

Ship after the merge worker folds the in-scope items (policy-reference Inheritance and pin notes, CHANGELOG length, apm-guide fail-closed wording, off logger gating with a test, chain rendering without repeating the leaf, the dotted-namespace comment, pin-scope docs, a shared composed_sources set, a _segment return annotation, and an e2e extends: + ancestry hierarchy). File three follow-up issues for parallel probes, negative caching, and the provider-wide source label. Parallel probes is the only one with user-visible latency on deep hierarchies.


Full per-persona findings

Python Architect

  • [nit] _segment discriminates success (list) from failure (tuple) with isinstance and has no return annotation at src/apm_cli/policy/discovery.py:644
    A future refactor that returns a tuple on success would silently become an incomplete chain.
    Suggested: annotate the return as list[...] | tuple[str, int, int].
  • [nit] Patterns: Adapter (_gitlab.py), Chain of Responsibility (per-level extends: segments composed root-first), Single Owner (_remote.py). No further abstraction needed at one-provider scale.

Test Coverage Expert

  • [nit] Installed-CLI hierarchies exercise only namespace composition; the extends: + ancestry duplicate guard is unit-only at tests/integration/test_gitlab_subgroup_policy_lifecycle.py
    The user promise is covered at e2e; the dedupe guard is an internal invariant covered at unit tier.
    Proof (passed): tests/unit/policy/test_gitlab_ancestry_composition.py::test_explicit_extends_to_discovered_ancestor_is_deduplicated -- proves: an extends: naming a discovered ancestor is reused without refetch or false cycle [governed-by-policy,secure-by-default]

Doc Writer

  • [recommended] policy-reference Inheritance note still says extends: composes inside "that one discovered file", and the pin note does not say GitLab-discovered ancestors are outside the pin at docs/src/content/docs/enterprise/policy-reference.md:479
    A governance reader could assume a pinned GitLab project is protected from ancestor changes.
  • [recommended] The CHANGELOG entry is a long paragraph rather than one concise line at CHANGELOG.md:12
    .github/instructions/changelog.instructions.md asks for one concise line ending with the PR number.
  • [nit] apm-guide says a non-404 failure "at any level" fails closed; the code fails closed only while another level has a policy at packages/apm-guide/.apm/skills/apm-usage/governance.md:445

CLI Logging Expert

  • [recommended] enforcement: off with a subgroup policy prints at default verbosity at src/apm_cli/core/command_logger.py:655
    An off policy needs no action; it should stay silent unless --verbose.
    Suggested: gate the info line on enforcement != "off".
  • [nit] The leaf appears twice on the install line (source and last chain entry).
  • [nit] org: prefix on the source vs bare refs in the chain.

Supply Chain Security Expert

  • [nit] The dotted-first-segment host heuristic rejects a subgroup like my.dept (fails closed); add an inline comment at src/apm_cli/policy/_gitlab.py:146
  • [nit] policy.hash pins only the nearest policy; ancestor changes are not pin-detected. Document it and point CI at apm policy status to verify the chain.

Auth Expert

  • [nit] Same dotted-namespace heuristic (fails closed, no credential leak) at src/apm_cli/policy/_gitlab.py:143; documented next to the 404 caveat.

Performance Expert

  • [recommended] Namespace probes run sequentially at src/apm_cli/policy/_gitlab.py:355
    Cold or stale runs pay one round trip per level; warm runs make zero requests. Follow-up, not a blocker.
  • [nit] composed_sources is rebuilt per segment; share one set at src/apm_cli/policy/discovery.py:696
  • [nit] Absent namespaces are re-probed on stale runs (documented trade-off); negative caching is a follow-up.

This panel is advisory. It does not block merge. Re-apply the
panel-review label after addressing feedback to re-run.


Generated by autopilot-pr-review-worker. This comment is AI-generated and may contain errors.

CI shards 1-2 failed: lifecycle-script kill-switch tests stub discover_policy with a duck-typed leaf that predates ancestry_parents, so the new entry-point read raised inside the runner, which swallowed it and dropped deny_all. Read ancestry_parents defensively after the existing extends check. The docs link checker rejected ./apm-policy/ links from sibling pages; Starlight pages need ../apm-policy/.

Addresses CI run 43270309942 and docs build 43270309904.

Co-authored-by: Rafael Azevedo <[email protected]>
Co-authored-by: Copilot App <[email protected]>
Addresses the iteration-1 advisory (comment 6831280525): an off composed policy stays silent without --verbose and the install line names the extends chain without repeating the leaf (cli-logging); policy-reference Inheritance and pin notes, pin scope for discovered ancestors, a one-line CHANGELOG entry and precise fail-closed wording in apm-usage (doc-writer, supply-chain); an inline note on the dotted-group host heuristic (auth, supply-chain); a shared composed_sources set and a _segment return annotation (performance, architect); an installed-CLI hierarchy mixing extends: with discovered ancestors (test-coverage). Relative ./apm-policy/ links from sibling pages become ../apm-policy/.

Co-authored-by: Rafael Azevedo <[email protected]>
Co-authored-by: Copilot App <[email protected]>
Addresses delta-panel python-architect follow-up: the entry point already tolerates duck-typed fetch results without ancestry_parents, but _resolve_and_persist_chain still read the attribute directly, so an extends-bearing duck-typed result would fail there instead.

Co-authored-by: Rafael Azevedo <[email protected]>
Co-authored-by: Copilot App <[email protected]>
Addresses terminal delta test-coverage follow-up: no test drove a duck-typed fetch result with extends: into _resolve_and_persist_chain, so reverting its defensive ancestry_parents read would have gone unnoticed. Mutation-break: restoring the bare attribute read fails the new test with AttributeError.

Co-authored-by: Rafael Azevedo <[email protected]>
Co-authored-by: Copilot App <[email protected]>
@danielmeppiel

Copy link
Copy Markdown
Collaborator

APM Review Panel: ship_now

Delta pass at the final head: every iteration-1 and delta follow-up is folded with test evidence, and all seven lenses report no open findings.

panel-mode=delta; personas=python-architect,test-coverage-expert,doc-writer,cli-logging-expert,supply-chain-security-expert,auth-expert,performance-expert,apm-ceo

cc Rafael Azevedo (@rrazvd) Sergio Sisternes (@sergio-sisternes-epam) -- a fresh advisory pass is ready for your review.

What changed since the last advisory (comment 6831280525 at 09fc039):

  • 5fe4eb1 -- CI fix. Lifecycle-script kill-switch tests stub discover_policy with duck-typed results that predate ancestry_parents; the chain entry point now reads that field defensively, so deny_all applies again. Docs links from sibling pages now use ../apm-policy/.
  • c1ec79f -- folds every iteration-1 in-scope item: an off composed policy stays silent without --verbose; the install line renders (extends chain: ...) without repeating the leaf; the policy-reference Inheritance and pin notes are corrected; the docs state that ancestor changes are outside the pin; the CHANGELOG entry is one line; the apm-usage fail-closed wording is precise; the dotted-group host heuristic is commented; composed_sources is one shared set and _segment is annotated; and an installed-CLI hierarchy mixes extends: with discovered ancestors.
  • e15b839 / e522332 -- delta follow-ups. The chain owner also reads ancestry_parents defensively, guarded by a new regression trap; restoring the bare attribute read makes that test fail.
  • Current main (including hotfix fix(cli): shorten apm view summary so root help is not truncated #3651) is merged with no conflicts in the PR's files.

The delta returns from doc-writer, cli-logging, supply-chain, auth, and performance were clean. Python-architect and test-coverage each raised one item; both are folded above, and their terminal re-checks are clean. CI is green at this head: all 23 checks pass, including Build & Test, Lifecycle Smoke, Lint, Spec conformance, docs build, and license/cla. All 20 review threads are replied to and resolved, and the second Copilot round raised nothing new.

Aligned with: Governed by policy -- tighten-only ancestor composition, incomplete_chain instead of a weaker partial chain, and no silent re-pinning. Secure by default -- credential isolation and cycle and depth protections hold, with mutation-break evidence.

Panel summary

Persona B R N Takeaway
Python Architect 0 0 0 The asymmetric-getattr finding is resolved; no new concerns.
Test Coverage Expert 0 0 0 The callee-side trap was added and mutation-break verified; every scope scenario is covered.
Doc Writer 0 0 0 All three iteration-1 doc findings are fixed accurately; links are valid.
CLI Logging Expert 0 0 0 The off gate and leaf-free chain rendering are resolved and consistent with apm policy status.
Supply Chain Security Expert 0 0 0 The defensive read is equivalent for real results; no bypass.
Auth Expert 0 0 0 No credential-routing change.
Performance Expert 0 0 0 The shared set is correct; no regressions.

B = blocking-severity findings, R = recommended, N = nits.
Counts are signal strength, not gates. The maintainer ships.

Top 3 follow-ups

  1. [Performance Expert] Parallelize GitLab namespace probes -- latency on deep hierarchies; a new concurrency surface beyond the bounded-fetch contract (follow-up issue).
  2. [Performance Expert] Cache absent GitLab namespaces -- re-probes on stale runs; this needs a new cache record type, which is outside this PR's reuse of existing cache owners (follow-up issue).
  3. [CLI Logging Expert] Unify the provider-wide org: source label on the Policy: line -- this changes GitHub and ADO output too (follow-up issue).

Recommendation

No in-PR work remains. The three items above are scope-boundary follow-ups for separate issues. The PR is ready for the required maintainer review against the #2753 scope (review contact Daniel Meppiel (@danielmeppiel)).

This panel is advisory. It does not block merge. Re-apply the
panel-review label after addressing feedback to re-run.


Generated by autopilot-pr-review-worker. This comment is AI-generated and may contain errors.

@danielmeppiel
Daniel Meppiel (danielmeppiel) merged commit e524b6b into microsoft:main Nov 12, 2026
26 checks passed
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 12, 2026
Clean merge of #3599, #3647, #3650, #2933; no lockfile or autopilot
package conflicts.

Co-authored-by: sergio-sisternes-epam <[email protected]>
Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 17, 2026
* fix(tests): restore release-gate lanes for 0.36.0

Main's tag-gate lanes (build-release push + manual-build-release) were red
on runs 43381609442, 43381682871 and 43394173235. PR CI never runs them.

Product regressions (Windows/real installs), fixed:
- Hook cleanup removed nothing on Windows: remove_stale_deployed_files
  looked up recorded hashes with POSIX keys while callers passed native
  backslash keys, so content proof failed closed (#3672, Refs #3649).
- describe_path_obstruction returned None on Windows, which reports a
  directory-for-file as EACCES and a file-for-parent as ENOENT instead of
  EISDIR/ENOTDIR (#3709, Refs #3678).
- Skill preflight refused claimed members of an unclaimed, populated skill
  directory that materialization leaves alone, failing a local bundle
  install (Refs #3625).

Stale tests (behaviour changed intentionally), updated:
- policy chain mocks now return real PolicyFetchResult (#2933, Refs #2753)
- bare-cache/downloader/anonymous-https fixtures use real Git checkouts
  (#3603, Refs #3457)
- mcp install help, registry error wording, deps why -g help
  (#3633 Refs #3588, #2803 Refs #2478, #3614 Refs #2884)
- downloader stub carries carried_licenses (#3646, Refs #3556)
- frozen-hash lifecycle uses a generic git host so -g URL validation
  uses git ls-remote instead of a live api.github.com 404 (#3672)

New Windows-shaped regression tests are marked windows_compat.

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

* chore: spec waiver for release-gate repair

apm-spec-waiver: restores pre-existing behaviour on Windows and in skill preflight; no OpenAPM-observable change

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

---------

Co-authored-by: danielmeppiel <[email protected]>
Co-authored-by: Copilot App <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/audit-policy apm-policy.yml schema, custom_checks, install-time enforcement. area/enterprise Air-gapped/GHE configurability, registry proxy, rulesets, adoption playbook. status/deferred Not invited for implementation now; no release commitment. triage/recommended Automated advice completed; not human scope approval. type/feature New capability, new flag, new primitive.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] GitLab: support subgroup-scoped policy discovery (team-level apm-policy), not only the top-level group

4 participants