Repository navigation
fix(pack): plugin bundles carry one rendering per primitive (#3686) - #4693
Daniel Meppiel (danielmeppiel) merged 40 commits into
Conversation
Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot App <[email protected]>
…t rules Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot App <[email protected]>
…6-pack-plugin-renderings
Co-authored-by: Copilot App <[email protected]>
…s LOC budget Co-authored-by: Copilot App <[email protected]>
apm-spec-waiver: plugin bundle rendering selection and local-bundle rule conversion; OpenAPM v0.1 specifies no plugin bundle layout or local bundle install, so no new normative surface. Co-authored-by: Copilot App <[email protected]>
There was a problem hiding this comment.
🟡 Changes recommended
Filename-based deduplication silently drops distinct agents and misses duplicate instructions, while rule selection discards native Cursor rules and leaves incompatible scoping metadata.
2 open issues
What changed in this PR
This PR addresses #3686 by deduplicating plugin-bundle renderings and routing packed APM instructions through existing target converters, extending the bundle-rendering approach used for agents in #3714.
Changes:
- Centralizes rendering preferences and reports dropped files during plugin packing.
- Selects target-native renderings from older bundles and converts packed APM instructions during installation.
- Adds regression coverage, architecture checks, and documentation.
| File | Description |
|---|---|
tests/unit/install/test_install_local_bundle.py |
Tests rendering selection and rule-format routing. |
tests/unit/install/test_architecture_invariants.py |
Adjusts the install-services size budget. |
tests/integration/test_pack_bundle_roundtrip_lifecycle.py |
Adds multi-target pack/install regression coverage. |
tests/fixtures/lifecycle_bug_ledger/bugs/3686.json |
Records the bug and regression tests. |
src/apm_cli/integration/instruction_integrator.py |
Exposes shared rule-content conversion. |
src/apm_cli/install/services.py |
Integrates rendering selection and rule conversion. |
src/apm_cli/install/local_bundle_rules.py |
Converts bundled instructions and warns on invalid YAML. |
src/apm_cli/install/local_bundle_paths.py |
Selects target renderings and instruction formats. |
src/apm_cli/bundle/plugin_layout.py |
Defines rendering identities and preferences. |
src/apm_cli/bundle/plugin_exporter.py |
Filters duplicate renderings and reports omissions. |
scripts/architecture_linter/checks/marketplace_package_and_registration.py |
Checks routing through shared rendering owners. |
packages/apm-guide/.apm/skills/apm-usage/commands.md |
Updates pack and bundle-install guidance. |
docs/src/content/docs/reference/cli/pack.md |
Documents rendering selection and conversion. |
changelog.d/4693.changed.md |
Adds a user-facing changelog entry. |
.apm/architecture/owners/install-deployment.json |
Expands rendering ownership definitions. |
Review effort: Balanced
Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot App <[email protected]>
…s without the APM rendering Review: dotted stems (rv.md + rv.agent.md from one Claude install) are no longer paired, review.agent.instructions.md pairs with its Claude rule, a [claude, cursor] producer keeps py.md and py.mdc, and bundle install names every file it skips for another rendering of the same target file. Co-authored-by: Copilot App <[email protected]>
…ive (#3686) Co-authored-by: Copilot App <[email protected]> # Conflicts: # docs/src/content/docs/reference/cli/pack.md # src/apm_cli/install/local_bundle_paths.py # tests/lifecycle/generator/rules.py # tests/quality/lifecycle_obligations.json
There was a problem hiding this comment.
🟡 Changes recommended
Two critical defects can turn scoped Claude rules unconditional and silently drop distinct commands, while malformed-frontmatter handling lacks regression coverage.
3 open issues
2 resolved since last review
Review effort: Balanced
A [copilot, gemini] producer exports .github/prompts/review.prompt.md as commands/review.md; report .md as its rendering extension so it pairs with commands/review.toml and the bundle keeps one rendering. Co-authored-by: Copilot App <[email protected]>
…ed frontmatter - A Claude rule packed as instructions/py.instructions.md keeps its paths: (InstructionIntegrator.is_native_rule), instead of a second conversion that dropped the scoping. - Regressions: a Claude command and a renamed Copilot prompt with a dotted stem stay distinct; a malformed packed instruction is named, skipped and unclaimed while its sibling installs. Co-authored-by: Copilot App <[email protected]>
…6-pack-plugin-renderings # Conflicts: # docs/src/content/docs/reference/cli/pack.md # src/apm_cli/install/local_bundle_paths.py # tests/lifecycle/generator/rules.py # tests/quality/lifecycle_obligations.json
There was a problem hiding this comment.
🟡 Changes recommended
Bundle rule conversion bypasses decoded-frontmatter security checks, allowing blocked bidirectional characters to be deployed, while superseded files are omitted from skipped counts.
2 open issues
3 resolved since last review
Review effort: Balanced
…ked rules - Distinct native agents rv.md and rv.agent.md from a Claude install both deploy: bundle install strips the extension the packing install gave a dependency file (bundle lockfile deployed_files), not the longest suffix. - Packed rules pass InstructionIntegrator.decoded_frontmatter_blocked (the decoded-frontmatter hidden-character preflight, force policy kept) before native passthrough or conversion; the AC36 guard follows the scan owner. - Superseded renderings count in the install summary's skipped total. Co-authored-by: Copilot App <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
There was a problem hiding this comment.
🔵 Needs a closer look
The switch from approved Claude renderings to APM renderings lacks an R1 ruling in the fetched comments, requiring maintainer confirmation of the scope change and native-host compatibility evidence.
No open issues 🎉
2 resolved since last review
Review effort: Balanced
main's revert left the module at 2101 lines; fold the skills filter into the loop header (no behavior change). Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…d install Instruction targets without a rule transform (Copilot, Grok Build) copy an APM instruction verbatim under its source name, whatever extension the mapping declares. plugin_layout.deployed_file_extension owns that policy; pack rendering identity and bundle install lowering both use it, so a [grok-build, copilot] producer dedupes the two renderings, pack.renderings records .instructions.md, and consumers install py.instructions.md. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
There was a problem hiding this comment.
🔵 Needs a closer look
Human assessment is needed because target-specific path handling assigns different identities to the same nested agent, causing Claude bundle consumers to install both renderings.
No open issues 🎉
1 resolved since last review
Review effort: Balanced
) Valid YAML such as extra: {1: numeric, note: text} makes the decoded frontmatter preflight raise TypeError and aborts the bundle install instead of installing the file and its sibling. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
The decoded-frontmatter preflight serialized metadata with sorted keys, so valid YAML with a numeric key raised TypeError and aborted the bundle install. The scanner now renders every key as text, keeping keys that render alike as separate entries so no value escapes the scan. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…3686) A decoded override character inside a !!set member reaches the scan only as an ASCII escape, so the packed rule installs. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
The decoded-frontmatter preflight left set members and other non-JSON values to str(), whose repr escapes a hidden override character, so the scan never saw it. Set members now become list items and other values and non-string keys become their decoded text. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
There was a problem hiding this comment.
🔵 Needs a closer look
Human assessment is needed because a numeric frontmatter key can trigger an uncaught TypeError that aborts bundle installation rather than allowing valid sibling instructions to install.
No open issues 🎉
1 resolved since last review
Review effort: Balanced


