Repository navigation
fix(install): preserve skills during cold replay without deployment receipts - #3490
Conversation
Preserve existing deployed files and lock contents when cold overlapping skill replay lacks local overwrite authority. Propagate safety diagnostics from every physical target and cover frozen/ordinary replay, fresh clones, historical receipts, and user scope. Refs #3372 Co-authored-by: Copilot App <[email protected]>
Promote the hermetic #3372 regression matrix through the existing lifecycle_smoke selector and record the intentional safe-failure recovery in the changelog. Co-authored-by: Copilot App <[email protected]>
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues block approval of the change that rejects missing-receipt skill writes before cleanup or lockfile replacement.
No open issues 🎉
What changed in this PR
This PR addresses #3372 by making refused skill writes without local deployment receipts fail through the existing install outcome gate, before stale cleanup or lockfile replacement. It preserves warning-only handling for local edits with valid receipts and keeps explicit --force recovery.
Changes:
- Promote missing-baseline refusals to errors and propagate diagnostics across every physical skill target.
- Add cold-replay regression coverage and update historical preservation expectations.
- Document safe failure and intentional-overwrite recovery.
| File | Description |
|---|---|
tests/unit/integration/test_skill_materialization_completion.py |
Assert errors for missing baselines while retaining valid-baseline controls. |
tests/integration/test_obsolete_dependency_claim_lifecycle.py |
Require failed installs to preserve historical files and prior lock contents. |
tests/integration/test_cold_skill_receipt_preservation.py |
Add 40 source-CLI cases covering cold replay, scopes, edits, and secondary-target refusals. |
src/apm_cli/integration/skill_integrator.py |
Forward diagnostics to every selected skill target. |
src/apm_cli/integration/base_integrator.py |
Report missing-baseline write refusals as errors. |
packages/apm-guide/.apm/skills/apm-usage/commands.md |
Update the installed guide with failure and recovery behavior. |
docs/src/content/docs/consumer/install-packages.md |
Explain receipt-related failures and preservation guarantees. |
CHANGELOG.md |
Record the cold-replay safety fix. |
Review effort: Balanced
APM Review Panel:
|
| Persona | B | R | N | Takeaway |
|---|---|---|---|---|
| Python Architect | 0 | 0 | 0 | The change extends the existing integrator guard and diagnostic-to-outcome path; no parallel authority or new abstraction is introduced. |
| CLI Logging Expert | 0 | 1 | 0 | Missing-receipt refusals are correctly elevated to errors, but the summary can misstate refused files as failed packages. |
| DevX UX Expert | 0 | 1 | 0 | Make the CLI error offer a safe recovery before suggesting --force. |
| Supply Chain Security Expert | 0 | 0 | 0 | No supply-chain security regression found; missing receipts fail closed, and existing path, cleanup, and integrity gates remain intact. |
| OSS Growth Hacker | 0 | 0 | 0 | Clear recovery guidance reinforces trust in installs; this is a retention signal, not a direct acquisition or contributor-funnel change. |
| Doc Writer | 0 | 1 | 0 | The prose is clear and consistent, but should disclose that a failed install is not a full rollback. |
| Test Coverage Expert | 0 | 0 | 0 | Added lifecycle-smoke coverage exercises cold replay, repeated refusal, and preserved file and lock state; required smoke CI passed. |
| Performance Expert | 0 | 0 | 0 | No material performance regression: the diff changes diagnostic severity and routing, with no added scans, loops, or I/O. |
B = blocking-severity findings, R = recommended, N = nits.
Counts are signal strength, not gates. The maintainer ships.
Top 2 follow-ups
- [Doc Writer] Clarify that failed installs are not transactional. -- Explain that refused files and prior lock contents remain intact, but files admitted earlier in the run may remain after a later refusal; keep the install guide and shipped command docs consistent.
- [DevX UX Expert] Give a safe recovery step before mentioning --force. -- Tell users to move the conflicting file aside and retry, and reserve --force for intentional overwrites to reduce the risk of losing local skill files.
Architecture
classDiagram
direction LR
class BaseIntegrator {
<<BaseClass>>
+copy_directory_files(...)
}
class SkillIntegrator {
<<ConcreteIntegrator>>
+_promote_sub_skills(...)
+_integrate_native_skill(...)
+_integrate_skill_bundle(...)
}
class DiagnosticCollector {
<<CollectThenRender>>
+error(message)
+warn(message)
+error_count
}
class InstallPipelineModule {
<<Module>>
+run_install_pipeline(...)
}
class InstallOutcomeModule {
<<Module>>
+result_from_install_context(ctx)
+finalize_install_result(result)
}
class LockfileBuilder {
<<PersistenceBoundary>>
+build_and_save()
}
SkillIntegrator --|> BaseIntegrator
SkillIntegrator ..> DiagnosticCollector : records refusals
InstallPipelineModule ..> SkillIntegrator : integration phase
InstallPipelineModule ..> DiagnosticCollector : collects diagnostics
InstallPipelineModule ..> InstallOutcomeModule : classifies precommit result
InstallOutcomeModule ..> DiagnosticCollector : counts errors
InstallPipelineModule ..> LockfileBuilder : persists after successful outcome
note for BaseIntegrator "Shared collision and file-copy logic; SkillIntegrator supplies skill-specific target dispatch."
note for DiagnosticCollector "Collect-then-render: integration records diagnostics, then the existing outcome path classifies them."
class BaseIntegrator:::touched
class SkillIntegrator:::touched
classDef touched fill:#fff3b0,stroke:#d47600
flowchart TD
A["apm install CLI"] --> B["run_install_pipeline()"]
B --> C["[FS] _run_integration_phase(ctx)"]
C --> D["SkillIntegrator._promote_sub_skills() / _integrate_native_skill() / _integrate_skill_bundle()"]
D --> E["[FS] BaseIntegrator.copy_directory_files()"]
E --> F{"Existing target and no --force?"}
F -- "Missing trustworthy baseline" --> G["DiagnosticCollector.error(); skip refused member"]
F -- "Valid baseline, local edit detected" --> H["DiagnosticCollector.warn(); skip edited member"]
F -- "Otherwise" --> W["[FS] Copy eligible source files"]
G --> I["result_from_install_context(ctx) -> finalize_install_result(ctx result)"]
H --> I
W --> I
I --> J{"InstallDisposition.FAILED?"}
J -- "Yes: diagnostic error recorded" --> K["Return failed result; nonzero exit before cleanup and lock replacement"]
J -- "No" --> L["[FS] cleanup phase"]
L --> M["[LOCK] LockfileBuilder.build_and_save()"]
Recommendation
The reported CI and targeted regression checks support shipping this safety improvement. Track the documentation clarification and safer CLI recovery wording as focused follow-ups.
Full per-persona findings
Python Architect
No findings.
CLI Logging Expert
- [recommended] Avoid counting refused files as failed packages at
src/apm_cli/integration/base_integrator.py:362
This call records one error per refused file without package attribution. The diagnostic renderer labels the number of error entries as packages failed, so a single refused skill file is reported as a failed package and multiple files can inflate the package count. Propagating errors from every physical target makes that mismatch more likely.
Suggested: Render this refusal with wording and counts that reflect failed install operations or refused entries, rather than treating each diagnostic as a distinct failed package.
DevX UX Expert
- [recommended] Give users a safe recovery step before suggesting
--forceatsrc/apm_cli/integration/base_integrator.py:357
The new error tells users to preserve changes before reinstalling with--force, but does not explain how to recover without overwriting. The docs recommend moving conflicting files aside and retrying, or using--forceonly for an intentional overwrite. Users relying on CLI output may choose--forceand overwrite local skill files.
Suggested: Tell users to move the conflicting file aside and retry; clarify that--forceis only for an intentional overwrite.
Supply Chain Security Expert
No findings.
OSS Growth Hacker
No findings.
Auth Expert -- inactive
CHANGELOG.md, docs/src/content/docs/consumer/install-packages.md, packages/apm-guide/.apm/skills/apm-usage/commands.md, src/apm_cli/integration/base_integrator.py, src/apm_cli/integration/skill_integrator.py, tests/integration/test_cold_skill_receipt_preservation.py, tests/integration/test_obsolete_dependency_claim_lifecycle.py, and tests/unit/integration/test_skill_materialization_completion.py change local deployment receipts and filesystem integration only, so neither auth trigger nor fallback applies.
Doc Writer
- [recommended] Clarify that a failed install may leave newly admitted files behind at
docs/src/content/docs/consumer/install-packages.md:102
The install guide says existing files and lock contents are preserved, but the PR description notes that newly admitted files may already have been copied before a later skill is refused. Without that qualification, readers may assume a failed install leaves no filesystem changes. The shipped command docs repeat the same omission.
Suggested: Clarify that the refused files and prior lock remain intact, but the install is not transactional and newly admitted files written before a later refusal may remain; keep the shipped command docs consistent.
Test Coverage Expert
No findings.
Performance Expert
No findings.
This panel is advisory. It does not block merge. Re-apply the panel-review label after addressing feedback to re-run.
Tell users to move files aside before retrying and reserve --force for intentional overwrite. Clarify that refused files and prior lock remain intact while files admitted earlier in a failed install may remain. Refs #3372 Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot App <[email protected]>
|
Sergio Sisternes (@sergio-sisternes-epam): on 2026-11-10 Daniel confirmed this PR as the delivery path for #3372 (and #3422). Contributor PR #3440 by Tyce Herrman (@TyceHerrman) implemented the same approach first and has been closed as superseded. Could you add this trailer to the squash/merge commit of this PR so the credit carries over? (identity taken from the commits on #3440). No other change is requested here. Generated by autopilot-issue-triage-worker. This comment is AI-generated and may contain errors. |
APM Review Panel:
|
| Persona | B | R | N | Takeaway |
|---|---|---|---|---|
| Supply Chain Security Expert | 0 | 1 | 0 | Fail-closed gate is sound. Errors without package= leave the per-package cleanup guard blind (defense in depth, not a current bypass). |
| Test Coverage Expert | 0 | 2 | 0 | Tests trap the #3372 regression well (40 lifecycle cases). No test covers the new recovery wording or the rendered error summary. |
| CLI Logging Expert | 0 | 1 | 0 | Errors without package= make the renderer report each refused file as a failed package. |
B = blocking-severity findings, R = recommended, N = nits.
Counts are signal strength, not gates. The maintainer ships.
Requested folds (awaiting author)
These are inside the approved #3372 scope ("the install outcome ... do not falsely signal"). Under this run's rules I am not pushing to your branch, so each one is a request:
- [Supply Chain + CLI Logging] Attribute missing-receipt errors to the owning package.
src/apm_cli/integration/base_integrator.pycopy_directory_files: addpackage: str = ""and change the missing-baseline call todiagnostics.error(message, package=package).src/apm_cli/integration/skill_integrator.py_copy_skill_bundle: passpackage=self._skill_current_owner or "". That isdependency_ref.get_unique_key()(line 1526), the same keycleanup.pyuses withcount_for_package(dep_key, "error").src/apm_cli/utils/diagnostics.py_render_error_group: count{d.package for d in items if d.package}when non-empty, otherwiselen(items). Existing callers already passpackage=once per package, so their output does not change.
- [Test Coverage] Trap the recovery wording. Assert
Move the conflicting file asideintest_cold_overlapping_skill_replay_preserves_files_and_lock, or at unit tier on theDiagnosticCollectormessage forbaseline="missing". No test matches this wording today. - [Test Coverage] Trap the rendered summary. Once fold 1 lands, assert that the cold-replay refusal renders
[x] 1 package failed:with the package prefix. Then run a mutation check: drop thepackage=argument and confirm the test fails.
Contributor credit (#3440)
Closed PR #3440 by Tyce Herrman (@TyceHerrman) implemented this approach first. Please add this trailer to the squash/merge commit, or to a commit on this branch. The identity comes from all five commits on #3440:
Co-authored-by: Tyce Herrman <[email protected]>
Copilot signals reviewed
- Review
5800337819(atc1b43ad4) -- NOT-LEGIT as a fold source: overview only, recommended approval, no inline comments. A second fetch found nothing new.
Deferred (out-of-scope follow-ups)
- [BUG] Update deletes unedited skill files it declined to overwrite for lack of a deployment receipt #3422 (
apm updatedeleting unedited skills) has noapm-scope:v1record, so nothing [BUG] Update deletes unedited skill files it declined to overwrite for lack of a deployment receipt #3422-only is requested here. This PR's install-path fix may cover it; the triage owner should confirm that separately.
Owner gate, lint, and CI
- Owner gate (
owner_touch_gate.py, basec6cdf13d6, headba2ff4d4): owner-extension of "File-level deploy / sync / cleanup" and "Legacy plugin declared-skill membership". No dual guardrail required. Functional evidence passed at head:test_cold_skill_receipt_preservation.py(40),test_skill_materialization_completion.py(36),test_legacy_plugin_compat.py(21),test_skill_integrator_phase3w4.py(42).test_obsolete_dependency_claim_lifecycle.pyandtest_shared_skill_preservation_lifecycle.pyalso exited 0. Semantic verify:verified: true. - Lint mirror on the head, which already contains current
main:ruff check,ruff format --check, pylint R0801,lint-auth-signals.shandlint-architecture-boundaries.shall passed with no findings. - CI: 24 success, 2 neutral, 1 skipped, 0 failing. No push this run (0 CI fix iterations).
Mergeability status
| PR | head SHA | CEO stance | iters | folds | defers | Copilot rounds | CI | mergeable | mergeStateStatus | notes |
|---|---|---|---|---|---|---|---|---|---|---|
| #3490 | ba2ff4d |
ship_with_followups | 1 | 0 | 3 | 2 | green | MERGEABLE | BLOCKED | 3 folds awaiting author; pending required review |
Recommendation
The P0 fix is sound: it fails closed, preserves the lockfile, exits nonzero, has 40 lifecycle cases and passes CI. Fold 1 is small. It makes the failure summary accurate and gives the per-package cleanup guard a second line of defense. Folds 2 and 3 lock in that wording. Please add the #3440 Co-authored-by trailer before merge.
Full per-persona findings
Supply Chain Security Expert
- [recommended]
diagnostics.error()is recorded withoutpackage=, so the per-package cleanup guard cannot see missing-receipt failures. Atsrc/apm_cli/integration/base_integrator.py:366.
The global outcome gate returns FAILED before cleanup, so there is no current bypass. However,failed_owners(cleanup.py:94) and the stale-file skip (cleanup.py:183) both key oncount_for_package(dep_key, "error"). If partial-success semantics are added later, or cleanup moves ahead of the outcome gate, the [BUG] 0.35.0 regression: coldapm install --frozendeletes a committed skill that two dependency entries deliver, then exits 0 #3372 deletion could return. Also verified:diagnosticsis never None during install. The only caller that passes None (deploy_skill_bundle_only) usesforce=True. Forwarding diagnostics to secondary targets is an improvement.
Suggested: Thread the package key intocopy_directory_filesand pass it todiagnostics.error(message, package=...).
Test Coverage Expert
- [recommended] No test asserts the new recovery wording. At
src/apm_cli/integration/base_integrator.py:358.
Searchingtests/for "Move the conflicting" returns zero matches.
Suggested: Extendtest_cold_overlapping_skill_replay_preserves_files_and_lock, or assert at unit tier. - [recommended] No test asserts the rendered error summary for the missing-receipt path.
Suggested: Assert the summary line, with the correct count, once attribution lands.
CLI Logging Expert
- [recommended] The new
diagnostics.error()call has no package attribution, and the header counts files as packages. Atsrc/apm_cli/integration/base_integrator.py:368.
This breaks the message rules "use exact counts" and "name the thing".
Suggested: Passpackage=fromself._skill_current_ownerand count distinct packages in_render_error_group.
This panel is advisory. It does not block merge. Re-apply the
panel-review label after addressing feedback to re-run.
Generated by autopilot-pr-merge-worker. This comment is AI-generated and may contain errors.
Co-authored-by: Copilot <[email protected]>
Missing-baseline refusals were recorded without package=, so the error
summary counted each refused file as a failed package ("4 packages
failed" for one package) and the per-package cleanup and lockfile
guards keyed on count_for_package could not see them. Thread the owning
dependency key from SkillIntegrator into copy_directory_files and count
each attributed package once in the error summary.
Addresses the 2026-11-10 panel fold 1 (supply chain + CLI logging) and
fold 3 (rendered summary regression trap) on #3490.
Co-authored-by: Copilot <[email protected]>
No test asserted the recovery guidance that tells users to move the conflicting file aside before reaching for --force. Assert it in the cold overlapping replay regression so the safe recovery path cannot silently regress. Addresses the 2026-11-10 panel fold 2 (test coverage) on #3490. Co-authored-by: Copilot <[email protected]>
PR #3440 by @TyceHerrman implemented the same fail-before-cleanup approach first and was closed as superseded by #3490. Carry the credit into the changelog and the commit history, and note that the failure summary now counts each refusing package once. Co-authored-by: Tyce Herrman <[email protected]> Co-authored-by: Copilot <[email protected]>
The fold commits pushed the critical-path diff past the Mode B threshold. The change reports existing missing-receipt refusals as attributed errors through the existing outcome gate; no OpenAPM normative requirement, package format, or lock schema changes. apm-spec-waiver: local deployment-receipt refusal reporting and diagnostic attribution only; no OpenAPM-observable behaviour change (#3372) Co-authored-by: Copilot <[email protected]>
APM Review Panel:
|
| Persona | B | R | N | Takeaway |
|---|---|---|---|---|
| Supply Chain Security Expert | 0 | 0 | 0 | All 3 prior folds verified. package= attribution lets the cleanup and lockfile trust gates see these refusals. No new security surface. |
| Test Coverage Expert | 0 | 0 | 0 | All 3 prior folds addressed. Package attribution, recovery wording and rendered summary are verified at integration and unit tiers. |
| CLI Logging Expert | 0 | 0 | 0 | Fold 1 satisfied. package= attribution and distinct-package counting in _render_error_group are correct, with no CLI output regressions. |
B = blocking-severity findings, R = recommended, N = nits.
Counts are signal strength, not gates. The maintainer ships.
Top 2 follow-ups
- [Supply Chain Security Expert] Close [BUG] Update deletes unedited skill files it declined to overwrite for lack of a deployment receipt #3422 as a duplicate of [BUG] 0.35.0 regression: cold
apm install --frozendeletes a committed skill that two dependency entries deliver, then exits 0 #3372 after merge. -- This avoids stale backlog confusion. It carries noapm-scope:v1record of its own. - [Supply Chain Security Expert] Track [BUG] 0.35.0: restoring from the lockfile on a fresh machine deletes committed skill files (claude_skill and skill_bundle packages) #3391 for the remaining cold-restore regression (cold CI
--force/ adopting byte-identical committed skills). -- It is outside [BUG] 0.35.0 regression: coldapm install --frozendeletes a committed skill that two dependency entries deliver, then exits 0 #3372's approved scope and stays a separate held follow-up.
Folded in this run
- (panel) Attribute missing-receipt refusals to the owning package.
copy_directory_files(package=...)makes_render_error_groupcount each package once. -- resolved in704cfa9. - (panel) Test the rendered summary: 24 CLI cases assert
[x] 1 package failed:with the package prefix, and a new unit test covers distinct counting. -- resolved in704cfa9. - (panel) Test the recovery wording: "Move the conflicting file aside and retry" in all 16 cold-replay cases. -- resolved in
1799375. - (credit) Carried over Tyce Herrman (@TyceHerrman)'s credit for fix(install): preserve refused skill files when deployment receipts are missing #3440 in a
Co-authored-bycommit trailer, the PR body and the CHANGELOG. -- resolved in31120b5.
Copilot signals reviewed
- Review
5800337819-- NOT-LEGIT as a fold source: overview only, approval recommended, no inline comments. A second fetch found nothing new.
Regression-trap evidence (mutation-break gate)
test_missing_receipt_errors_reach_install_from_every_skill_target[both-targets-unchanged-apm-project]-- deletedpackage=owner or ""inSkillIntegrator._copy_skill_bundle; test FAILED as expected; guard restored.- Same case plus
test_error_group_counts_each_attributed_package_once-- reverted the distinct-package count tolen(items); both FAILED as expected; guard restored. test_cold_overlapping_skill_replay_preserves_files_and_lock[same-checkout-unchanged-frozen-project]-- changed the recovery wording; test FAILED as expected; guard restored.
Owner gate, lint, and CI
- Owner gate (
owner_touch_gate.py, basec79f14b, head19554d8): owner-extension of "File-level deploy / sync / cleanup" and "Legacy plugin declared-skill membership". No dual guardrail is required. Exact-head functional evidence: 149 passed (cold receipt, materialization, diagnostics) and 63 passed (legacy plugin compat, skill integrator). Semantic verify:verified: true. - Also run at
31120b5: 515 unit/integration, 54 lifecycle with the realapmbinary (obsolete claim, shared skill preservation), 159 plugin parser, and 161tests/quality. - Lint mirror:
ruff check,ruff format --check, pylint R0801,lint-auth-signals.sh,lint-architecture-boundaries.shand the 2100-line guard all passed.skill_integrator.pyis at 2099 lines. - CI at
19554d8: 24 pass, 3 skipped, 0 failing (after 1 CI fix iteration: the Mode B waiver).
Mergeability status
| PR | head SHA | CEO stance | iters | folds | defers | Copilot rounds | CI | mergeable | mergeStateStatus | notes |
|---|---|---|---|---|---|---|---|---|---|---|
| #3490 | 19554d8 |
ship_now | 1 | 4 | 0 | 2 | green | MERGEABLE | BLOCKED | pending required code-owner review |
Recommendation
All three folds from the last advisory are verified with mutation-break evidence, no panelist has findings, and CI is green. This is ready for code-owner review and merge. Keep the Co-authored-by: Tyce Herrman trailer in the squash commit (it is in the PR body). After merge, close #3422 as a duplicate and keep #3391 as the next follow-up.
Full per-persona findings
Supply Chain Security Expert
No findings.
Test Coverage Expert
No findings.
CLI Logging Expert
No findings.
This panel is advisory. It does not block merge. Re-apply the
panel-review label after addressing feedback to re-run.
Generated by autopilot-pr-merge-worker. This comment is AI-generated and may contain errors.
* fix(install): adopt unchanged committed skills on cold restore When local deployment receipts are missing (fresh clone, CI runner, Renovate), a native skill or skill bundle directory is adopted when every file equals what this install would write -- the admitted source member after final link rendering -- with no extra or missing files and every member claimed in apm.lock.yaml. The verified on-disk hash stands in for the missing baseline, so the guarded write path rewrites identical bytes and records receipts. Lockfile hashes are never used as evidence; any difference keeps the #3372 fail-closed refusal (#3490). apm-spec-waiver: local deployment receipts and cold-restore skill adoption are implementation state not covered by any OpenAPM v0.1 requirement Fixes #3391 Co-authored-by: Copilot App <[email protected]> * fix(install): require lockfile claims for cold skill adoption Same-run session hashes from the raw unchanged shortcut are not ownership evidence; adoption now requires every member to be claimed by apm.lock.yaml so unowned identical files never gain receipts. apm-spec-waiver: local deployment receipts and cold-restore skill adoption are implementation state not covered by any OpenAPM v0.1 requirement Co-authored-by: Copilot App <[email protected]> * docs(changelog): record cold-restore skill adoption (#3564) Co-authored-by: Copilot App <[email protected]> * fix(install): adopt only skills without any local receipt A warm replay whose receipt exists but yields no trusted baseline (for example root-local skills) keeps the raw unchanged shortcut, so frozen replays no longer rewrite receipt state. Adoption now applies only when no receipt record exists for the skill anchor. apm-spec-waiver: local deployment receipts and cold-restore skill adoption are implementation state not covered by any OpenAPM v0.1 requirement Co-authored-by: Copilot App <[email protected]> --------- Co-authored-by: danielmeppiel <[email protected]> Co-authored-by: Copilot App <[email protected]>
0.35.1 includes microsoft/apm#3490: when missing local deployment receipts make APM refuse to write a committed skill file, `apm install` now fails before its stale clean-up and lockfile replacement, rather than deleting the committed files and exiting 0. The dependabot#3391 workaround is still needed, as without it every update of a committed package fails. A file edited since APM deployed it is kept by the workaround, so APM now refuses it and the update fails with APM's message naming the file, where 0.35.0 skipped it with a warning. The checksums come from the release's `.sha256` files and match both downloaded archives.
Bring the branch up to date with main (cbd9f2b). The only textual overlap was CHANGELOG.md: main released the microsoft#3440/microsoft#3490 entry into 0.35.1, so the stale [Unreleased] copy carried by the branch context is dropped (main wins) and only this PR's entry stays under Unreleased. Co-authored-by: Copilot App <[email protected]>
fix(install): preserve skills during cold replay without deployment receipts
Description
TL;DR
Missing local deployment receipts now make a refused skill write an install error. The existing precommit outcome gate returns nonzero before stale cleanup and lock replacement, preserving existing deployed files and the previous lockfile. Safety diagnostics reach every physical skill target; edits with a valid prior receipt retain warning-only preservation.
Important
This implements the accepted failure-before-cleanup alternative for #3372. It does not automatically trust a checked-out lockfile as local overwrite authority.
Problem (WHY)
apm install --frozenwith overlapping package/native-skill dependencies and missing receipts returned zero afterCleaned 3 stale deployed files, despite refusing existing skill writes.The accepted scope requires a nonzero result before cleanup and lock replacement when deployment cannot complete. The regression is demonstrated through the source CLI, consistent with the Agent Skills guidance to "Refine with real execution", rather than relying only on mocked outcomes.
Approach (WHAT)
--forcesemantics.Implementation (HOW)
src/apm_cli/integration/base_integrator.pysrc/apm_cli/integration/skill_integrator.pytests/integration/test_cold_skill_receipt_preservation.pylifecycle_smokeselector makes these required PR-time coverage.tests/integration/test_obsolete_dependency_claim_lifecycle.pytests/unit/integration/test_skill_materialization_completion.pysrc/apm_cli/utils/diagnostics.pytests/unit/test_diagnostics.pydocs/src/content/docs/consumer/install-packages.mdpackages/apm-guide/.apm/skills/apm-usage/commands.mdCHANGELOG.mdDiagrams
Dashed nodes mark the changed diagnostic routing; the existing outcome gate still owns the stop before cleanup and lock replacement.
flowchart LR subgraph Integration A["Skill target dispatch"] --> B["BaseIntegrator refuses missing baseline"] B --> C["DiagnosticCollector.error"] end subgraph Outcome C --> D["Existing precommit outcome gate"] D --> E["Return nonzero"] end subgraph Preserved E --> F["Existing deployment files"] E --> G["Previous lockfile"] end classDef changed stroke-dasharray: 5 5; class A,C changed;Trade-offs
--forceremains an intentional overwrite choice after preserving local changes.Benefits
Maintainer folds (2026-11-11)
Folded the three in-scope follow-ups from the 2026-11-10 panel after merging current
main:704cfa9-- missing-receipt refusals passpackage=(the owningdependency_ref.get_unique_key()), so the summary renders[x] 1 package failed:with the package prefix instead of one "package" per refused file, and the per-package cleanup/lockfile guards (count_for_package(..., "error")) see them.1799375-- the cold replay regression asserts the "Move the conflicting file aside and retry" recovery wording.704cfa9-- the secondary-target lifecycle cases assert the rendered[x] 1 package failed:line and package prefix.Mutation-break: dropping
package=fails the rendered-summary case; reverting the renderer count fails it and the new unit test; changing the recovery wording fails the cold replay case. All restored and green.31120b5credits closed PR #3440 by Tyce Herrman (@TyceHerrman), which implemented this approach first.Issue and approved scope
Issue: #3372
Human scope-approval comment: #3372 (comment)
Does this PR complete the issue, or what remains?
Fixes #3372 by implementing the approved nonzero-before-cleanup alternative. Receipt-format redesign, migrations, unrelated install behavior, and filesystem-binding changes are outside this PR.
Type of change
Testing
Validation
uv run --extra dev pytest -q tests/integration/test_cold_skill_receipt_preservation.py tests/unit/integration/test_skill_materialization_completion.pyAPM_BINARY_PATH="$PWD/.venv/bin/apm" uv run --extra dev pytest -q tests/integration/test_obsolete_dependency_claim_lifecycle.py tests/integration/test_shared_skill_preservation_lifecycle.pyuv run --extra dev pytest -q tests/unit/integration/test_skill_materialization_completion.py tests/unit/integration/test_skill_integrator_phase3w4.py tests/unit/integration/test_skill_integrator_cowork.py tests/unit/install/test_skill_completion_receipt.pyuv run --extra dev pytest -p no:cacheprovider -q tests/qualityuv run --extra dev pytest -q -m lifecycle_smoke tests/integration/test_cold_skill_receipt_preservation.py tests/quality/test_ci_topology.pyuv run --extra dev pytest -q tests/quality/test_ci_topology.pyuv run --frozen python scripts/check_test_assertions.pyuv run --frozen python scripts/check_exact_test_duplicates.pyuv run --frozen --extra dev pytest -q tests/integration/test_cold_skill_receipt_preservation.py tests/unit/integration/test_skill_materialization_completion.py tests/unit/integration/test_skill_integrator_phase3w4.py tests/unit/integration/test_skill_integrator.py tests/unit/integration/test_skill_integrator_cowork.py tests/unit/install/test_skill_completion_receipt.py tests/unit/test_diagnostics.py tests/unit/install/test_summary.py tests/unit/install/test_install_logger_policy.py tests/unit/install/test_agent_symlink_diagnostics.py tests/unit/test_install_scanning.py(head31120b5)APM_BINARY_PATH="$PWD/.venv/bin/apm" uv run --frozen --extra dev pytest -q tests/integration/test_obsolete_dependency_claim_lifecycle.py tests/integration/test_shared_skill_preservation_lifecycle.py(head31120b5)uv run --frozen --extra dev pytest -q tests/unit/install/test_legacy_plugin_compat.py tests/unit/test_plugin_parser.py(head31120b5)npm --prefix docs run buildCI-mirror lint and mutation evidence
All following local checks passed after merging current main:
YAML I/O, 2100-line, and portable-relative-path guards also passed with equivalent Python regex checks on macOS.
Removing the missing-baseline error guard made the cold frozen regression and the direct materialization check fail (2 failures). Restoring secondary diagnostic suppression made the APM-package and skill-bundle secondary-only cases fail in both scopes (4 failures). Both guards were restored and the complete 40-case suite passed.
The whole repository test suite was not run locally. Required remote CI and human review remain separate from these local results.
Scenario Evidence
tests/integration/test_cold_skill_receipt_preservation.py::test_cold_overlapping_skill_replay_preserves_files_and_lock(regression-trap for #3372)tests/integration/test_cold_skill_receipt_preservation.py::test_missing_receipt_errors_reach_install_from_every_skill_targettests/integration/test_obsolete_dependency_claim_lifecycle.pytests/integration/test_shared_skill_preservation_lifecycle.pyHow to test
apmentry point.apm install --frozen: expect nonzero and unchanged deployed files and lock bytes.Spec conformance (OpenAPM v0.1)
If this PR changes behaviour that an OpenAPM v0.1
req-XXXcovers,confirm the three-step ritual in the
development guide:
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.
This restores safe failure for a local deployment-authority refusal. No normative requirement, package format, or lock schema is added or changed.
apm-spec-waiver: local deployment-receipt refusal reporting and diagnostic attribution only; no OpenAPM-observable behaviour change (#3372)
Co-authored-by: Copilot [email protected]
Co-authored-by: Tyce Herrman [email protected]