Skip to content

fix(cli): update and approve print policy-block refusals as [x] errors - #4427

Merged
Daniel Meppiel (danielmeppiel) merged 7 commits into
mainfrom
danielmeppiel-policy-outcome-wording
Nov 21, 2026
Merged

Daniel Meppiel (danielmeppiel) merged 7 commits into
mainfrom
danielmeppiel-policy-outcome-wording

Conversation

@danielmeppiel

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

Copy link
Copy Markdown
Collaborator

Description

apm update and apm approve printed an org-policy block as a bare red line, without the [x] error symbol every other refusal carries:

Install blocked: no enforceable org policy was resolved (outcome=absent) and project apm.yml has policy.fetch_failure_default=block (source=...)
Blocked by org policy: no enforceable org policy was resolved (outcome=empty) and ...

Both now print through the error helper with symbol="error", so the line starts with [x] (see STATUS_SYMBOLS in utils/console.py).

File Change
src/apm_cli/commands/update.py A PolicyViolationError is printed with the [x] symbol on stderr. DirectDependencyError and RequiredIntegrationError output is unchanged.
src/apm_cli/commands/approve.py _report_policy_block (shared with apm policy explain) prints the block with [x].
src/apm_cli/policy/outcome_routing.py, src/apm_cli/commands/audit.py The per-outcome cause wording ("No org policy found at ...", "... is present but empty", "Could not determine org from git remote", "Policy fetch failed: ...") moves from audit to the routing owner (outcome_cause). Every fetch_failure_default=block reason appends it, so install, update, approve and the audit --ci replay say why no policy resolved, not just the outcome class. audit._audit_outcome_cause delegates to the owner.
tests/lifecycle/security/test_policy_outcomes.py (1) Five rows whose strict marks absorbed this unannounced failure now pass and lose their marks: `P

Failing before, passing after, on main with this branch's tests:

No owner id touched. tests/lifecycle/oracles.py is unchanged.

Issue and approved scope

Fixes #4403

Human scope-approval comment: posted on #4403 by the PM.

Does this PR complete the issue? Yes.

Type of change

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

Testing

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

Verification (own venv, after merging main):

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.

Co-authored-by: Copilot [email protected]

…4259)

#4259 routes approve and the deployed MCP consent check through the
shared policy owner: approve now fails closed under
fetch_failure_default=block, and audit --ci reports the routed reason
(outcome=<class>) through its hook-approval and drift checks. Update the
approve and mcp-admission rows to that behavior.

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
apm update and apm approve printed an org-policy block ("Install blocked:
...", "Blocked by org policy: ...") as a bare red line without the [x]
error symbol every other refusal carries. Both now use the error symbol.
Five policy-outcome rows whose strict marks absorbed this unannounced
failure pass and lose their marks.

Fixes #4403

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
@danielmeppiel Daniel Meppiel (danielmeppiel) added this to the 0.37.0 milestone Nov 20, 2026
Copilot AI balanced review requested due to automatic review settings November 20, 2026 17:05

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.

🟢 Approval recommended

No active review issues remain for the change standardizing organization-policy refusal markers.

No open issues 🎉

What changed in this PR

This PR fixes #4403 by making org-policy refusals from apm update and apm approve use the standard [x] error marker, preserving existing wording and exit behavior.

Changes:

  • Adds the error marker to both policy-block reporting paths, retaining stderr output for update.
  • Updates lifecycle expectations for shared policy routing and removes five expected-failure marks.
  • Documents the user-visible fix in the changelog.
File Description
tests/​lifecycle/​security/​test_policy_outcomes.py Updates policy-block assertions and removes resolved expected-failure marks.
src/​apm_cli/​commands/​update.py Adds [x] to policy violations without changing other handled errors.
src/​apm_cli/​commands/​approve.py Adds [x] through the shared policy-block reporting helper.
CHANGELOG.md Records the refusal-output fix under Unreleased.

Review effort: Balanced

The routed block reason named only the outcome class, so update, approve,
install and the audit --ci replay lost why no org policy resolved (No
org policy found, Invalid policy, HTTP 503, ...). The cause wording moves
from commands/audit.py to the routing owner, policy/outcome_routing.py, and
the block reason appends it. audit keeps its cause line through the same
owner. The mcp-admission rows assert each cause alongside the routed line.

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
@danielmeppiel
Daniel Meppiel (danielmeppiel) merged commit f87ded7 into main Nov 21, 2026
45 checks passed
@danielmeppiel
Daniel Meppiel (danielmeppiel) deleted the danielmeppiel-policy-outcome-wording branch November 21, 2026 05:24
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.

apm update and apm approve print policy-block refusals without the [x] error marker

2 participants