[BUG] Lockfile deployed_files records inactive-target paths from package-declared targets; audit deployed-files-present unfixable on fresh checkouts
Describe the bug
When a dependency package declares targets: in its own apm.yml that include harnesses the consumer has NOT activated, the consumer's apm.lock.yaml records deployed_files entries for those inactive targets — but apm install/apm update (correctly) never writes them. apm audit --ci then fails deployed-files-present on any fresh checkout, permanently.
Example: microsoft/azure-skills, microsoft/skills-for-copilot-studio, and microsoft/skills-for-fabric declare windsurf among their package targets. A consumer with:
targets:
- claude
- codex
- copilot
- cursor
- gemini
gets 67 .windsurf/skills/... entries in the lock's deployed_files (24 + 33 + 10) that never exist on disk:
│ deployed-files-present │ 67 deployed file(s) missing -- run 'apm install' to restore │
Running apm install does not restore them (windsurf is not an active target, so nothing writes them) — the message loops.
To Reproduce
- Consumer
apm.ymlwith the 5 targets above anddependencies.apm: [microsoft/azure-skills]. apm update --yes microsoft/azure-skills(orapm installon first resolve).- Inspect the lock:
.windsurf/...paths appear under the dep'sdeployed_files; no.windsurf/directory exists. apm audit --ci --no-fail-fast→deployed-files-presentfails with those paths.
Also tried: consumer-side per-dep restriction
- git: https://github.com/microsoft/azure-skills.git
targets: [claude, codex, copilot, cursor, gemini]
— fresh re-resolution still records the .windsurf/ entries.
A likely-related symptom: the drift check's cache replay produces different bytes than the install write path for ~100 of the same packages' files (fabric/copilot-studio SKILL.mds), so drift also fails on a state that install itself just wrote. Both smell like the same root: lock/replay bookkeeping uses package-declared targets where install uses the active intersection.
Expected behavior
deployed_files in the lock should record the files actually deployed for the active install-target intersection (the same set install writes), so apm audit is self-consistent with apm install output on a fresh clone.
Environment
- OS: macOS (darwin-arm64)
- APM Version: reproduced on 0.22.0 and 0.24.0 (release binary, checksum-verified)
Logs
[>] Replaying install (cache-only)...
[!] azure-skills: filename-based target routing is deprecated.
[+] Replayed 21 package(s)
[>] Diffing scratch vs working tree...
[!] Drift detected: 110 file(s)
...
│ │ deployed-files-present │ 67 deployed file(s) missing -- run │
│ │ │ 'apm install' to restore │
[x] 2 of 9 check(s) failed
Additional context
The consumer repo gitignores .windsurf/ (windsurf unused), so the ghost entries make every fresh checkout / CI run audit-red while the original working copy passes only when stale ignored files happen to exist. Happy to test a fix or provide the full lock excerpt.
Possibly related for triage: #2031 (per-package targets: for hook routing) touches the same targets-handling subsystem — this issue is the lockfile-bookkeeping face of it (deployed_files recorded from package-declared targets rather than the active install intersection).
Triage decision
accept
Proposed labels
theme/governance
area/lockfile
area/ci-cd
type/bug
status/accepted
priority/high
Milestone
null -- no current patch milestone open against 0.24.0.
Suggested next action
Scope deployed_files recording in the lockfile to the active install-target intersection (the files apm install actually writes), not the package-declared target set.
Suggested issue comment
Thanks for the thorough report and for reproducing across two releases (0.22.0 and 0.24.0) -- this confirms it is not a regression but a systematic gap.
This is confirmed as a bug. The `deployed_files` entries in `apm.lock.yaml` should record the files that were actually deployed for the active install-target intersection -- the same set that `apm install` writes. When a dependency package declares targets that the consumer has not activated (Windsurf in your case), the lock should not record those paths. Because it does, `apm audit --ci` fails `deployed-files-present` permanently on any fresh checkout, and `apm install` cannot fix it because windsurf is not an active target -- a loop that has no exit.
This is a CI reliability blocker. The likely root cause (lock recording uses package-declared targets where install uses the active intersection) is the same pattern you identified for the drift check symptom, so both may share a fix.
Thank you for the offer to test a fix -- we will flag this issue when a PR is available.
Per-lens notes (collapsed)
DevX UX Expert -- User-Need Reviewer
The user is unable to use apm audit --ci reliably because the lockfile records paths for inactive targets. The audit failure is permanent and unfixable via any available apm command. This is a critical CI reliability issue: every fresh checkout fails the audit check, rendering the lock-based integrity verification unusable. The user correctly identifies both the root cause and a secondary related symptom (drift check producing different bytes for the same state).
Supply Chain Security Expert -- Risk-Surface Reviewer
The lockfile is APM's integrity verification artifact for installed state. When the lockfile records paths that do not and cannot exist (inactive-target files), the integrity check (apm audit --ci) is permanently broken. This directly undermines the governance guarantee that the lock provides -- teams running apm audit --ci in CI get false failures that cannot be resolved, which forces them to either disable the audit check or ignore it. theme/governance applies strongly. area/lockfile and area/ci-cd are both implicated.
OSS Growth Hacker -- Contributor-Tone Reviewer
Author Cianai has author_association: NONE. The report is technically sophisticated: the author identifies the root cause hypothesis, provides the exact failing audit output with counts, names the affected packages, tries a consumer-side workaround (per-dep target restriction) that fails, and reports a related drift symptom. Tone should be warm and validate the quality of the diagnosis. The "happy to test a fix" offer should be acknowledged.
Python Architect -- Architecture Reviewer
Not activated -- the fix is bounded to the lock-recording path in apm install/apm update. The design is clear: record only the files in the active install-target intersection. No new interface or cross-module design decision needed. The Python Architect notes that the drift check symptom may share the same root and should be investigated together with the fix.
Doc Writer -- Documentation Reviewer
Not activated -- bug fix to existing lock/audit behavior. No new user-facing documentation needed.
APM CEO -- Triage Arbiter
High-severity CI blocker. The lock/audit pipeline is APM's integrity guarantee and it must be self-consistent with the install output. priority/high because this renders apm audit --ci unusable in multi-package environments where dependencies declare more targets than the consumer. Milestone null -- no open patch milestone for 0.24.x.
{
"decision": "accept",
"decision_detail": "",
"theme": "theme/governance",
"areas": ["area/lockfile", "area/ci-cd"],
"type": "type/bug",
"status": "status/accepted",
"priority": "priority/high",
"preserved_labels": [],
"milestone": null,
"next_action": "Scope deployed_files recording to the active install-target intersection so apm audit --ci is self-consistent with apm install on fresh checkouts.",
"comment_markdown": "Thanks for the thorough report and for reproducing across two releases (0.22.0 and 0.24.0) -- this confirms it is not a regression but a systematic gap.\n\nThis is confirmed as a bug. The `deployed_files` entries in `apm.lock.yaml` should record the files that were actually deployed for the active install-target intersection -- the same set that `apm install` writes. When a dependency package declares targets that the consumer has not activated (Windsurf in your case), the lock should not record those paths. Because it does, `apm audit --ci` fails `deployed-files-present` permanently on any fresh checkout, and `apm install` cannot fix it because windsurf is not an active target -- a loop that has no exit.\n\nThis is a CI reliability blocker. The likely root cause (lock recording uses package-declared targets where install uses the active intersection) is the same pattern you identified for the drift check symptom, so both may share a fix.\n\nThank you for the offer to test a fix -- we will flag this issue when a PR is available."
}
Triage status: agentic proposal pending human ratification. Silence is approval. Maintainers can:
- Override any label or milestone above by editing it directly -- human edits are authoritative and will not be reverted on subsequent runs.
- Re-trigger triage by applying the
status/needs-triagelabel, or by removingstatus/triagedto enroll the issue in the next daily sweep.Posted by the Triage Panel workflow. See .apm/skills/apm-triage-panel for the panel skill.
Generated by Triage Panel · 184.7 AIC · ⌖ 18.6 AIC · ⊞ 9.2K · ◷