Skip to content

fix(install): preserve skills during cold replay without deployment receipts - #3490

Merged
Daniel Meppiel (danielmeppiel) merged 10 commits into
mainfrom
sergio-sisternes-epam-fix-3372-deployment-regression
Nov 11, 2026
Merged

Daniel Meppiel (danielmeppiel) merged 10 commits into
mainfrom
sergio-sisternes-epam-fix-3372-deployment-regression

Conversation

@sergio-sisternes-epam

@sergio-sisternes-epam Sergio Sisternes (sergio-sisternes-epam) commented Nov 6, 2026 •

Copy link
Copy Markdown
Collaborator

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)

  • Reproduced on main: cold apm install --frozen with overlapping package/native-skill dependencies and missing receipts returned zero after Cleaned 3 stale deployed files, despite refusing existing skill writes.
  • A successful primary deployment could hide missing-baseline refusals on a secondary target.
  • [!] A zero exit code made an incomplete deployment look successful to callers.

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)

  • Report missing-baseline refusals through the existing diagnostic error category.
  • Reuse the existing install outcome gate; do not add another cleanup or lockfile authority.
  • Propagate diagnostics through all skill target dispatch paths.
  • Keep warning-only handling for local edits with a valid receipt, and keep explicit --force semantics.

Implementation (HOW)

File Change
src/apm_cli/integration/base_integrator.py Distinguish missing overwrite authority from edits to a verified local deployment.
src/apm_cli/integration/skill_integrator.py Deliver diagnostics from native skills, APM sub-skills, and skill bundles on every selected physical target. Existing primary-only summary controls remain.
tests/integration/test_cold_skill_receipt_preservation.py Add 40 isolated source-CLI cases, including frozen duplicate delivery, missing receipts, fresh-clone identity, both scopes, local edits, repeated attempts, and secondary-only refusal. The existing lifecycle_smoke selector makes these required PR-time coverage.
tests/integration/test_obsolete_dependency_claim_lifecycle.py Update historical missing-authority cases to require failure and preserve prior state. Normal supported claim retirement remains exercised.
tests/unit/integration/test_skill_materialization_completion.py Assert missing-baseline errors while retaining valid-baseline copy and edited-baseline controls.
src/apm_cli/utils/diagnostics.py Count each attributed package once in the error summary; refusals now carry the owning dependency key.
tests/unit/test_diagnostics.py Assert distinct-package counting with per-package prefixes.
docs/src/content/docs/consumer/install-packages.md Document safe failure and explicit recovery choices.
packages/apm-guide/.apm/skills/apm-usage/commands.md Synchronize the installed guide's command behavior.
CHANGELOG.md Record the safe-failure behavior and intentional-overwrite recovery.

Diagrams

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;
Loading

Trade-offs

  • Choose explicit failure rather than silently adopting committed lock hashes as local overwrite authority. Receipts and their format are unchanged.
  • Existing deployment bytes and the prior lock are preserved, but install is not a rollback transaction for every write: newly admitted files may already have been copied before a different member is refused.
  • Missing-receipt cases can now fail where they previously warned. --force remains an intentional overwrite choice after preserving local changes.

Benefits

  1. Cold duplicate-delivery replay cannot delete lock-recorded skills and report success.
  2. A successful primary target cannot hide secondary safety errors.
  3. Repeated refusals preserve existing files and lock contents in both project and user scope.

Maintainer folds (2026-11-11)

