Skip to content

fix(install): register local plugin bundle hooks through the hook integrator - #3897

Merged
Daniel Meppiel (danielmeppiel) merged 10 commits into
mainfrom
danielmeppiel-bundle-install-hooks
Nov 19, 2026
Merged

Daniel Meppiel (danielmeppiel) merged 10 commits into
mainfrom
danielmeppiel-bundle-install-hooks

Conversation

@danielmeppiel

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

Copy link
Copy Markdown
Collaborator

Description

apm install ./build/<bundle> (a Claude plugin bundle from apm pack) skipped the bundle's hooks.json and hooks/ files with a warning, so hooks never deployed from a local bundle although they did from a source install.

Now the bundle path routes hooks through the one canonical hook owner instead of a bundle-specific writer:

  • install/local_bundle_hooks.py stages the integrity-verified bundle bytes, loads them with the canonical Claude-plugin normalization (validate_legacy_marketplace_plugin, the same interpretation a source install of a plugin uses), and calls HookIntegrator.integrate_hooks_for_target for each hook-capable target. It writes no hook config itself.
  • The existing exact-content executables gate applies: with executables: {} (or no approval) the hooks are parked with one warning that prints the bundle's name#version@sha256:<digest> key; once approved they merge into .claude/settings.json / apm-hooks.json exactly as a source install does, and reinstalling replaces them.
  • Bundle hook entries carry a local-bundle::<slug> marker owned by hook_ownership.py. Drift replay excludes them (replay has no source to rebuild them, like other local-bundle files, whose scripts stay hash-bound in local_deployed_file_hashes), and dependency cleanup keeps them.
  • Reinstalls: a reinstall whose hooks are not approved, lack an integrity manifest, or ship none retires the bundle's earlier entries through HookIntegrator.retire_local_bundle_hooks; locally edited bundle scripts are kept unless --force. Staging copies only integrity-listed files and re-verifies them.
  • Coupled fix: on main, apm install <other-pkg> after a bundle install swept the bundle's files as stale (reconcile_deployed_block only protected local-bundle claims in the generic sweep). With hooks registered this would leave a dangling hook command, so the reconciler now keeps local-bundle claims in the dropped set too.

Before: [!] Skipped packed bundle hook file 'hooks.json': local bundle install does not register plugin hooks yet.
After: parked under the executables gate, then registered like a source install once the key is approved; apm audit --ci green.

Issue and approved scope

Issue: Refs #3700

Human scope-approval comment: #3700 (comment)

Does this PR complete the issue, or what remains? It delivers the approved scope. Not covered (out of scope in the record): apm uninstall for local bundles (no per-bundle ownership exists today for any bundle content), the --format apm deployed-layout lowering of .claude/hooks/<pkg>/scripts/x.sh to x.sh.json, and the own-project .apm/skills/ symlink summary diagnostic.

Type of change

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

Testing

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

Validation evidence (exact head 4e2268fccc7d8e0ed2aabe3bd784a6e1d04e7936, merged with current main):

Command Result
APM_BINARY_PATH=.venv/bin/apm .venv/bin/python -m pytest -p no:xdist tests/integration/test_local_bundle_hooks_lifecycle.py 2 passed; fails on unfixed main (Skipped packed bundle hook file 'hooks.json')
.venv/bin/python -m pytest -p no:xdist tests/unit/install/test_install_local_bundle.py 78 passed
.venv/bin/python -m pytest -p no:xdist "tests/unit/integration/test_hook_integrator.py::test_dependency_named_local_bundle_stays_dependency_owned" 2 passed (fails with the old local-bundle/ prefix)
.venv/bin/python -m pytest -p no:xdist tests/unit/install/phases/test_lockfile_union.py tests/unit/test_apm_package.py 62 passed, 47 passed
APM_BINARY_PATH=.venv/bin/apm .venv/bin/python -m pytest -p no:xdist on the 7 existing local-bundle / pack lifecycle files 81 passed
.venv/bin/python -m pytest -p no:xdist tests/integration/test_architecture_owner_rule_mutations.py -k "local_bundle_hooks_must or neutral_hook or covers_every or order_is" 10 passed
uvx [email protected] check / format --check (CI paths), pylint R0801, lint-auth-signals.sh, lint-architecture-boundaries.sh, file-length guard all clean
gh pr checks 3897 31 pass, 3 skipping

