Repository navigation
fix(exec): pinned hooks denied by policy report the deny, not apm approve (#4044) - #4055
Merged
Daniel Meppiel (danielmeppiel) merged 7 commits intoNov 20, 2026
Merged
Conversation
8 of 15 tasks
…rove (#4044) Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Daniel Meppiel (danielmeppiel)
force-pushed
the
danielmeppiel-exec-pinned-deny-4044
branch
from
November 20, 2026 03:03
a98080f to
ca17ec7
Compare
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Daniel Meppiel (danielmeppiel)
force-pushed
the
danielmeppiel-exec-pinned-deny-4044
branch
from
November 20, 2026 03:03
ca17ec7 to
f4024c8
Compare
9 of 16 tasks
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
#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]>
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 20, 2026
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…s fixed 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]>
Merged
6 of 10 tasks
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Daniel Meppiel (danielmeppiel)
marked this pull request as ready for review
November 20, 2026 10:21
Daniel Meppiel (danielmeppiel)
requested a review
from Sergio Sisternes (sergio-sisternes-epam)
as a code owner
November 20, 2026 10:21
Daniel Meppiel (danielmeppiel)
deleted the
danielmeppiel-exec-pinned-deny-4044
branch
November 20, 2026 10:23
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified for the change correcting policy-denied pinned-hook diagnostics.
No open issues 🎉
What changed in this PR
Fixes #4044 by making apm install report pinned hooks blocked by organization policy or a user-level deny as denied, directing users to apm policy explain rather than an ineffective approval command. The change reuses existing trust verdicts without changing admission, deployment, lockfile status, or approval prompts.
Changes:
- Propagates pinned deny verdicts into the hook diagnostic state.
- Adds five lifecycle cases covering denies and changed-pin behavior.
- Strengthens the architecture guard, removes the resolved expected failure, and documents the fix.
| File | Description |
|---|---|
tests/integration/test_pinned_hook_policy_deny_lifecycle.py |
Adds lifecycle checks for diagnostics, deployed hooks, and lockfile status. |
tests/integration/test_architecture_owner_rule_mutations.py |
Adds mutation coverage for pinned-deny propagation. |
tests/integration/_gate_machine_kit.py |
Removes the expected failure tracked by #4044. |
src/apm_cli/install/exec_gate.py |
Includes pinned deny verdicts in per-package diagnostic state. |
scripts/architecture_linter/checks/install_lsp_plugin.py |
Requires pinned-deny propagation in the trust-context guard. |
CHANGELOG.md |
Records the corrected hook-denial diagnostic. |
Review effort: Balanced
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)
added a commit
that referenced
this pull request
Nov 20, 2026
… tracking #4270 (#4094) Main's #4055 merge stopped deploying the whole plugin (and its bin/) after approve + --trust-bin, silently; the docs still promise it. 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
TL;DR — When hooks pinned with
apm approveare later denied by org policy or byapm deny --user,apm installnow prints the existing denied line (hooks skipped (denied). Run 'apm policy explain <pkg>' …) instead ofnot approved … Run 'apm approve <pkg>'. Approving cannot lift a deny, so the old hint sent users in a loop. Only the diagnostic changes: admission, deployment, lockfileexec_statusand the approval prompt are untouched.Important
Stacked on #4025 (base
danielmeppiel-legendary-chainsaw). CI does not run on a non-mainbase, so the evidence below is the local CI mirror.Problem (WHY)
check_executable_approval(install/exec_gate.py) drops every pinned type fromunapprovedbeforedenied_exec_typesruns, so a pinned hook that the item-admission owner (pinned_exec_status) resolves toTRUST_DENIEDnever reachesctx.package_denied_exec_types.log_hooks_skipreads only that set, so it falls back to the "not approved / apm approve" message even though the hooks are hard-denied.apm deny --user): the issue record lists it as a control, but it fails on the base too, so this PR fixes it as well.Approach (WHAT)
Seed the per-package denied set with the pinned
TRUST_DENIEDverdicts frompinned_exec_status, then union the type-level denies as before.ctx.package_denied_exec_typesis read only bylog_hooks_skip; the blocked-for-prompt decision still usesunapproved(pinned types excluded) and the pinnedTRUST_GATEDcheck, so it is unchanged.Implementation (HOW)
src/apm_cli/install/exec_gate.pydeniedstarts from pinnedTRUST_DENIEDtypes;denied_exec_typesresults are unioned in; the set is stored whenever non-empty.tests/integration/test_pinned_hook_policy_deny_lifecycle.pylifecycle_smoke(5 cases, ~11 s with-n 4).scripts/architecture_linter/checks/install_lsp_plugin.py,tests/integration/test_architecture_owner_rule_mutations.pyCHANGELOG.mdFixedline.Trade-offs
Validation
Installed-CLI lifecycle test (
APM_BINARY_PATH=.venv/bin/apm), before and after the fix:apm approve, then orgdeny_all→ denied /apm policy explain, no approve hint,exec_status: denied, hooks removedapm deny --userhooks: true, then orgdeny_allapm deny(project)apm approve ../hooky, not denied,exec_status: gated_pending_approvaltests/integration/test_pinned_hook_policy_deny_lifecycle.py,test_executables_deny_retires_hooks_lifecycle.py,test_executables_gate_integration.py,tests/unit/install,tests/unit/security,tests/unit/commands/test_approve_deny.py): the only difference is thepinned-org-denycase going from fail to pass; no new failures (the remaining 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. Affected mutation tests: 22 passed.How to test
APM_BINARY_PATH=.venv/bin/apm uv run --extra dev pytest tests/integration/test_pinned_hook_policy_deny_lifecycle.py -qsrc/apm_cli/install/exec_gate.pyand rerun: only[pinned-org-deny]and[pinned-user-deny]fail.Issue and approved scope
Issue: Fixes #4044
Human scope-approval comment: #4044 (comment)
Completes the issue. Out of scope (untouched): bin/ and canvas skip diagnostics (#4052), allow/deny decisions, pin format,
apm policy explainoutput, native-plugin and MCP diagnostics, the approval prompt.Pre-merge
mainafter plan/apply P5a: ExecDecision, one executable trust owner (#4018) #4025 merges (then let CI run). Branch already contains 0.37main(incl. test(lifecycle): GATE state machine with cross-cutting oracle (#4031) #4040) via plan/apply P5a: ExecDecision, one executable trust owner (#4018) #4025.tests/integration/_gate_machine_kit.py).Type of change
Testing
Changelog
## [Unreleased]inCHANGELOG.md.Spec conformance (OpenAPM v0.1)
Co-authored-by: Copilot [email protected]