Folded the three in-scope follow-ups from the 2026-11-10 panel after merging current main:

  1. 704cfa9 -- missing-receipt refusals pass package= (the owning dependency_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.
  2. 1799375 -- the cold replay regression asserts the "Move the conflicting file aside and retry" recovery wording.
  3. 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.

31120b5 credits 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

  • Bug fix
  • New feature
  • Documentation
  • Maintenance / refactor

Testing

  • Tested locally
  • All existing tests pass
  • Added tests for new functionality (if applicable)

Validation

Exact command Result
uv run --extra dev pytest -q tests/integration/test_cold_skill_receipt_preservation.py tests/unit/integration/test_skill_materialization_completion.py Passed: 76 tests on committed head.
APM_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.py Passed: 54 tests.
uv 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.py Passed: 88 tests.
uv run --extra dev pytest -p no:cacheprovider -q tests/quality Passed: 161 tests.
uv run --extra dev pytest -q -m lifecycle_smoke tests/integration/test_cold_skill_receipt_preservation.py tests/quality/test_ci_topology.py Passed: 40 required smoke cases; 144 unrelated tests deselected.
uv run --extra dev pytest -q tests/quality/test_ci_topology.py Passed: 144 CI selection and topology checks.
uv run --frozen python scripts/check_test_assertions.py Passed: assertion-quality ratchet.
uv run --frozen python scripts/check_exact_test_duplicates.py Passed: 1417 files, zero allowed duplicate groups.
uv 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 (head 31120b5) Passed: 515 tests.
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 (head 31120b5) Passed: 54 tests.
uv run --frozen --extra dev pytest -q tests/unit/install/test_legacy_plugin_compat.py tests/unit/test_plugin_parser.py (head 31120b5) Passed: 159 tests.
npm --prefix docs run build Passed, including 1111 relative links; existing Astro warnings remain.
CI-mirror lint and mutation evidence

All following local checks passed after merging current main:

uv run --frozen --extra dev ruff check src/ tests/ scripts/lint_architecture_boundaries.py scripts/architecture_linter/ scripts/windows_native_symlink_probe_entry.py
uv run --frozen --extra dev ruff format --check src/ tests/ scripts/lint_architecture_boundaries.py scripts/architecture_linter/ scripts/windows_native_symlink_probe_entry.py
uv run --frozen --extra dev python -m pylint --disable=all --enable=R0801 --min-similarity-lines=10 --fail-on=R0801 src/apm_cli/ scripts/lint_architecture_boundaries.py scripts/architecture_linter/ scripts/windows_native_symlink_probe_entry.py
PATH="$PWD/.venv/bin:$PATH" bash scripts/lint-auth-signals.sh
PATH="$PWD/.venv/bin:$PATH" bash scripts/lint-architecture-boundaries.sh
git diff --check

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

# Scenario (user promise) Principle(s) Test(s) proving it Type
1 Replay committed overlapping skills on a cold machine without losing files or falsely succeeding. DevX (pragmatic as npm); Governed by policy tests/integration/test_cold_skill_receipt_preservation.py::test_cold_overlapping_skill_replay_preserves_files_and_lock (regression-trap for #3372) integration
2 Preserve user-scope and project-scope skills even if only the secondary target has existing files. Multi-harness support; Secure by default tests/integration/test_cold_skill_receipt_preservation.py::test_missing_receipt_errors_reach_install_from_every_skill_target integration
3 Keep historical/unattributed files and the old lock on repeated failed installs, while retaining supported claim retirement. Governed by policy tests/integration/test_obsolete_dependency_claim_lifecycle.py e2e
4 Update shared skills without deleting another package's unique assets. Multi-harness support tests/integration/test_shared_skill_preservation_lifecycle.py e2e

How to test

  • Run the 76-test command above.
  • Run the historical/shared lifecycle command with the checkout's installed apm entry point.
  • In a disposable home, install the issue's overlapping local dependencies, remove modules and local receipts, then run apm install --frozen: expect nonzero and unchanged deployed files and lock bytes.
  • Repeat the replay: preservation and nonzero must remain consistent.

Spec conformance (OpenAPM v0.1)

If this PR changes behaviour that an OpenAPM v0.1 req-XXX covers,
confirm the three-step ritual in the
development guide:

  • Spec edit: docs/src/content/docs/specs/openapm-v0.1.md updated
    (new/changed <a id="req-XXX"></a> anchor + prose + Appendix C
    row).
  • Manifest edit: docs/src/content/docs/specs/manifests/openapm-v0.1.requirements.yml
    updated.
  • Test edit: a @pytest.mark.req("req-XXX") test under
    tests/spec_conformance/ added or extended.
  • CONFORMANCE.{md,json} regenerated via
    uv run --extra dev python -m tests.spec_conformance.gen_statement
    and committed.
  • N/A -- this PR does not change OpenAPM-observable behaviour.

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]

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]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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

@sergio-sisternes-epam

Copy link
Copy Markdown
Collaborator Author

APM Review Panel: ship_with_followups

