Repository navigation
fix(bundle): align local bundle and pack gate coverage - #4645
Merged
Daniel Meppiel (danielmeppiel) merged 14 commits intoNov 22, 2026
Merged
Daniel Meppiel (danielmeppiel) merged 14 commits into
Daniel Meppiel (danielmeppiel) merged 14 commits into
Conversation
Co-authored-by: Copilot App <[email protected]>
…s not carry A dependency's hooks file that apm.lock.yaml attests (deployed_files and its hash) packs into hooks/, yet pack still warned that the dependency's hook config was not attested and would not be packed. The warning now names only config no packed file carries: hook config when no attested hooks file packs (for example a shared settings merge, or a format that drops hooks), and MCP config, which install never attests. Unattested cache bytes still never ship. Co-authored-by: Copilot App <[email protected]>
…pack apm install <bundle> now checks the bundle's package name (as _local/<name>, so **/<name> matches) and every package its embedded apm.lock.yaml records against dependencies.deny through the shared install policy preflight, and refuses a denied bundle before any file is written, with the same violation line and policy hint as a denied git dependency. These packages meet the deny list only. apm pack (including --dry-run and --archive) runs the same preflight before packing: the project's declared dependencies as install judges them, and every locked package against dependencies.deny. A refused package fails the pack with "Pack blocked by org policy: <pkg>" and exit 1; nothing is packed. The bundle admission owner registers bundle_policy_subjects and the pack entry point, and its guard now requires both routes. Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel)
requested a review
from Sergio Sisternes (sergio-sisternes-epam)
as a code owner
November 21, 2026 16:26
apm-spec-waiver: applies the existing executables gate and org dependency deny to local bundle install and pack; no new contract. Co-authored-by: Copilot App <[email protected]>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Malformed lockfiles can bypass dependency admission, and canvas retirement can follow directory symlinks to delete files outside the project.
5 open issues
Fail closed when a present lockfile cannot be parsed · New Use containment-checked cleanup when retiring canvas files · New Resolve marketplace declarations before checking the allow-list · New Include warn-mode policy diagnostics in pack results · New Reconcile canvas deployments using bundle-specific ownership · New
What changed in this PR
This PR extends APM’s existing policy and executable gates to local bundle installation and packing, bringing those paths closer to Git dependency installation.
Changes:
- Checks local bundle identities and embedded dependencies against org deny policy, and adds policy preflight before packing.
- Adds canvas approval reporting and retirement for local bundles.
- Refines unpacked-config warnings and updates regression tests, architecture guards, and documentation.
| File | Description |
|---|---|
tests/unit/test_plugin_exporter.py |
Tests warnings against packed hook and MCP content. |
tests/unit/policy/test_dependency_identity_case.py |
Tests bundled dependency subjects and remedies. |
tests/unit/install/test_bundle_policy_subjects.py |
Tests bundle identities and embedded lockfile handling. |
tests/quality/lifecycle_obligations.json |
Updates a source evidence line reference. |
tests/lifecycle/security/test_policy_outcomes.py |
Expects policy refusal for denied local bundles. |
tests/lifecycle/generator/rules.py |
Updates the corresponding evidence line reference. |
tests/integration/test_org_dependency_deny_bundle_pack_lifecycle.py |
Covers bundle and pack refusal without output writes. |
tests/integration/test_local_bundle_canvas_gate_lifecycle.py |
Covers canvas approval, deployment, and retirement. |
tests/integration/test_architecture_owner_rule_mutations.py |
Tests policy and canvas routing guards. |
src/apm_cli/policy/policy_checks.py |
Includes bundled packages in dependency deny checks. |
src/apm_cli/policy/install_preflight.py |
Forwards bundled dependency subjects. |
src/apm_cli/install/services.py |
Delegates canvas gating to the new helper. |
src/apm_cli/install/local_bundle_handler.py |
Supplies policy subjects and records canvas approval types. |
src/apm_cli/install/local_bundle_canvas.py |
Implements local bundle canvas gating and retirement. |
src/apm_cli/install/bundle_admission.py |
Collects bundle and embedded dependency identities. |
src/apm_cli/bundle/plugin_exporter.py |
Makes config warnings reflect packed hook files. |
src/apm_cli/bundle/packer.py |
Runs policy preflight before format dispatch. |
src/apm_cli/bundle/pack_policy.py |
Implements pack dependency-policy preflight. |
src/apm_cli/bundle/export_common.py |
Exposes the shared config-warning helper. |
src/apm_cli/bundle/agent_plugin_exporter.py |
Reuses the shared config-warning helper. |
scripts/architecture_linter/checks/marketplace_pack_plugin_manifests.py |
Updates the permitted MCP inspection helper. |
scripts/architecture_linter/checks/install_trust_integrity.py |
Guards bundle identity and pack policy routing. |
scripts/architecture_linter/checks/install_lsp_plugin.py |
Guards canvas approval routing. |
scripts/architecture_linter/checks/install_entry_and_commit.py |
Recognizes pack policy as an authorized preflight caller. |
packages/apm-guide/.apm/skills/apm-usage/governance.md |
Documents bundle and pack deny enforcement. |
docs/src/content/docs/reference/policy-schema.md |
Explains bundle policy identities and coverage. |
docs/src/content/docs/reference/cli/pack.md |
Documents policy refusal and refined config warnings. |
docs/src/content/docs/reference/cli/install.md |
Documents local bundle deny checks. |
changelog.d/4645.fixed.md |
Summarizes the user-visible gate changes. |
.apm/architecture/owners/install-deployment.json |
Expands ownership records for policy and canvas handling. |
Review effort: Balanced
…read; observable test outcomes A bundle apm.lock.yaml that exists but cannot be parsed made the org dependency check judge the bundle as recording no packages. It now refuses the install and asks for a repack; a bundle without a lockfile is still accepted. The new pack-warning and bundle-subject tests assert on printed output or the refusal, and the guard mutation test reads the source it mutates, so the assertion-quality ratchet holds. Co-authored-by: Copilot App <[email protected]>
… per bundle A local bundle's canvas extensions were retired only when that same bundle was reinstalled, and that retirement matched rows by extension path, so a blocked bundle could remove another bundle's extension. An install that deploys a bundle's extensions now records them with the bundle's slug and approval key beside its hooks record (hook_ownership). The scope re-check that install, update and prune run for bundle hooks also retires canvas extensions current executables trust no longer admits (gate on, deny, org layer), and apm audit --ci's local-bundle check reports them. Retirement touches only the recorded bundle's rows; an edited file is kept, and a row without a recorded hash keeps its file, row and record. The hook-trust guard now requires these routes. Co-authored-by: Copilot App <[email protected]>
apm pack ran the full install preflight (allow list, require, pins) but only when the lockfile held a package. It now checks the declared dependencies and every locked package against dependencies.deny alone, whatever the lock holds, through the shared preflight (DenyOnlySubjects). A bundle that records a denied package is refused on local install. Re-anchors the lifecycle rule citation the preflight move shifted. Co-authored-by: Copilot App <[email protected]>
Closed
6 of 17 tasks
…r bundle Committed lock rows and bundle records are now acted on only when they name a path inside the target's canvas or hooks root, with no '.'/'..' segment and no linked component, resolving inside the project (contained_bundle_path). This covers bundle canvas retirement, per-file hook files and copied hook scripts; a symlinked extension directory is never followed. Canvas retirement is per bundle: it touches only the retired bundle's rows, never a file another bundle's record still lists, and the record keeps what was not retired. A reinstall retires the extensions the new bundle content no longer ships (renamed, removed, or no canvas at all). The lockfile is read for canvas only when a canvas record or root exists. The hook-trust guard requires the containment routes. Co-authored-by: Copilot App <[email protected]>
Under enforcement: warn the org deny findings were collected by a discarded logger, so pack shipped the dependency without a word. They now become pack warnings: printed, and listed in --json warnings. The unpack policy test packs its producer bundle outside org policy, since pack itself now refuses the denied dependency. Co-authored-by: Copilot App <[email protected]>
Moves the declared executable types helper beside the other local bundle path helpers; no behaviour change. Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel)
deleted the
danielmeppiel-bundle-pack-gate-coverage
branch
November 22, 2026 08:21
This was referenced Nov 22, 2026
Merged
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
This PR makes local bundle install and
apm packhonour the same gates as install from a git dependency.install/local_bundle_canvas.py(gate_bundle_canvas) now owns the canvas feature flag and the executables gate for local bundles.apm approve <bundle>now listcanvaswhen the bundle ships it.dependencies.denyfor local bundle install. The bundle's own name is checked as_local/<name>, and so is every package in its embedded lockfile.admit_bundle->run_policy_preflight->_check_dependency_denylistpath.denyonly;allow,requireand pins still judge the project's own declarations.apm packrefuses content from a denied dependency.bundle/pack_policy.pyruns before any format is packed, so it covers--dry-run,--archiveand every format. It applies the same refusal that install, update and lock use:Pack blocked by org policy: <pkg>, exit 1, nothing packed.Docs:
reference/cli/install.md,reference/cli/pack.md,reference/policy-schema.md,apm-usage/governance.md.Issue and approved scope
Issue: none; scope set by the maintainers. Maintainer ruling: the org dependency deny applies to local bundles, and pack refuses denied content.
Human scope-approval comment: approved by the maintainers.
Does this PR complete the issue, or what remains? It completes the local bundle and pack gate alignment.
Type of change
Testing
Tested locally
All existing tests pass
Added tests for new functionality (if applicable)
tests/integration/test_local_bundle_canvas_gate_lifecycle.pycovers:approve --pendinglists canvasaudit --citests/integration/test_org_dependency_deny_bundle_pack_lifecycle.pycovers a denied local bundle install and pack under org deny. It fails on main and passes here.Unit tests cover the bundle policy subjects, dependency identity case and pack warning.
tests/lifecycle/security/test_policy_outcomes.pychanges 8 cells: the p-exec bundle under a policy that denies p-exec now expects the refusal.Changelog
changelog.d/<pr>.<section>.md, holdingone line: user-visible effect first, 25 words or fewer, ending with
(#PR); breaking changes only under upgrade notes; no Highlights; nonew lines under
## [Unreleased]. Seechangelog.d/README.mdand.github/instructions/changelog.instructions.md.Spec conformance (OpenAPM v0.1)
CONFORMANCE.{md,json}regeneratedapm-spec-waiver: applies the existing executables gate and org dependency deny to local bundle install and pack; no new contract.