Repository navigation
Owner moves: one policy-outcome routing owner for every policy reader - #4151
Merged
Daniel Meppiel (danielmeppiel) merged 14 commits intoNov 20, 2026
Merged
Conversation
…ner (#4084) Register policy/outcome_routing.py as the policy-outcome-routing owner with a closed outcome set. audit --ci, approve, update and MCP admission take the routed decision instead of local outcome lists; an outcome outside the set blocks. Adds the install-deployment-policy-outcome-routing guard and an installed-CLI parity test across every outcome. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 20, 2026
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Trust and integrity consistency hardening (#4079): - apm audit --ci drift replay reads org policy through the trust-reader outcome owner (resolve_trust_policy / route_discovery_outcome), so a policy outcome that stops install also stops the replay (req-pl-010). - The lifecycle script policy gate suppresses scripts, with a warning, when org policy cannot be resolved, including inheritance chain errors (req-pl-003, req-pl-010). - Guards: install-deployment-trust-policy-outcome covers the audit replay reader; new contracts-tooling-lifecycle-policy-errors guard with its mutation case. - Regression tests on the installed CLI and a lifecycle bug ledger row. 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]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…tcomes Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Type-check every policy field before membership, hashing or iteration; load_policy turns any remaining shape error into a validation error so it routes as malformed. Adds the install-deployment-policy-field-types guard. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 20, 2026
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…4084, #4140) Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…the type Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
apm-spec-waiver: owner consolidation; existing req-pl-003 and req-pl-010 policy outcome semantics now applied by every policy reader, no new normative behaviour Co-authored-by: copilot-swe-agent[bot] <[email protected]>
1 of 10 tasks
…eported policy Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 20, 2026
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Daniel Meppiel (danielmeppiel)
marked this pull request as ready for review
November 20, 2026 11:46
Daniel Meppiel (danielmeppiel)
requested a review
from Sergio Sisternes (sergio-sisternes-epam)
as a code owner
November 20, 2026 11:46
Co-authored-by: Copilot App <[email protected]>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Blocking policy outcomes can leave user approvals persisted despite reporting no write and still admit MCP servers through existing grants, while the routing guard misses equality-based bypasses.
3 open issues
What changed in this PR
This PR consolidates policy-discovery decisions in APM’s shared routing owner, addressing inconsistent handling across policy readers and malformed policy fields for #4084, #4079, and #4140.
Changes:
- Defines 11 discovery outcomes with centralized routing and blocking behavior for unknown outcomes.
- Routes additional policy readers through the owner and validates policy field types before use.
- Adds architecture guards, mutation and lifecycle coverage, and updated policy documentation.
| File | Description |
|---|---|
| tests/unit/test_audit_policy_command.py | Aligns audit fixtures with explicit discovery outcomes. |
| tests/unit/scripts/test_architecture_runner.py | Registers new guards in the frozen rule inventory. |
| tests/unit/policy/test_parser.py | Updates expected field-type diagnostics. |
| tests/unit/copilot_plugins/test_pr2705_folds.py | Uses a valid absent-policy result. |
| tests/unit/commands/test_approve_deny.py | Tests routed warnings and blocking approvals. |
| tests/quality/complexity_baseline.json | Removes the simplified parser’s complexity exemption. |
| tests/integration/test_trust_integrity_consistency_lifecycle.py | Covers audit replay and lifecycle-script policy failures. |
| tests/integration/test_policy_outcome_routing_lifecycle.py | Adds command parity and malformed-field lifecycle tests. |
| tests/integration/test_architecture_owner_rule_mutations.py | Adds policy-routing and type-check guard mutations. |
| tests/fixtures/lifecycle_bug_ledger.json | Records regression coverage for the three issues. |
| src/apm_cli/security/trust.py | Consumes routed policy decisions for MCP admission. |
| src/apm_cli/policy/parser.py | Centralizes field-type validation and malformed-policy errors. |
| src/apm_cli/policy/outcome_routing.py | Defines the outcome set and shared routing decisions. |
| src/apm_cli/policy/install_preflight.py | Updates the routing-owner comment. |
| src/apm_cli/policy/discovery.py | Documents all outcomes and classifies plaintext URL rejection. |
| src/apm_cli/install/phases/policy_gate.py | Updates comments to reference the routing owner. |
| src/apm_cli/core/lifecycle_scripts.py | Suppresses scripts on unexpected policy-check errors. |
| src/apm_cli/commands/update.py | Uses routed decisions for executable reconciliation. |
| src/apm_cli/commands/policy.py | Reports blocking policy errors during explanation. |
| src/apm_cli/commands/audit.py | Routes CI policy handling and drift replay centrally. |
| src/apm_cli/commands/approve.py | Uses shared policy resolution and reports blocking errors. |
| scripts/architecture_linter/checks/install_trust_integrity.py | Updates permitted discovery callers and trust-reader checks. |
| scripts/architecture_linter/checks/install_policy_plugin_and_approval.py | Requires approval to use shared policy resolution. |
| scripts/architecture_linter/checks/install_policy_outcome_routing.py | Adds outcome-routing and parser type-check guards. |
| scripts/architecture_linter/checks/install_deployment_analyzers.py | Registers the new policy guards. |
| scripts/architecture_linter/checks/contracts_lifecycle_script_gate.py | Guards lifecycle suppression on policy errors. |
| packages/apm-guide/.apm/skills/apm-usage/governance.md | Documents outcome handling and malformed fields. |
| docs/src/content/docs/reference/cli/policy.md | Lists all discovery outcomes. |
| docs/src/content/docs/reference/cli/lifecycle.md | Updates policy-related script suppression guidance. |
| docs/src/content/docs/reference/cli/approve.md | Documents blocking policy outcomes during approval. |
| CHANGELOG.md | Records policy consistency and parser fixes. |
| .apm/architecture/owners/install-deployment.json | Registers the consolidated policy-routing owner. |
| .apm/architecture/owners/contracts-tooling.json | Associates lifecycle policy-error enforcement with its guard. |
Review effort: Balanced
| A blocking outcome raises :class:`PolicyViolationError`; an outcome that | ||
| leaves no usable policy is reported and yields an empty policy. | ||
| """ | ||
| policy = resolve_trust_policy(project_root, logger=logger) |
Comment on lines
+315
to
+317
| policy = route.policy | ||
| if policy is None and (route.blocks or route.unresolved): | ||
| admission.policy_unavailable = route.outcome |
Comment on lines
+103
to
+105
| elif isinstance(node, ast.Compare) and any( | ||
| isinstance(op, (ast.In, ast.NotIn)) for op in node.ops | ||
| ): |
Daniel Meppiel (danielmeppiel)
deleted the
danielmeppiel-cuddly-train
branch
November 20, 2026 12:02
This was referenced Nov 20, 2026
Closed
Takeshi Masukawa (takeaship)
pushed a commit
to takeaship/apm
that referenced
this pull request
Nov 20, 2026
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
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
Owner consolidation for the 0.37 trust and integrity consistency hardening (group H1a: policy outcome routing). One canonical owner per decision, each guarded closed-world:
policy/outcome_routing.py): a closed set of 11 policy-discovery outcomes, each with exactly one route.apm install,apm audit --ci,apm approve,apm updateand MCP admission take the same routed decision; an outcome outside the set blocks. A wrongly typed policy field is a malformed policy, routed like any other.Includes the S-3 lane (#4079).
Issue and approved scope
Fixes #4084 -- scope record: #4084 (comment)
Fixes #4140 -- scope record: #4140 (comment)
Fixes #4079 -- scope record: #4079 (comment)
Completes all three issues.
Type of change
Testing
Installed-CLI parity test (red on main 1b96706: 9 of 13 cases; green on this branch):
tests/integration/test_policy_outcome_routing_lifecycle.py::test_every_policy_reader_routes_the_outcome_like_installChangelog
## [Unreleased]inCHANGELOG.md.Spec conformance (OpenAPM v0.1)
apm installalready applied.apm-spec-waiver: owner consolidation; existing req-pl-003 and req-pl-010 policy outcome semantics now applied by every policy reader, no new normative behaviour