PR #3490 makes cold skill replay fail safely when deployment receipts are missing, preserving existing files and lock contents.

cc Sergio Sisternes (@sergio-sisternes-epam) Daniel Meppiel (@danielmeppiel) -- a fresh advisory pass is ready for your review.

The panel supports the fail-closed behavior: missing receipts now surface as errors before stale cleanup or lock replacement, and the reported CI and targeted regression evidence is green. The full test suite was not run, so validation scope remains limited.

The CLI Logging concern is unsupported by direct verification: the renderer reports an error total and does not describe each refused file as a failed package. The DevX and documentation findings are actionable and compatible: provide a safe recovery step in the CLI message, and clarify that files admitted earlier in the run may remain after a later refusal. Neither indicates a reason to delay the change.

Dissent. CLI Logging raised a package-count concern, but the renderer says "N error(s)" rather than claiming N failed packages, so that concern is not included as a follow-up. DevX and Doc Writer identify distinct improvements to recovery guidance and install-state expectations.

Aligned with: Secure by default; pragmatic as npm.

Growth signal. Release notes can emphasize the user outcome: cold replay now fails safely instead of silently reporting an incomplete install as successful.

Panel summary

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

  1. [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.
  2. [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
Loading
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()"]
Loading

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 --force at src/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 --force only for an intentional overwrite. Users relying on CLI output may choose --force and overwrite local skill files.
    Suggested: Tell users to move the conflicting file aside and retry; clarify that --force is 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]>
@danielmeppiel

Copy link
Copy Markdown
Collaborator

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?

Co-authored-by: Tyce Herrman <[email protected]>

(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.

@danielmeppiel

Copy link
Copy Markdown
Collaborator

APM Review Panel: ship_with_followups

The cold-install fix (#3372) correctly fails closed and is well tested. Correction to the 2026-11-06 panel: its CLI Logging finding was valid. The new per-file refusals are counted as separate packages in the summary.

panel-mode=lean; personas=supply-chain-security-expert,test-coverage-expert,cli-logging-expert,apm-ceo (cli-logging added because the new errors go through a renderer the prior panel dismissed)

cc Sergio Sisternes (@sergio-sisternes-epam) -- a fresh advisory pass is ready for your review.

Since the last advisory, both prior follow-ups (the non-transactional disclosure and recovery advice before --force) were folded in 30b11519. The core behavior holds: diagnostics.error() makes the existing precommit outcome gate return nonzero before stale cleanup and LockfileBuilder.build_and_save(). This preserves refused files and lock bytes in project and user scope, on secondary targets and during cold --frozen replay. All three panelists trace one remaining gap to one cause. copy_directory_files calls diagnostics.error(message) without package=. The 2026-11-06 CEO note said the renderer prints "N error(s)". It does not: _render_error_group (src/apm_cli/utils/diagnostics.py:505-508) prints the number of error entries as a package count. Reproduced on this head: one package with 2 refused files on 2 targets renders [x] 4 packages failed: with no package prefix. Without the package key, the per-package cleanup guards (cleanup.py:94 failed_owners, cleanup.py:183) cannot see these errors. Today this is a defense-in-depth gap, not a live deletion path, because the global outcome gate stops first.

Aligned with: secure by default (fail-closed, no new overwrite authority); portable by manifest (lock bytes preserved on refusal); community-driven (credit carried over from #3440).

Panel summary

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:

  1. [Supply Chain + CLI Logging] Attribute missing-receipt errors to the owning package.
    • src/apm_cli/integration/base_integrator.py copy_directory_files: add package: str = "" and change the missing-baseline call to diagnostics.error(message, package=package).
    • src/apm_cli/integration/skill_integrator.py _copy_skill_bundle: pass package=self._skill_current_owner or "". That is dependency_ref.get_unique_key() (line 1526), the same key cleanup.py uses with count_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, otherwise len(items). Existing callers already pass package= once per package, so their output does not change.
  2. [Test Coverage] Trap the recovery wording. Assert Move the conflicting file aside in test_cold_overlapping_skill_replay_preserves_files_and_lock, or at unit tier on the DiagnosticCollector message for baseline="missing". No test matches this wording today.
  3. [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 the package= 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 (at c1b43ad4) -- 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)

Owner gate, lint, and CI

  • Owner gate (owner_touch_gate.py, base c6cdf13d6, head ba2ff4d4): 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.py and test_shared_skill_preservation_lifecycle.py also 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.sh and lint-architecture-boundaries.sh all 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 without package=, so the per-package cleanup guard cannot see missing-receipt failures. At src/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 on count_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: cold apm install --frozen deletes a committed skill that two dependency entries deliver, then exits 0 #3372 deletion could return. Also verified: diagnostics is never None during install. The only caller that passes None (deploy_skill_bundle_only) uses force=True. Forwarding diagnostics to secondary targets is an improvement.
    Suggested: Thread the package key into copy_directory_files and pass it to diagnostics.error(message, package=...).

Test Coverage Expert

  • [recommended] No test asserts the new recovery wording. At src/apm_cli/integration/base_integrator.py:358.
    Searching tests/ for "Move the conflicting" returns zero matches.
    Suggested: Extend test_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. At src/apm_cli/integration/base_integrator.py:368.
    This breaks the message rules "use exact counts" and "name the thing".
    Suggested: Pass package= from self._skill_current_owner and 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.

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]>
@danielmeppiel

Copy link
Copy Markdown
Collaborator

APM Review Panel: ship_now

The P0 fix for #3372 is complete: cold install no longer deletes skill files it refuses to overwrite and no longer reports success. All three folds requested on 2026-11-10 are in, each with a mutation-break check.

panel-mode=delta; personas=supply-chain-security-expert,test-coverage-expert,cli-logging-expert,apm-ceo

cc Sergio Sisternes (@sergio-sisternes-epam) -- a fresh advisory pass is ready for your review.

Since the last advisory (head ba2ff4d), current main was merged in cleanly and the three requested folds were pushed to this branch under maintainer authority. Missing-receipt refusals now carry the owning dependency key (dependency_ref.get_unique_key()), so:

  • the summary prints [x] 1 package failed: with the package prefix, instead of one "package" per refused file;
  • cleanup.py failed_owners, the stale-file skip and lockfile.py current_run_trusted now see these errors for that package.

The recovery wording and the rendered summary are now covered by tests. All three panelists verified the delta and returned no findings. The apm-spec-waiver commit is justified. The extra fold lines pushed this critical-path diff past the Mode B threshold, and nothing OpenAPM can observe changes.

Aligned with: secure by default (refused files are kept; nonzero exit before stale cleanup and lock replacement); pragmatic as npm (a tested recovery step before --force); community-driven (credit for Tyce Herrman (@TyceHerrman)'s superseded #3440).

Panel summary

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

  1. [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 --frozen deletes a committed skill that two dependency entries deliver, then exits 0 #3372 after merge. -- This avoids stale backlog confusion. It carries no apm-scope:v1 record of its own.
  2. [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: cold apm install --frozen deletes 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_group count each package once. -- resolved in 704cfa9.
  • (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 in 704cfa9.
  • (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-by commit trailer, the PR body and the CHANGELOG. -- resolved in 31120b5.

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] -- deleted package=owner or "" in SkillIntegrator._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 to len(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, base c79f14b, head 19554d8): 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 real apm binary (obsolete claim, shared skill preservation), 159 plugin parser, and 161 tests/quality.
  • Lint mirror: ruff check, ruff format --check, pylint R0801, lint-auth-signals.sh, lint-architecture-boundaries.sh and the 2100-line guard all passed. skill_integrator.py is 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.

@danielmeppiel
Daniel Meppiel (danielmeppiel) merged commit e0a2374 into main Nov 11, 2026
27 checks passed
@danielmeppiel
Daniel Meppiel (danielmeppiel) deleted the sergio-sisternes-epam-fix-3372-deployment-regression branch November 11, 2026 14:14
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 12, 2026
* 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]>
Jake Aitchison (milkshakeuk) added a commit to milkshakeuk/dependabot-core that referenced this pull request Nov 12, 2026
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.
Daniel Meppiel (danielmeppiel) added a commit to adityaanikam/apm that referenced this pull request Nov 12, 2026
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] 0.35.0 regression: cold apm install --frozen deletes a committed skill that two dependency entries deliver, then exits 0

3 participants