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): refuse a Claude dependency whose installed copy is missing (#4755) - #4824
In a Claude project, apm pack silently left out a dependency's instructions routed to AGENTS.md when the dependency's whole apm_modules/<dep> copy was missing. The bundle shipped the dependency's other primitives (for example, a deployed skill) without its locked guidance.
routed_claude_rule_renders (src/apm_cli/integration/instruction_integrator.py) now makes pack refuse in that case, in both pack formats, and write no bundle. The refusal applies when the dependency's lock row records a content_hash, and it tells the user to run apm install. Pack still succeeds only when the lockfile records the dependency edge excluding Claude (its target_subset omits claude). A missing Claude deployment is not treated as proof. Lock rows without a content_hash keep the existing deployed-only behaviour.
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)
Not yet run: under host park mode (rule 17), the full suite runs in CI only. The excludes-Claude control below was added after the fix and has not been re-run locally. A broader local run was killed at about 96% and showed one unidentified failure, so CI is the verdict.
Regression:tests/integration/test_claude_agents_md_pack_lifecycle.py::test_pack_refuses_a_claude_dependency_whose_cache_directory_is_missing (a Claude dependency with a routed always-on instruction plus a deployed skill, with apm_modules/<dep> deleted). Before the fix it failed at assert 0 != 0: pack exited 0 with "Packed 2 file(s)" and shipped the skill without the guidance.
Local results: before the rebase onto main, the whole pack lifecycle file passed (9 tests, including the regression).
Lint: clean on the rebased branch (ruff 0.15.12 check and format, pylint R0801, auth signals, complexity ratchet, assertion ratchet, taxonomy, architecture boundaries).
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.
In a Claude project, pack skipped routed-rule rendering when a shipped
dependency's whole apm_modules/<dep> directory was missing, so both
pack formats shipped its skill without the guidance routed to
AGENTS.md. For an attested lock row, pack now refuses with the
'apm install' remedy unless the lock proves Claude receives nothing
from the dependency: its edge excludes Claude, or it deployed a skill,
agent, command or prompt for another target but nothing for Claude.
Closes#4755
Co-authored-by: Copilot App <[email protected]>
…agment to #4824
Co-authored-by: Copilot App <[email protected]>
apm-spec-waiver: pack refusal for a missing dependency cache is APM CLI bundling behaviour; no OpenAPM v0.1 requirement governs it.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The target-exclusion check can silently omit Claude guidance after cache deletion and incorrectly reject Copilot-only instruction packages, requiring authoritative exclusion records and regression coverage for both pack formats.
This PR addresses #4755 by making apm pack reject missing installed dependencies when their locked Claude guidance cannot be rendered, rather than silently producing an incomplete bundle.
Changes:
Adds a missing-source check with apm install remediation and lock-based Claude-exclusion handling.
Adds lifecycle coverage for refusal and excluded-Claude behavior in both pack formats.
Documents the user-visible fix in a changelog fragment.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Inferring Claude exclusion from missing deployments can silently omit required guidance after cache deletion, while incomplete target and layout evidence also blocks valid Copilot-only dependencies.
A Claude-excluding Copilot dependency installed with --legacy-skill-paths records .github/skills/..., but these prefixes recognize only the default .agents/skills/... layout. If it has no other qualifying deployments, deleting its cache makes both pack formats incorrectly refuse it. Use skill_layout.with_every_skill_layout to recognize both supported layouts, and add the legacy-layout variant to the exclusion control.
…pendency cache (#4755)
A non-Claude deployment never proved Claude was excluded: a collision can
block the Claude copy while another target deploys, and Claude has no
prompts primitive. Drop that inference so pack refuses unless the lock
records the edge excluding Claude; the control now excludes Claude on the
edge, and a prompt-only regression covers the inference.
Co-authored-by: Copilot App <[email protected]>
… regenerate
Keeps #4843's native observation (a root half plus the enabledPlugins declaration half, native_gaps). Builds _surface_hits on train 5's entry-aware surfaces (JsonEntry, MergedHooks) and _observable. projected_cells keeps #4843's native projection plus the shared-root loose skill (#4559). #4751fixed#4744, so the user-scope bin target-change cell drops its strict known and is required (known 9 -> 8, L15).
Co-authored-by: Copilot App <[email protected]>
…s missing (microsoft#4850)
Since microsoft#4824, pack refused a missing apm_modules/<dep> unless the lock
recorded the edge excluding Claude, so a package excluding Claude through
its own targets: was over-refused. Install now records that restriction on
the lock row (package_targets, decided by target_filter.recorded_package_targets),
and pack consults it through target_filter.recorded_targets_exclude. Old
lockfiles load unchanged (an absent field proves nothing, so pack still
fails closed). _copy_subset_pairings moves to models/dependency/subsets.py
to keep lockfile.py under its size cap.
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
In a Claude project,
apm packsilently left out a dependency's instructions routed toAGENTS.mdwhen the dependency's wholeapm_modules/<dep>copy was missing. The bundle shipped the dependency's other primitives (for example, a deployed skill) without its locked guidance.routed_claude_rule_renders(src/apm_cli/integration/instruction_integrator.py) now makes pack refuse in that case, in both pack formats, and write no bundle. The refusal applies when the dependency's lock row records acontent_hash, and it tells the user to runapm install. Pack still succeeds only when the lockfile records the dependency edge excluding Claude (itstarget_subsetomits claude). A missing Claude deployment is not treated as proof. Lock rows without acontent_hashkeep the existing deployed-only behaviour.Issue and approved scope
Issue: Fixes #4755
Human scope-approval comment: #4755 (comment)
Does this PR complete the issue, or what remains? It completes the issue.
Type of change
Testing
Not yet run: under host park mode (rule 17), the full suite runs in CI only. The excludes-Claude control below was added after the fix and has not been re-run locally. A broader local run was killed at about 96% and showed one unidentified failure, so CI is the verdict.
tests/integration/test_claude_agents_md_pack_lifecycle.py::test_pack_refuses_a_claude_dependency_whose_cache_directory_is_missing(a Claude dependency with a routed always-on instruction plus a deployed skill, withapm_modules/<dep>deleted). Before the fix it failed atassert 0 != 0: pack exited 0 with "Packed 2 file(s)" and shipped the skill without the guidance.::test_pack_keeps_packing_a_dependency_that_excludes_claude_without_its_cache(edgetargets: [copilot]).::test_pack_refuses_when_only_a_prompt_was_deployed_without_its_cache.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}regenerated