Review: panel advisories #3897 (comment) (full) and #3897 (comment) (delta); all in-scope findings and 5 Copilot inline comments folded.

Deferred (scope-crossing): lockfile hash-binding of bundle hook entries; centralizing local-bundle retention in DeploymentIntent; per-bundle ownership (apm uninstall for local bundles, stale Copilot per-file hook files); apm install -g has no executables gate without a user-scope executables block (pre-existing, source installs alike).

Spec conformance (OpenAPM v0.1)

  • Spec edit
  • Manifest edit
  • Test edit
  • CONFORMANCE.{md,json} regenerated
  • N/A -- this PR does not change OpenAPM-observable behaviour. (Commit carries an apm-spec-waiver: line.)

…egrator

apm install <bundle> now stages the verified bundle, loads it with the
canonical Claude-plugin normalization and registers its hooks through
HookIntegrator.integrate_hooks_for_target under the exact-content
executables gate. Bundle hook entries carry a local-bundle/<slug> marker
owned by hook_ownership.py, are excluded from drift replay projection,
and survive dependency cleanup; reconcile_deployed_block no longer sweeps
local-bundle claims on a later dependency install.

Refs #3700

Co-authored-by: Copilot App <[email protected]>
apm-spec-waiver: local bundle hook registration reuses the existing hook integrator and executables gate; no OpenAPM normative requirement changes

