Skip to content

fix(exec): canvas skip diagnostic reports a deny (#4052) - #4064

Merged
Daniel Meppiel (danielmeppiel) merged 9 commits into
mainfrom
danielmeppiel-exec-bin-canvas-deny-4052
Nov 20, 2026
Merged

Daniel Meppiel (danielmeppiel) merged 9 commits into
mainfrom
danielmeppiel-exec-bin-canvas-deny-4052

Conversation

@danielmeppiel

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

Copy link
Copy Markdown
Collaborator

Description

TL;DR — When a dependency's canvas extension is hard-denied (org policy or apm deny), apm install now says … skipped (denied). Run 'apm policy explain <pkg>' to see which deny applies. instead of not approved … Run 'apm approve <pkg>'. The bin/ and canvas skip diagnostics now read the denied-type set the gate already records, as the hooks line does (#4044). Admission, deployment, --trust-bin, lockfile exec_status and the approval prompt are unchanged.

Important

Stacked on #4055 (base danielmeppiel-exec-pinned-deny-4044, which stacks on #4025). CI does not run on a non-main base, so the evidence below is the local CI mirror.

Note

Narrowed to canvas (pending the amended #4052 record). Since #3290 a Claude plugin with bin/ at user scope loads natively and its deny is already reported by the native-plugin owner (Parked native plugin X: denied / apm policy explain X); the bin test is now a native-denied control. log_bin_status stays deny-aware as a defensive branch.

Problem (WHY)

  • check_executable_approval (install/exec_gate.py) already records type-level bin/canvas denies in ctx.package_denied_exec_types (via denied_exec_types, the executable-trust-context owner).
  • log_bin_status (install/exec_gate.py) and _log_canvas_skip (install/services.py) never read it, so a denied package was told to run apm approve, which cannot lift a deny.

Approach (WHAT)

One diagnostic helper, executable_skip_reason(ctx, package, label, exec_type, kind) in install/exec_gate.py, picks the denied or approvable wording from the gate-recorded set. The hooks, bin/ and canvas lines all use it; nothing re-derives a deny. The skip reason (not_approved) and its source (resolve_bin_skip, the canvas gate) are untouched.

Implementation (HOW)

File Change
src/apm_cli/install/exec_gate.py New executable_skip_reason; log_bin_status takes ctx and uses it for the not_approved line; log_hooks_skip uses it too (byte-identical output).
src/apm_cli/install/services.py _log_canvas_skip takes ctx and uses the helper; integrate_package_primitives passes ctx to both diagnostics.
tests/integration/test_bin_canvas_deny_diagnostics_lifecycle.py New installed-CLI lifecycle tests, marked lifecycle_smoke.
CHANGELOG.md One Fixed line (separate commit).

No docs: no page quotes these skip lines.

Trade-offs

Validation

Installed-CLI lifecycle tests (APM_BINARY_PATH=.venv/bin/apm), before and after the fix:

Case Base (#4055 head f4024c85d) This branch
control: native Claude plugin with bin/ at -g, then org deny_all → Parked native plugin X: denied / apm policy explain X (native owner, #3290) passes passes
canvas: flag on, approved dependency canvas deployed, then apm deny → denied canvas line, no apm approve, extension removed, exec_status: denied fails passes
control: unapproved, undenied canvas keeps "not approved / apm approve" passes passes
  • Same selection with and without the fix (tests/unit/install, tests/unit/integration, tests/unit/security, the bin trust/hardening, executables-gate, Org-denied hooks report the wrong reason and remediation #4044 and hook-retire lifecycle tests): the only difference is the two target cases going from fail to pass; no new failures (the remaining ~248 sandbox failures — git signing, installer ownership — are identical both ways).
  • ruff check / ruff format --check (src, tests, architecture linter): clean. pylint R0801: 10.00/10. scripts/lint-auth-signals.sh: clean. scripts/lint-architecture-boundaries.sh: exit 0. tests/quality/test_ci_topology.py: 189 passed.

How to test

  • APM_BINARY_PATH=.venv/bin/apm uv run --extra dev pytest tests/integration/test_bin_canvas_deny_diagnostics_lifecycle.py -q
  • Revert src/ to the base and rerun: only [org-deny] (bin) and [deny] (canvas) fail.

Issue and approved scope

Issue: Fixes #4052

Human scope-approval comment: #4052 (comment) (amended, canvas-only)

Completes the issue. Out of scope (untouched): hooks diagnostics (#4044), allow/deny decisions, --trust-bin semantics, the legacy bin_deploy policy path, local-bundle canvas/bin messages, native-plugin parked messages, MCP and LSP diagnostics, the approval prompt.

Pre-merge

Type of change

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

Testing

  • Tested locally
  • All existing tests pass (no change in the targeted selection besides the fixed cases)
  • Added tests for new functionality (if applicable)

Changelog

  • One line in one section under ## [Unreleased] in CHANGELOG.md.
  • N/A -- internal-only change (CI, tests, refactor).

Spec conformance (OpenAPM v0.1)

apm-spec-waiver: canvas skip diagnostic wording only; no allow, deny, deployment or lockfile change

  • N/A -- this PR does not change OpenAPM-observable behaviour (diagnostic text only).

Co-authored-by: Copilot [email protected]

@danielmeppiel Daniel Meppiel (danielmeppiel) added this to the 0.37.0 milestone Nov 20, 2026
@danielmeppiel Daniel Meppiel (danielmeppiel) changed the title [0.38] fix(exec): bin/ and canvas skip diagnostics report a deny (#4052) fix(exec): bin/ and canvas skip diagnostics report a deny (#4052) Nov 20, 2026
#3290 moved the canvas skip warning to install/target_warnings.py; the
deny-aware wording moves with it.

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]>
@danielmeppiel Daniel Meppiel (danielmeppiel) changed the title fix(exec): bin/ and canvas skip diagnostics report a deny (#4052) fix(exec): canvas skip diagnostic reports a deny (#4052) Nov 20, 2026
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Base automatically changed from danielmeppiel-exec-pinned-deny-4044 to main November 20, 2026 10:23
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
@danielmeppiel
Daniel Meppiel (danielmeppiel) marked this pull request as ready for review November 20, 2026 10:35
Copilot AI balanced review requested due to automatic review settings November 20, 2026 10:35
apm-spec-waiver: canvas skip diagnostic wording only; no allow, deny, deployment or lockfile change

Co-authored-by: copilot-swe-agent[bot] <[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

The remediation command suggested for denied globally installed canvas dependencies inspects the current project instead, requiring a scope-aware explanation path and global lifecycle test coverage.

1 open issue
What changed in this PR

This PR corrects denied-canvas diagnostics in apm install, extending the hooks diagnostic behavior from #4055 to address #4052 without changing admission or deployment decisions.

Changes:

  • Adds a shared skip-message helper that distinguishes hard denies from missing approval.
  • Passes install context into canvas and bin diagnostics while preserving hooks wording.
  • Adds lifecycle coverage for denied and unapproved canvases, a native-plugin control, and a changelog entry.
File Description
tests/​integration/​test_bin_canvas_deny_diagnostics_lifecycle.py Adds canvas diagnostic regression cases and a native-plugin control.
src/​apm_cli/​install/​target_warnings.py Uses recorded deny state for canvas skip messages.
src/​apm_cli/​install/​services.py Passes install context to canvas and bin diagnostics.
src/​apm_cli/​install/​exec_gate.py Shares deny-aware wording across executable skip messages.
CHANGELOG.md Records the denied-canvas diagnostic correction.

Review effort: Balanced

Comment thread src/apm_cli/install/target_warnings.py Resolved
@danielmeppiel
Daniel Meppiel (danielmeppiel) merged commit 18ca76f into main Nov 20, 2026
42 checks passed
@danielmeppiel
Daniel Meppiel (danielmeppiel) deleted the danielmeppiel-exec-bin-canvas-deny-4052 branch November 20, 2026 11:50
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
…cope contract

User scope is not governed by org policy (#4087), so the native bin/ deny
control now denies through the user store instead of an org policy
discovered from a git checkout at HOME. Bundle admission manifest reads
route through core.scope.manifest_file.

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
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.

bin/ and canvas skip diagnostics never consult a deny

2 participants