You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(pack): omit a gate-parked canvas dependency instead of refusing with a looping remedy (#4714) - #4729
When the executables gate parks a git dependency's canvas extension (unapproved, apm deny, or approval revoked after deploy), apm pack (including --dry-run) used to exit 1. The error said "the lockfile records no deployed files ... stale or partial install. Run 'apm install' ...". Running apm install changed nothing, because the gate still parked the canvas, so the remedy looped.
Owner.bundle/plugin_exporter.py_cache_would_contribute_primitives decides whether a dependency with no deployed_files is a provenance gap. Both exporters share it through export_common. A new helper, _gate_parked_types, reads the lock row's exec_status (gated_pending_approval or denied) and exec_allowed_types. A canvas the lock records as withheld is not a provenance gap, so pack omits it, just as it already omits parked hooks and LSP servers. A canvas the lock records as deployed but with no files is still refused as a stale install (negative control in the owner table test).
One [!] line per parked canvas, with a remedy that works._warn_parked_executables prints, for example: [!] dependency lifecycle/o-canvas: canvas extension(s) not packed (not approved in executables.allow). Run 'apm approve lifecycle/o-canvas' to approve its canvas extensions, then run 'apm install' to deploy them. For a deny it points to apm policy explain <pkg>. The wording comes from the same owner install uses: executable_skip_reason in install/exec_gate.py now delegates to a pure withheld_executable_reason.
Docs: reference/cli/pack.md and apm-guide commands.md.
Out of scope, as proposed: approval semantics and the pack format.
Human scope-approval comment: pending. The P4 lead proposed the scope ("pack succeeds and packs only what install deployed; one [!] line naming the parked canvas with a remedy that works; every printed hint executed; out of scope: approval semantics and pack format") and asked Intake for the apm-scope:v1 record on #4714. This PR will follow that record if it differs.
Does this PR complete the issue, or what remains? It completes the issue.
Type of change
Bug fix
New feature
Documentation
Maintenance / refactor
Testing
Tested locally
All existing tests pass
Added tests for new functionality (if applicable)
promise: P-INV-I4 -- pack never ships an executable the gate withheld, and a parked one never blocks packing what was deployed; P-INV-I8 -- every printed hint reaches its stated outcome
cell: OP=pack SRC=git PRIM=canvas SCOPE=project GATE={unapproved-exec, denied-executable, revoked-after-deploy}
owner: bundle/plugin_exporter.py _cache_would_contribute_primitives / _gate_parked_types; remedy wording install/exec_gate.py withheld_executable_reason
instrument: target scenario -> tests/lifecycle/scenarios/test_pack_parked_executables.py::test_pack_omits_a_parked_canvas_and_its_hint_restores_it[*] (new: no pack-gate scenario existed; the T1 generated cells are credited by the M-GATE pack spine in #4700, so this module credits none)
oracles: exit 0, canvas files absent from the pack listing, exactly one [!] line naming the parked canvas, I1-I9 per step
failing-before: all 3 rows -> "R: 'pack --dry-run' exited 1, expected [0] ... Run 'apm install' to record provenance"
passing-after: 3 passed
hints executed: unapproved -> 'apm approve' then 'apm install' -> canvas deployed and packed; denied / revoked -> 'apm policy explain', then the 'apm approve' it names, then 'apm install' -> canvas deployed and packed
ledger: tests/fixtures/lifecycle_bug_ledger/bugs/4714.json
Commands run locally, on main merged at d6484f1 (#4645 and #4713 included):
The three cells, the owner table in tests/unit/bundle/test_plugin_exporter_canvas.py, the exporter/packer unit tests and 59 pack, bundle and canvas integration modules: 1101 passed, 3 skipped.
tests/unit/install and tests/unit/core: passed, apart from failures unrelated to this change (installer-script timeouts under host load, and an ADO auth test that reaches the network).
Lint mirror: [email protected] check and format --check, pylint R0801, lint-auth-signals.sh, the complexity ratchet, taxonomy --changed, the assertion-quality ratchet, the architecture linter, the 2100-line guard and tests.lifecycle.generator --check. All clean.
Changelog
One fragment per section, changelog.d/<pr>.<section>.md, holding
one line: user-visible effect first, 25 words or fewer, ending with (#PR); breaking changes only under upgrade notes; no Highlights; no
new lines under ## [Unreleased]. See changelog.d/README.md and .github/instructions/changelog.instructions.md.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The remediation warnings can target the wrong dependency, misreport canvas trust status, and recommend commands that cause agent-plugin packaging to fail.
This PR addresses #4714 by letting apm pack omit gate-parked canvas dependencies instead of refusing with an ineffective apm install remedy. It preserves provenance checks for content expected to have been deployed.
Changes:
Recognizes withheld canvas content and adds shared warnings to both plugin exporters.
Reuses install’s remediation wording for pack warnings.
Adds regression coverage, a bug-ledger entry, documentation, and a changelog fragment.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Canvas handling grants an exemption for nondeployable files and omits the experimental-flag enablement step from approval guidance, suppressing provenance refusals or causing a repeating failure.
No open issues 🎉
2 previously missed issues
In code that hasn't changed since last review
Require a deployable bundle before exempting a parked canvas
src/apm_cli/bundle/plugin_exporter.py:927
A package with unapproved hooks and .apm/extensions/demo/icon.txt, but no extension.mjs, is treated as having a parked canvas here even though install discovers no canvas bundle. This suppresses the provenance-gap refusal and prints a canvas approval remedy that cannot deploy those files. Use CanvasIntegrator.find_canvas_bundles() to confirm a deployable bundle before granting the exemption or emitting the warning.
Enable the canvas feature before suggesting approval and installation
src/apm_cli/bundle/plugin_exporter.py:949
With the experimental canvas flag disabled, the printed approve/install commands cannot deploy the canvas because its integrator returns immediately. Approval changes the lock status to deployed, so the next pack loses this exemption and again fails with the looping provenance remedy. Include apm experimental enable canvas before the approval/install steps when the flag is disabled, and cover that hint sequence in a regression test.
…_reasons.py (exec_gate.py 1007 -> 945 LOC)
Main 387ae90 failed test_no_install_module_exceeds_loc_budget after
#4724 and #4729 both grew exec_gate.py. executable_skip_reason and
withheld_executable_reason (the wording install and pack print for a
parked executable) move to their own module under the
executable-trust-context owner; callers import it directly. No budget raise.
Co-authored-by: Copilot App <[email protected]>
…ells are required
Union of the denied-dependency refusals (compile from main, mcp-install from the T-1 car). #4729fixed#4714, so KNOWN_PACK is empty and G1|pack|canvas|{unapproved-exec,denied-executable,revoked-after-deploy}|project earn receipts.
Co-authored-by: Copilot App <[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
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
When the executables gate parks a git dependency's canvas extension (unapproved,
apm deny, or approval revoked after deploy),apm pack(including--dry-run) used to exit 1. The error said "the lockfile records no deployed files ... stale or partial install. Run 'apm install' ...". Runningapm installchanged nothing, because the gate still parked the canvas, so the remedy looped.bundle/plugin_exporter.py_cache_would_contribute_primitivesdecides whether a dependency with nodeployed_filesis a provenance gap. Both exporters share it throughexport_common. A new helper,_gate_parked_types, reads the lock row'sexec_status(gated_pending_approvalordenied) andexec_allowed_types. A canvas the lock records as withheld is not a provenance gap, so pack omits it, just as it already omits parked hooks and LSP servers. A canvas the lock records as deployed but with no files is still refused as a stale install (negative control in the owner table test).[!]line per parked canvas, with a remedy that works._warn_parked_executablesprints, for example:[!] dependency lifecycle/o-canvas: canvas extension(s) not packed (not approved in executables.allow). Run 'apm approve lifecycle/o-canvas' to approve its canvas extensions, then run 'apm install' to deploy them.For a deny it points toapm policy explain <pkg>. The wording comes from the same owner install uses:executable_skip_reasonininstall/exec_gate.pynow delegates to a purewithheld_executable_reason.reference/cli/pack.mdand apm-guidecommands.md.Out of scope, as proposed: approval semantics and the pack format.
Issue and approved scope
Issue: Fixes #4714
Human scope-approval comment: pending. The P4 lead proposed the scope ("pack succeeds and packs only what install deployed; one
[!]line naming the parked canvas with a remedy that works; every printed hint executed; out of scope: approval semantics and pack format") and asked Intake for theapm-scope:v1record on #4714. This PR will follow that record if it differs.Does this PR complete the issue, or what remains? It completes the issue.
Type of change
Testing
Commands run locally, on main merged at d6484f1 (#4645 and #4713 included):
tests/unit/bundle/test_plugin_exporter_canvas.py, the exporter/packer unit tests and 59 pack, bundle and canvas integration modules: 1101 passed, 3 skipped.tests/unit/installandtests/unit/core: passed, apart from failures unrelated to this change (installer-script timeouts under host load, and an ADO auth test that reaches the network).[email protected] checkandformat --check, pylint R0801,lint-auth-signals.sh, the complexity ratchet, taxonomy--changed, the assertion-quality ratchet, the architecture linter, the 2100-line guard andtests.lifecycle.generator --check. All clean.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)
docs/src/content/docs/specs/openapm-v0.1.mdupdated(new/changed
<a id="req-XXX"></a>anchor + prose + Appendix Crow).
docs/src/content/docs/specs/manifests/openapm-v0.1.requirements.ymlupdated.
@pytest.mark.req("req-XXX")test undertests/spec_conformance/added or extended.CONFORMANCE.{md,json}regenerated viauv run --extra dev python -m tests.spec_conformance.gen_statementand committed.