Co-authored-by: Copilot App <[email protected]>
Copilot AI balanced review requested due to automatic review settings November 19, 2026 05:43
Co-authored-by: Copilot App <[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

Unverified manifest hooks can execute under an existing approval, while ownership and reinstall flaws can preserve stale commands, replace dependency hooks, or overwrite local edits.

5 open issues
What changed in this PR

Addresses #3700 by routing local Claude plugin bundle hooks through APM’s existing hook integrator and exact-content approval gate. Local-bundle uninstall remains out of scope.

Changes:

  • Stages bundle content for canonical hook normalization and target-specific registration.
  • Adds bundle ownership markers and preserves local-bundle deployments during dependency reconciliation.
  • Adds lifecycle and architecture regression coverage, and updates usage and security documentation.
File Description
tests/​unit/​install/​test_install_local_bundle.py Updates expectations for integrator-owned hook routing.
tests/​integration/​test_marketplace_pack_producer_refs_lifecycle.py Removes the obsolete skipped-hooks test.
tests/​integration/​test_local_bundle_hooks_lifecycle.py Covers approval, registration, execution, reinstall, and unrelated dependency cleanup.
tests/​integration/​test_architecture_owner_rule_mutations.py Tests canonical marker and integrator enforcement.
src/​apm_cli/​models/​apm_package.py Adds local-bundle identity to package information.
src/​apm_cli/​integration/​hook_ownership.py Defines bundle markers and adjusts cleanup and drift filtering.
src/​apm_cli/​integration/​hook_integrator.py Uses bundle markers and preserves bundle-owned hook entries.
src/​apm_cli/​install/​services.py Invokes bundle hook integration and records deployed scripts.
src/​apm_cli/​install/​manifest_reconcile.py Retains local-bundle claims during dropped-path reconciliation.
src/​apm_cli/​install/​local_bundle_paths.py Delegates plugin hooks instead of issuing unsupported-hook warnings.
src/​apm_cli/​install/​local_bundle_hooks.py Adds approval-gated staging, normalization, and hook registration.
scripts/​architecture_linter/​checks/​mutation_hook_contract.py Guards canonical bundle marker and registration paths.
packages/​apm-guide/​.apm/​skills/​apm-usage/​package-authoring.md Documents approval requirements for bundle hooks.
docs/​src/​content/​docs/​reference/​cli/​install.md Explains registration and local-bundle uninstall limitations.
docs/​src/​content/​docs/​producer/​pack-a-bundle.md Describes installing approved packed hooks.
docs/​src/​content/​docs/​enterprise/​security.md Documents plugin hooks under the executable trust gate.
docs/​src/​content/​docs/​consumer/​deploy-a-bundle.md Explains hook approval and reinstall behavior.
CHANGELOG.md Adds the bundle-hook fix and restores earlier release-note entries.
.apm/​architecture/​owners/​hooks-integrations.json Extends the canonical hook ownership registry.

Review effort: Balanced

Use an unforgeable local-bundle:: hook marker so a dependency owned by a
'local-bundle' org cannot keep its hooks past uninstall or escape drift
checks (architect, security). Stage only integrity-listed bundle files and
re-verify them, so plugin.json hooks are bound by the approval key
(security). Treat only bundle claims as overwritable (architect nit). Add
dry-run, Copilot and user-scope lifecycle coverage and a marker-namespace
unit test (test coverage). Restore main's CHANGELOG after a merge artifact
and align docs (doc writer). Keep install modules within LOC budgets.

apm-spec-waiver: local bundle hook registration reuses the existing hook integrator and executables gate; no OpenAPM normative requirement changes

Co-authored-by: Copilot App <[email protected]>
@danielmeppiel

Copy link
Copy Markdown
Collaborator Author

APM Review Panel: ship_with_followups

Local plugin bundles now register their hooks through the canonical HookIntegrator, behind exact-content approval. One forgeable ownership marker needs fixing before merge.

panel-mode=full; personas=python-architect,test-coverage-expert,supply-chain-security-expert,doc-writer,apm-ceo

cc Sergio Sisternes (@sergio-sisternes-epam) -- a fresh advisory pass is ready for your review.

This PR closes #3700 within its approved scope. A packed plugin bundle's hooks.json and hooks/ resources used to be silently skipped. Now they go through the same HookIntegrator merge path as a source install, and the existing exact-content local-bundle executables approval gates them. The installed-CLI lifecycle test in tests/integration/test_local_bundle_hooks_lifecycle.py is the strongest evidence. It covers parking under executables: {} with the exact key, approval, settings.json entries identical to a source install, a script that actually runs, audit --ci green, reinstall without duplicates, and survival across install and uninstall of an unrelated hooked dependency. It also failed on unfixed main. The PR also fixes a real bug on main: apm install <other> used to delete bundle files as stale, which would have left a dangling hook command now that hooks register. The hook config is written in one place only (HookIntegrator), and the architecture linter enforces that.

The python-architect and the supply-chain-security-expert independently made the same blocking-severity call, and I agree. At the reviewed head, LOCAL_BUNDLE_HOOK_SOURCE_PREFIX is 'local-bundle/'. dependency_hook_source_marker returns the canonical dependency string, so a dependency at github.com/local-bundle/* or gitlab.com/local-bundle/x produces a marker the code treats as bundle-owned. Those hooks would survive uninstall and skip drift detection. The fix is small and in scope: a prefix no canonical dependency string can produce, plus a unit test proving a dependency literally named local-bundle stays dependency-owned. The security reviewer's second finding is also in scope: stage only integrity-listed files and re-verify them, so what registers is exactly what the user approved.

Two findings cross the approved scope and are deferred deliberately. Binding bundle-owned hook entries to a content hash in the lockfile is a lockfile schema change; until then, editing the settings.json entry itself goes unnoticed by audit (scripts stay hash-checked), and enterprise/security.md must say so in this PR. Centralizing the bundle-protection rule into DeploymentIntent changes the owner contract and belongs in its own PR. Everything else should be folded now: copilot, --global and approved --dry-run coverage, the bundle-only claims nit, the CHANGELOG merge artifact, and the docs accuracy fixes.

Dissent. The doc-writer flagged default gating on the premise that the gate is off by default. That premise is wrong: a consumer with no executables block resolves to {} default-deny, so bundle hooks are parked by default. Keep the default-deny wording; fix only the 'exactly as a source install does' overstatement (the script path differs) and the approval lists that omit hooks.

Aligned with: secure by default: Default-deny parking with an exact-content approval key holds and the lifecycle test proves it; the forgeable marker and unverified root plugin.json are the gaps to fold. governed by policy: Approval reuses the existing exact-content executables gate; document that bundle hook entries in settings.json are outside drift until the lockfile can hash-bind them. portable by manifest: Packed bundles now deliver hooks like source installs; commands and events match, only the script layout differs. multi harness multi host: The integrator runs per hook-capable target; add copilot and --global coverage before claiming parity. pragmatic as npm: Pack, install, approve, and the hooks work; no more stale-file deletion of bundle content on apm install <other>.

Panel summary

Persona B R N Takeaway
Python Architect 1 1 1 Hooks have one writer: everything goes through HookIntegrator. The 'local-bundle/' marker prefix overlaps real dependency names, so those hooks survive uninstall.
Test Coverage Expert 0 3 0 Lifecycle test traps park/approve/reinstall/unrelated-dep survival and audit; gaps: marker namespace, copilot/--global, approved dry-run.
Supply Chain Security Expert 1 2 0 Consent gate holds for apm-packed bundles, but the marker namespace is forgeable and root plugin.json is not bound by integrity or the approval key.
Doc Writer 0 2 1 Docs now say bundle hooks register; fix the CHANGELOG merge artifact, an overstated parity claim and hook-less approval lists.

B = blocking-severity findings, R = recommended, N = nits.
Counts are signal strength, not gates. The maintainer ships.

Top 5 follow-ups

  1. [Supply Chain Security Expert] (blocking-severity) Replace the 'local-bundle/' marker prefix with one no canonical dependency string can produce, and add a unit test that github.com/local-bundle/* and gitlab.com/local-bundle/x dependencies stay dependency-owned. -- At the reviewed head, any dependency under a 'local-bundle' owner gets hooks that survive uninstall and skip drift; the python-architect independently confirmed it.
  2. [Supply Chain Security Expert] Stage only integrity-listed bundle files, including root plugin.json, and re-verify them after staging. -- The approval key is the consent contract; inline plugin.json hooks must not register content the key did not cover.
  3. [Test Coverage Expert] Extend lifecycle coverage to the copilot target and --global scope, and assert an approved-bundle --dry-run writes no hook config. -- Only claude project scope is covered; regressions in the target loop and dry-run on an executables surface would go unnoticed.
  4. [Supply Chain Security Expert] Follow-up: bind bundle-owned hook entries to a lockfile hash of the owned hook slice; in this PR, state the limitation in enterprise/security.md. -- Excluding these entries from drift means settings.json tampering goes undetected; the fix is a lockfile schema change.
  5. [Python Architect] Follow-up: centralize the local-bundle retention rule into DeploymentIntent. Fold now: CHANGELOG merge-artifact cleanup and the bundle-only _prior_bundle_claims filter. -- Duplicated ownership rules drift; centralizing changes the owner contract, so it belongs in its own PR.

Architecture

classDiagram
    direction LR
    class HookIntegrator {
      <<CanonicalOwner>>
      +integrate_hooks_for_target(target, package_info, project_root)
      +_get_hook_source_marker(package_info, project_root, name) str
      +_clean_apm_entries_from_json(path, sidecar)
    }
    class hook_ownership {
      <<VocabularyOwner>>
      +LOCAL_BUNDLE_HOOK_SOURCE_PREFIX
      +local_bundle_hook_source_marker(bundle_id) str
      +is_local_bundle_hook_source(marker) bool
      +dependency_hook_source_marker(dep_ref) str
      +drop_dependency_owned_entries(hooks) bool
      +project_apm_owned_hook_entries(cfg, sidecar) bytes
      +canonicalize_hook_sidecar(bytes) bytes
    }
    class local_bundle_hooks {
      <<Adapter>>
      +integrate_local_bundle_hooks(bundle_info, pack_files) BundleHookResult
      -_bundle_hook_package() PackageInfo
      -_prior_bundle_claims(root) set
    }
    class PackageInfo {
      <<Dataclass>>
      +install_path Path
      +local_bundle_id str
    }
    class services_integrate_local_bundle {
      +integrate_local_bundle(bundle_info, root) dict
    }
    class manifest_reconcile {
      <<Chokepoint>>
      +reconcile_deployed_block()
    }
    class DeploymentLedgerCodec {
      +local_bundle_values(ledger) frozenset
      +local_bundle_scope(values, bundles) frozenset
    }
    services_integrate_local_bundle ..> local_bundle_hooks : calls after file deploy
    local_bundle_hooks ..> HookIntegrator : delegates write
    local_bundle_hooks ..> PackageInfo : builds hook view
    HookIntegrator ..> hook_ownership : marker and cleanup
    manifest_reconcile ..> DeploymentLedgerCodec : bundle scope
    class local_bundle_hooks:::touched
    class hook_ownership:::touched
    class HookIntegrator:::touched
    class manifest_reconcile:::touched
    class PackageInfo:::touched
    class services_integrate_local_bundle:::touched
    classDef touched fill:#fff3b0,stroke:#d47600
Loading
flowchart TD
    A[apm install ./bundle] --> B[integrate_local_bundle]
    B --> C[deploy loop skips plugin hook paths]
    C --> D[integrate_local_bundle_hooks]
    D -->|not approved| W[one warning with exact approval key]
    D -->|approved| F[stage pack_files in tempdir]
    F --> G[validate_legacy_marketplace_plugin to PackageInfo]
    G --> H[HookIntegrator.integrate_hooks_for_target per target]
    H --> J[merge settings.json, sidecar, copy scripts]
    J --> L[record scripts as local-bundle claims]
    M[apm install other-pkg] --> O[reconcile_deployed_block]
    O --> P[local_bundle_scope keeps bundle claims]
    T[apm uninstall dep] --> U[_clean_apm_entries_from_json keeps bundle entries]
Loading

Recommendation

The direction is right and the lifecycle test proves the main promise. Merge once the in-scope folds land: a marker prefix that cannot collide (with its negative unit test), integrity-checked staging of plugin.json, copilot/--global/dry-run coverage, the CHANGELOG cleanup, and the docs corrections including the settings.json tampering limitation in enterprise/security.md. Track lockfile hash-binding of bundle hook entries as the top post-merge follow-up, and DeploymentIntent centralization after it.


Full per-persona findings

Python Architect

  • [blocking] The 'local-bundle/' hook marker prefix can be produced by a real GitHub dependency, so that dependency's hooks are never cleaned up or drift-checked. at src/apm_cli/integration/hook_ownership.py:247
    dependency_hook_source_marker returns 'owner/repo'; 'local-bundle' is a valid org name, so DependencyReference.parse('local-bundle/hooks-pack') yields a marker is_local_bundle_hook_source accepts. The linter guard checks the literal lives in one place, not that the namespaces are disjoint.
    Suggested: use a prefix no canonical dependency string can produce and add a negative unit test.
  • [recommended] The bundle-retention rule is now applied at three sites, and its protection depends on the ledger slice each caller passes. at src/apm_cli/install/manifest_reconcile.py:695
    Suggested: compute bundle values once and pass them through DeploymentIntent, or limit the new step to the local block.
  • [nit] _prior_bundle_claims passes all local_deployed_files as managed_files instead of bundle-only claims. at src/apm_cli/install/local_bundle_hooks.py:152

Test Coverage Expert

  • [recommended] No negative test proves a dependency whose owner is literally 'local-bundle' stays dependency-owned for hook cleanup and drift. at src/apm_cli/integration/hook_ownership.py:247
    Proof (missing at): tests/unit/integration/test_hook_integrator.py::test_dependency_owner_named_local_bundle_is_not_bundle_owned
  • [recommended] Bundle hook registration is proven only for claude in project scope; copilot per-file hooks and --global have no coverage. at tests/integration/test_local_bundle_hooks_lifecycle.py
  • [recommended] No test shows an approved-bundle --dry-run writes no hook config or scripts. at src/apm_cli/install/local_bundle_hooks.py:83

Supply Chain Security Expert

  • [blocking] Remote dependencies can produce the 'local-bundle/' marker, so their hook entries skip drift checks and survive uninstall cleanup. at src/apm_cli/integration/hook_ownership.py:247
    Verified: 'local-bundle/evil', 'gitlab.com/local-bundle/evil' and 'ghe.corp.com/local-bundle/x' all yield markers treated as local-bundle.
    Suggested: a marker containing a character no canonical repo string can contain, plus a regression test.
  • [recommended] Staged root plugin.json is unverified when bundle_files omits it, and inline plugin.json hooks override the approved hooks.json; staging re-reads files after the integrity check. at src/apm_cli/install/local_bundle_hooks.py:127
    Suggested: stage only integrity-listed files and re-hash them after the copy.
  • [recommended] Local-bundle hook entries are excluded from drift and kept on every cleanup with no content binding, and enterprise/security.md does not disclose it. at src/apm_cli/integration/hook_ownership.py:168
    Suggested: hash-bind the owned hook slice in the lockfile (follow-up); document the limitation now.

Doc Writer

  • [recommended] The CHANGELOG [Unreleased] Fixed section gained 21 duplicate long-form entries from a merge resolution; the fix(install): register local plugin bundle hooks through the hook integrator #3897 line is over the length guideline. at CHANGELOG.md:44
  • [recommended] deploy-a-bundle.md says hooks merge 'exactly as a source install does', but the bundle script path differs; only events and commands match. at docs/src/content/docs/reference/cli/install.md:413
  • [nit] governance.md, enterprise/security.md, reference/cli/approve.md and reference/policy-schema.md list only MCP, LSP and canvas for local-bundle exact-key approvals; commands.md's local-bundle paragraph mentions neither hooks nor uninstall. at packages/apm-guide/.apm/skills/apm-usage/governance.md:264

This panel is advisory. It does not block merge. Re-apply the
panel-review label after addressing feedback to re-run.


Generated by autopilot-pr-review-worker. This comment is AI-generated and may contain errors.

Addresses Copilot inline review on src/apm_cli/install/local_bundle_hooks.py:
a reinstall that ships no hooks now removes the bundle's merged entries
through HookIntegrator.reconcile_package_target_restriction; only unedited
bundle claims, in the integrator's project-relative form, may be
overwritten, so a locally edited script survives without --force and a
user-scope reinstall updates changed scripts. Lifecycle traps cover all
three and fail without the guards.

apm-spec-waiver: local bundle hook registration reuses the existing hook integrator and executables gate; no OpenAPM normative requirement changes

Co-authored-by: Copilot App <[email protected]>
Addresses delta panel findings: HookIntegrator.retire_local_bundle_hooks
owns removal of one bundle's merged entries (no placeholder PackageInfo),
and a reinstall whose hooks are unapproved or lack an integrity manifest
now retires the earlier version's entries instead of leaving them active.
Adds traps for a co-resident dependency's hooks, hook-free dry run,
user-scope retirement and the no-manifest skip, and a Copilot per-file
caveat in deploy-a-bundle.md.

apm-spec-waiver: local bundle hook registration reuses the existing hook integrator and executables gate; no OpenAPM normative requirement changes

Co-authored-by: Copilot App <[email protected]>
@danielmeppiel

Copy link
Copy Markdown
Collaborator Author

APM Review Panel: ship_with_followups

PR #3897 now cleans up after local-bundle hooks. A reinstall without hooks, an unapproved reinstall, or one with no integrity manifest each remove the old bundle's hook entries, and a dependency's hooks in the same file stay.

panel-mode=delta; personas=python-architect,supply-chain-security-expert,test-coverage-expert,doc-writer,apm-ceo

cc Sergio Sisternes (@sergio-sisternes-epam) -- a fresh advisory pass is ready for your review.

What changed since the last advisory (cbf2229, ship_with_followups). The delta panel reviewed e8975be. Three items from the last advisory are resolved: the marker collision (local-bundle:: prefix plus a regression unit test), fail-closed staging with an integrity re-check, and the five Copilot inline comments. The panelists then found one new problem from two angles: a hook-bearing reinstall that was skipped (unapproved, or with no integrity manifest) left the previously approved hook entries active, which fails open. The architect also flagged a placeholder PackageInfo used to recover the bundle id. Test coverage reported three gaps (no co-resident hooks in the retirement test, no hook-free dry-run test, no test for the no-manifest skip), and the doc writer noted that "reinstalling replaces them" is untrue for Copilot per-file hook files.

How it was folded. Commit eefc531 (head 4e2268f) folds every one of these. HookIntegrator.retire_local_bundle_hooks now owns removal and shares _retire_source_markers with reconcile_package_target_restriction. Unapproved and no-manifest reinstalls remove the earlier version's entries. New lifecycle traps: an unapproved reinstall removes only the bundle's entries while a co-resident dependency's Write hook survives; a hook-free --dry-run leaves settings.json byte-identical; a hook-free reinstall works with a dependency present and under -g. A deliberate code break made the new guards fail. Exact-head results at 4e2268f: lifecycle 2 passed, test_install_local_bundle.py 78 passed, test_lockfile_union.py 62 passed, test_apm_package.py 47 passed, marker-namespace unit 2 passed, lints clean. No panelist re-read eefc531 itself; its evidence is those exact-head tests.

New finding during the fold. apm install -g applies no executables gate when the user-scope config has no executables block. This was confirmed with a hooked source package, so it applies equally to source installs and bundles; this PR adds nothing new there. It is a pre-existing user-scope gap worth tracking separately. The deferred items each change a contract beyond this PR: lockfile hash-binding of bundle hook entries (lockfile schema), centralizing retention in DeploymentIntent (owner contract, four readers), and per-bundle ownership for Copilot per-file hook removal and apm uninstall.

Dissent. None. All four delta panelists agreed on severity and every finding was recommended, not blocking.

Aligned with: secure by default: the fail-open path is closed and covered by a lifecycle test; the -g gate gap predates this PR. governed by policy: local-bundle hooks are listed in the governance, security, approve and policy-schema docs; hook-entry drift remains a deferred follow-up. portable by manifest: bundle hooks register the same events and commands as a source install, including Copilot per-file hooks and -g. pragmatic as npm: unedited entries are replaced, edited scripts are kept, dependency hooks are left alone.

Panel summary

Persona B R N Takeaway
Python Architect 0 3 0 Marker collision fixed; deferral accepted; retirement should go through an owner method and cover skipped reinstalls (folded in eefc531).
Supply Chain Security Expert 0 1 0 All prior findings resolved; unapproved reinstalls must retire earlier entries (folded in eefc531).
Test Coverage Expert 0 3 0 Prior gaps closed; co-resident, hook-free dry-run and no-manifest traps requested (folded in eefc531).
Doc Writer 0 1 0 Prior findings fixed; Copilot per-file caveat requested (folded in eefc531).

B = blocking-severity findings, R = recommended, N = nits.
Counts are signal strength, not gates. The maintainer ships.

Top 4 follow-ups

  1. [Supply Chain Security Expert] Track that apm install -g applies no executables gate when the user-scope config has no executables block (source packages and local bundles alike). -- A pre-existing secure-by-default gap in user scope, confirmed with a hooked source package.
  2. [Supply Chain Security Expert] Bind local-bundle hook entries to hashes in the lockfile and bring them into audit drift detection. -- An edited hook entry in settings.json is not seen by apm audit today; needs a lockfile schema change.
  3. [Python Architect] Move bundle retention into the DeploymentIntent owner contract, covering all four readers including _prior_bundle_claims. -- Retention logic is spread across call sites; _retire_source_markers is a first consolidation.
  4. [Doc Writer] Give local bundles per-bundle ownership so a reinstall removes stale Copilot per-file hook files and apm uninstall works for local bundles. -- The docs caveat is honest, but cleanup is manual today.

Recommendation

Merge once CI on 4e2268f is green. All delta findings were folded, and exact-head lifecycle tests show each fix works and fails without its guard. Track the -g gate gap, lockfile hash-binding, DeploymentIntent centralization and per-bundle ownership as next steps.


Full per-persona findings

Python Architect

  • [recommended] _retire_bundle_hooks built a placeholder PackageInfo to recover the bundle id. at src/apm_cli/install/local_bundle_hooks.py:173
    Suggested: a HookIntegrator.retire_local_bundle_hooks(bundle_id, project_root, targets) owner method. Folded in eefc531.
  • [recommended] Retirement ran only on a hook-free reinstall; no -g retire trap; skipped reinstalls left prior entries active. at src/apm_cli/install/local_bundle_hooks.py:53
    Folded in eefc531 (retire on unapproved and no-manifest reinstalls; -g hook-free retire trap).
  • [recommended] The three-site retention rule stays deferred; the follow-up should list all four readers including _prior_bundle_claims. at src/apm_cli/install/manifest_reconcile.py:671

Supply Chain Security Expert

  • [recommended] An unapproved or manifest-less hook-bearing reinstall left the previously approved entries active. at src/apm_cli/install/local_bundle_hooks.py:57
    Folded in eefc531, with a lifecycle trap that keeps a co-resident dependency's hook.

Test Coverage Expert

  • [recommended] The hook-free retirement trap ran with no co-resident hooks. at tests/integration/test_local_bundle_hooks_lifecycle.py:190 -- folded in eefc531.
  • [recommended] No hook-free --dry-run trap. at tests/integration/test_local_bundle_hooks_lifecycle.py:191 -- folded in eefc531.
  • [recommended] No test for the no-integrity-manifest skip. -- folded in eefc531 (tests/unit/install/test_install_local_bundle.py::test_bundle_without_integrity_manifest_skips_hooks).

Doc Writer

  • [recommended] "Reinstalling the bundle replaces them" is untrue for Copilot per-file hook files after a hook-free reinstall. at docs/src/content/docs/consumer/deploy-a-bundle.md:104 -- folded in eefc531.

This panel is advisory. It does not block merge. Re-apply the
panel-review label after addressing feedback to re-run.


Generated by autopilot-pr-review-worker. This comment is AI-generated and may contain errors.

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.

2 participants