Description
apm pack --format pluginfor a multi-target producer (for exampletargets: [claude, copilot]) shipped one primitive in several renderings:agents/rv.agent.md+agents/rv.md,instructions/py.instructions.md+instructions/py.md(+.mdcwith cursor). A Claude consumer of the bundle kept the Copilot rendering, so anapplyTo-scoped instruction lost its path scoping and install printed a collision warning.Now:
bundle/plugin_layout.py,PLUGIN_RENDERING_PREFERENCE/duplicate_plugin_renderings, applied per package inbundle/plugin_exporter.py) and prints ONE[i]line that names every dropped rendering. A file's rendering is identified by the target that deployed it (deployed_rendering_extension), so distinct primitives with dotted stems are never paired.agents/rv.md). Verified empirically on Copilot CLI 1.0.114: a legacy plugin'sagents/plain.mdloads (--agent probe-plug:plainruns), so Copilot loses nothing.instructions/py.instructions.md,applyTo) when acopilotinstall deployed one; without it, every target's rule rendering is kept (for example[claude, cursor]shipspy.mdandpy.mdc). Ruling R1 (STOP rule): no plugin host loads plugin instructions natively (copilot instruction listis empty forinstructions/andrules/in a legacy plugin), butapm install <bundle>into a Copilot project reads that file as.github/instructions/py.instructions.md; shipping only the Claudepaths:rendering would unscope every instruction for Copilot consumers (shown failing on the real CLI before switching to R1).install/local_bundle_paths.py):bundle_rule_format_idselects the rule format, andinstall/local_bundle_renderings.pyconverts a packedx.instructions.mdthrough the existingInstructionIntegratorconverters (nowInstructionIntegrator.convert_rule_content), so a Claude consumer gets.claude/rules/py.mdwithpaths:, exactly asapm installfrom source renders it. Malformed frontmatter skips that file with a named warning.superseded_bundle_renderings: an older bundle that still carries several renderings deploys the one whose suffix is the target's own extension (Claude keepspy.md, Copilotpy.instructions.md, Cursorpy.mdc), and one[!]line names every skipped file.services.pyLOC budget 1210 -> 1231 (documented intest_architecture_invariants.py, as Render agents from bundles per target (Codex TOML) instead of copying verbatim #3714 did) for the two owner calls in the bundle deploy loop.bundle-native-layout-loweringand its guardinstall-deployment-bundle-native-layoutnow cover rendering selection and rule rendering.Out of scope:
--format apmbundles, new flags, cross-vendor semantics beyond the existing rule converters.Issue and approved scope
Issue: Fixes #3686
Human scope-approval comment: #3686 (comment) (apm-scope:v1, comment id 7066704425). The instruction rendering follows the escalated ruling R1 under that record's "escalate instead" clause.
Does this PR complete the issue, or what remains? Completes it.
Type of change
Testing
Commands (local, via the host guard):
pytest tests/integration/test_pack_bundle_roundtrip_lifecycle.py tests/unit/install/test_install_local_bundle.py tests/unit/test_plugin_exporter_logic.py-> 149 passedtests/unit/install,tests/unit/bundle, plugin exporter / packer / instruction integrator units, local-bundle and pack integration modules, ledger, owner-rule mutation for this guard) -> all passed excepttests/unit/install/test_unix_install_ownership.py/test_install_safety.pycases that hitsubprocess.TimeoutExpired(15 s) at host load ~30; a different subset fails on each run, and those installer scripts are untouched here.scripts/lint-auth-signals.sh,check_complexity_ratchet.py --base-ref origin/main,tests.quality.taxonomy --changed,scripts/lint_architecture_boundaries.py --root ., 2100-line guard -> all cleanChangelog
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: plugin bundle rendering selection and local-bundle rule conversion; OpenAPM v0.1 specifies no plugin bundle layout or local bundle install, so no new normative surface.