Repository navigation
fix(exec): omit the project-only policy explain hint for -g hook and canvas denies (#4296) - #4297
Closed
Daniel Meppiel (danielmeppiel) wants to merge 3 commits into
Closed
Daniel Meppiel (danielmeppiel) wants to merge 3 commits into
Daniel Meppiel (danielmeppiel) wants to merge 3 commits into
Conversation
…canvas denies (#4296) 'apm policy explain' resolves only the current project, so at user scope the deny line for a hook or canvas extension stops at the deny. 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]>
Daniel Meppiel (danielmeppiel)
marked this pull request as ready for review
November 20, 2026 13:25
Daniel Meppiel (danielmeppiel)
requested a review
from Sergio Sisternes (sergio-sisternes-epam)
as a code owner
November 20, 2026 13:25
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The integration test can modify a developer’s real Claude settings, while user-scope denials still show misleading project-only guidance and approval prompts.
3 open issues
What changed in this PR
This PR makes APM's hook and canvas deny diagnostics scope-aware, omitting the project-only apm policy explain hint during user-scope (-g) installs. It addresses the diagnostic portion of #4296; user-scope support for the explain command remains deferred.
Changes:
- Add a shared scope check while preserving project-scope wording.
- Add installed-CLI coverage for user-scope hook and canvas denial, reinstall, and cleanup.
- Record the diagnostic correction in the changelog.
| File | Description |
|---|---|
tests/integration/test_bin_canvas_deny_diagnostics_lifecycle.py |
Add user-scope denial and deployment-cleanup coverage. |
src/apm_cli/install/target_warnings.py |
Apply scope-aware hint handling to canvas skips. |
src/apm_cli/install/exec_gate.py |
Add the shared scope check and apply it to hook skips. |
CHANGELOG.md |
Document the user-scope diagnostic correction. |
Review effort: Balanced
| root = isolated.home / deploy_root | ||
| root.mkdir(parents=True, exist_ok=True) | ||
| env = {**isolated.subprocess_env(), "COLUMNS": "1000"} | ||
| env.pop("COPILOT_HOME", None) |
Comment on lines
+630
to
+631
| reason = executable_skip_reason( | ||
| ctx, package_name, label, EXEC_TYPE_HOOKS, "hooks", explain_hint=explain_hint_applies(ctx) |
| _pkg_label, | ||
| EXEC_TYPE_CANVAS, | ||
| "canvas extension(s)", | ||
| explain_hint=explain_hint_applies(ctx), |
This was referenced Nov 20, 2026
5 of 10 tasks
Collaborator
Author
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
apm policy explainresolves only the current project'sapm.yml, so it cannot explain a user-scope (apm install -g) installation: outside a project it fails with "No apm.yml found", and inside one it explains the wrong package set. At user scope, the deny line for a hook or canvas extension now stops at the deny (<pkg>: hooks skipped (denied).) instead of pointing to that command. Project-scope wording is unchanged.src/apm_cli/install/exec_gate.pyexplain_hint_applies(ctx)(false atInstallScope.USER);executable_skip_reason(..., explain_hint=);log_hooks_skippasses it.src/apm_cli/install/target_warnings.pylog_canvas_skippasses it.tests/integration/test_bin_canvas_deny_diagnostics_lifecycle.py-g, parametrized over canvas (copilot) and hooks (claude): approve via the user manifest, install,apm deny --user, reinstall; asserts the exact line<pkg>: <kind> skipped (denied)., nopolicy explain, noapm approvehint, deployed files removed.CHANGELOG.mdFixedline.Out of scope (remaining in #4296): a user-scope mode for
apm policy explainitself, after which the hint can return at-g.Issue and approved scope
Refs #4296
Human scope-approval comment: #4296 (comment)
Does this PR complete the issue, or what remains? Partial: the hints are scope-aware; the user-scope
policy explainmode remains.Type of change
Testing
APM_E2E_TESTS=1 APM_BINARY_PATH=.venv/bin/apm pytest -n 2 tests/integration/test_bin_canvas_deny_diagnostics_lifecycle.py tests/integration/test_pinned_hook_policy_deny_lifecycle.py tests/integration/test_executables_deny_retires_hooks_lifecycle.py: 23 passed. Without thesrc/change, both new-gcases fail.Changelog
## [Unreleased]inCHANGELOG.md.Spec conformance (OpenAPM v0.1)
apm-spec-waiver: diagnostic wording at user scope only; no OpenAPM-observable behaviour change
Co-authored-by: Copilot [email protected]