Skip to content

fix(update): adopt unchanged locked skills when receipts are missing - #3638

Merged
Daniel Meppiel (danielmeppiel) merged 6 commits into
mainfrom
danielmeppiel-fix-update-cold-baseline-3625
Nov 12, 2026
Merged

Daniel Meppiel (danielmeppiel) merged 6 commits into
mainfrom
danielmeppiel-fix-update-cold-baseline-3625

Conversation

@danielmeppiel

@danielmeppiel Daniel Meppiel (danielmeppiel) commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

Description

TL;DR

On a fresh clone or CI runner without local deployment receipts (every microsoft/apm-action scheduled update), apm update refused to replace the committed skill files of the package it updates, exited 1 and left the new version's added file behind. This PR extends the #3391 / #3564 cold-restore rule to update: a skill tree byte-identical to what the currently locked version renders — fetched from its full-SHA locked commit — becomes the baseline and is replaced. Lockfile hashes are never trusted, locally edited files still fail closed, and a refusal now happens before any package writes, so a failed update leaves the tree and lockfile untouched.

Problem (WHY)

  • Reproduced on main (9034594) with a local two-tag fixture: apm update --yes → exit 1, 3 × no trustworthy local deployment baseline, lockfile stays at v0.4.1, and ?? .agents/skills/beta/added.md is left untracked.
  • fix(install): adopt unchanged committed skills on cold restore #3564's adoption compared on-disk files with the source being installed; on update that is v0.5.0, so unchanged v0.4.1 output can never match.
  • Per-member refusals in copy_directory_files let sibling members (new files, adoptable skills) write before the failure, so the "No install transaction changes were committed" summary was not true for native skill files.

Approach (WHAT)

Concern Decision
Baseline evidence Extend the #3564 owner skill_adoption.py: after the current-source comparison fails, compare with the locked source, materialized once per package from the lock's full-SHA commit (build_download_ref(..., require_locked=True)). Same whole-tree, claimed-in-lock, rendered-bytes rule; no lockfile hashes.
Scope Only apm update / install --update (ctx.update_refs), only for skills without any local receipt, fetched lazily only when the current-source comparison fails.
All-or-nothing The read-only skill preflight (find_unmanaged_conflicts) now reports managed files that materialization would refuse (untrusted), using the same skill_tree_baselines decision. Refusals are recorded as package diagnostics and integrate returns before any package writes.
Edits Locally edited files match neither source → existing refusal and guidance, unchanged wording.

Implementation (HOW)

File Change
integration/skill_adoption.py LockedSkillSources (lazy per-owner fetch into private scratch, DeployableSourcePlan built like the current plan, fail-closed on errors, close() removes scratch), locked_skill_sources(ctx) (update-only fetcher: full-SHA require_locked pin through the existing downloader) and skill_tree_baselines, the single decision used by preflight and copy.
integration/skill_integrator.py _copy_skill_bundle routes through skill_tree_baselines; the copy filter exposes rebased(plan) so the locked tree uses the identical filter. Net −5 lines (file stays under the 2100-line guard).
integration/skill_preflight.py Managed, existing files with no receipt baseline and no adoption → SkillConflict(untrusted=True), including identical bytes unless copying keeps them through the raw-identical sub-skill shortcut.
install/template.py, install/phases/integrate.py, install/context.py Untrusted conflicts become package-attributed diagnostics errors; skill_baseline_refused stops integrate before any write. Unmanaged conflicts keep raising as before.
install/pipeline.py, core/deployment_ledger.py Update runs attach LockedSkillSources to the materialization session and close it in a finally around the unchanged ownership-snapshot block (pipeline stays under its 1000-line budget).
integration/base_integrator.py untrusted_baseline_message() shared by copy and preflight (text unchanged); projected_resolve_links() renders the locked tree with a resolver rooted at the locked package, projected into the current deployment frame.

Diagram

Legend: per receipt-less skill tree, the shared baseline decision (new behavior boxed) that both preflight and the copy step consume.

flowchart LR
    A["Skill tree, no local receipt"] --> B{"Equals current source render?"}
    B -->|yes| OK["Adopt on-disk hashes as baseline"]
    B -->|no| C{"apm update?"}
    subgraph NEW["New in this PR"]
        C -->|yes| D["Fetch locked full-SHA commit once"]
        D --> E{"Equals locked source render?"}
    end
    C -->|no| R["Refuse in preflight, write nothing"]
    E -->|yes| OK
    E -->|no| R
    OK --> W["Replace with new version, record receipts"]
Loading

Trade-offs

  • Extra fetch on the failure path. In update mode, a receipt-less tree that fails the current-source comparison triggers one download of the locked commit (usually a cache hit), even when the commit is unchanged and the tree is simply edited. Chosen over threading the new resolved commit through the skill integrator, which sits at its line cap.
  • Preflight is a no-false-positive filter, not a full simulation. It flags only existing managed files whose bytes differ from the new render and have no baseline/adoption; rarer refusals (e.g. identical bytes on the native route with an extra file) still surface from the copy step as before.
  • Registry and local-path packages get no locked-source fallback (no immutable Git pin); they keep today's fail-closed behavior.
  • Rejected: trusting deployed_file_hashes (explicitly out of scope) and journaling/rolling back native writes (a much larger transaction redesign).

Benefits

  1. Receipt-less apm update --yes (apm-action update: true) exits 0, replaces changed skill files, adds new ones, and moves the lockfile.
  2. A failed receipt-less update leaves git status exactly as before: no untracked leftovers, no lockfile change.
  3. One adoption owner for install and update; no second path.

Issue and approved scope

Issue: Fixes #3625

Human scope-approval comment: #3625 (comment) (Done-when and Out-of-scope followed literally: no new flags, no --force change, no receipt redesign, no apm-action change, lockfile hashes never trusted).

Does this PR complete the issue, or what remains? Completes it.

Note

Local preflight skipped by maintainer instruction (2026-11-12); CI is the gate.

Type of change

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

Testing

  • Tested locally
  • All existing tests pass (targeted set below; CI is authoritative)
  • Added tests for new functionality (if applicable)

Scenario evidence

# Scenario (user promise) Principle(s) Test(s) proving it Type
1 Receipt-less update from v0.4.1 to v0.5.0 (changed + added files, transitive claude_skill) exits 0, replaces files and moves the lock DevX, Governed by policy tests/integration/test_update_receipt_less_lifecycle.py::test_receipt_less_update_replaces_unchanged_locked_files e2e (windows_compat)
2 A locally edited file fails closed; tree and lockfile unchanged, no untracked leftovers Secure by default tests/integration/test_update_receipt_less_lifecycle.py::test_receipt_less_update_with_edited_file_fails_closed e2e (windows_compat)
3 Locked-source adoption requires an identical, claimed, receipt-less tree; never with --force, edits, extra files or unavailable locked source Secure by default tests/unit/integration/test_skill_adoption.py (test_update_*, test_locked_sources_close_removes_private_scratch) unit (windows_compat)
4 Preflight refuses untrusted managed files and accepts baseline/identical/locked-adoptable/absent ones Secure by default tests/unit/integration/test_skill_preflight.py::test_managed_file_without_trusted_baseline_is_refused_before_writes unit (windows_compat)
5 #3564 cold restore and receipt contracts unchanged Governed by policy test_cold_restore_skill_adoption_lifecycle.py, test_cold_skill_receipt_preservation.py, test_skill_materialization_receipt_lifecycle.py e2e
Commands and results
  • Regression on main before the fix: pytest tests/integration/test_update_receipt_less_lifecycle.py -p no:xdist → 2 failed (exit 1 + 3 refusals; ?? .agents/skills/beta/added.md).
  • Mutation-break: forcing skill_tree_baselines to skip the locked fallback → happy-path test fails (exit 1); removing the preflight refusal/early return → fail-closed test fails (M beta/SKILL.md, ?? beta/added.md).
  • After merging origin/main: pytest -p no:xdist tests/integration/test_update_receipt_less_lifecycle.py tests/unit/integration/test_skill_adoption.py tests/unit/integration/test_skill_preflight.py tests/integration/test_cold_restore_skill_adoption_lifecycle.py → 58 passed.
  • pytest -p no:xdist tests/unit/install/phases/test_cleanup_phase.py tests/unit/install/test_pipeline_ownership_snapshot.py tests/unit/test_deployment_materialization_receipts.py tests/unit/test_symlink_containment.py tests/integration/test_architecture_{materialization_receipts,skill_preflight,skill_provenance_scope,shared_skill_preservation}.py → 196 passed, 1 skipped.
  • pytest -p no:xdist tests/integration/test_cold_skill_receipt_preservation.py tests/integration/test_cold_restore_skill_adoption_lifecycle.py tests/integration/test_skill_materialization_receipt_lifecycle.py → 69 passed.
  • Copilot round 1 (2 LEGIT findings) folded in e98b879987 / 5732a016f9 with regressions test_identical_member_needs_a_baseline_unless_copy_keeps_it and test_locked_links_render_into_the_current_deployment_frame, both mutation-break verified. Exact-head (5732a01) functional set: 172 passed, 1 skipped; CI 23 pass / 3 skipping / 0 failing.
  • Lint mirror (ruff check, ruff format --check, pylint R0801, lint-auth-signals.sh, lint-architecture-boundaries.sh, file-length) → clean.

How to test

  • APM_BINARY_PATH=.venv/bin/apm uv run --extra dev pytest -p no:xdist tests/integration/test_update_receipt_less_lifecycle.py
  • Revert the src/ changes and rerun: both tests fail as in the issue.
  • uv run --extra dev pytest -p no:xdist tests/unit/integration/test_skill_adoption.py tests/unit/integration/test_skill_preflight.py

Spec conformance (OpenAPM v0.1)

Co-authored-by: Copilot [email protected]

On a fresh clone or CI runner without local deployment receipts (for
example microsoft/apm-action scheduled updates), `apm update` refused to
replace committed skill files of the package it updates and left new
files behind. The #3391 cold-restore rule now extends to update: a skill
tree identical to what the currently locked version renders, fetched from
its full-SHA locked commit, is adopted as the baseline and replaced by the
new version. Lockfile hashes are never used as evidence.

The adoption decision is shared by skill materialization and the
read-only skill preflight, so a skill file without a trustworthy baseline
is refused before any package writes: a failed update leaves the working
tree and lockfile unchanged.

apm-spec-waiver: local deployment receipts and receipt-less skill adoption are implementation state not covered by any OpenAPM v0.1 requirement

Fixes #3625

Co-authored-by: Copilot App <[email protected]>
Copilot AI balanced review requested due to automatic review settings November 12, 2026 15:41

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.

🟡 Changes recommended

Preflight can allow receipt-less updates that fail after partially writing files, while locked-tree link resolution can incorrectly reject unchanged skills.

2 open issues
What changed in this PR

This PR extends cold-restore skill adoption to receipt-less updates, addressing #3625 for fresh clones and CI runners. It uses the currently locked source as baseline evidence rather than trusting lockfile hashes.

Changes:

  • Adds lazy retrieval of locked sources and shares adoption decisions between preflight and copying.
  • Adds preflight diagnostics and an early integration exit for detected untrusted replacements.
  • Adds regression coverage and documents receipt-less update behavior.
File Description
tests/​unit/​integration/​test_skill_preflight.py Tests trusted, untrusted, and locked-adoptable preflight cases.
tests/​unit/​integration/​test_skill_adoption.py Tests locked-source adoption, rejection, caching, and cleanup.
tests/​integration/​test_update_receipt_less_lifecycle.py Adds installed-CLI update and edited-file regression scenarios.
src/​apm_cli/​integration/​skill_preflight.py Reports untrusted managed replacements before copying.
src/​apm_cli/​integration/​skill_integrator.py Uses shared adoption logic and rebasable copy filters.
src/​apm_cli/​integration/​skill_adoption.py Adds locked-source retrieval and shared tree-baseline decisions.
src/​apm_cli/​integration/​base_integrator.py Extracts the existing baseline-refusal message.
src/​apm_cli/​install/​template.py Converts untrusted conflicts into package diagnostics.
src/​apm_cli/​install/​pipeline.py Attaches locked sources to update sessions and cleans up scratch files.
src/​apm_cli/​install/​phases/​integrate.py Stops integration after baseline preflight refusal.
src/​apm_cli/​install/​context.py Tracks baseline preflight refusal state.
src/​apm_cli/​core/​deployment_ledger.py Holds the session’s locked-source provider.
packages/​apm-guide/​.apm/​skills/​apm-usage/​commands.md Documents receipt-less update adoption and refusal behavior.
docs/​src/​content/​docs/​reference/​cli/​update.md Explains locked-source adoption during updates.
docs/​src/​content/​docs/​reference/​cli/​install.md Adds the update exception to receipt guidance.
docs/​src/​content/​docs/​consumer/​install-packages.md Describes receipt-less updates in the consumer workflow.
CHANGELOG.md Records the update fix and intended preservation guarantees.

Review effort: Balanced

@danielmeppiel

Copy link
Copy Markdown
Collaborator Author

APM Review Panel: ship_now

P0 bug fix: receipt-less apm update now adopts unchanged committed skill files via full-SHA baseline comparison and fail-closed preflight, unblocking CI pipelines.

panel-mode=lean; personas=supply-chain-security-expert,test-coverage-expert,apm-ceo

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

Both panelists converge cleanly. The supply-chain-security-expert confirms the adoption path uses full-SHA commit pins and byte-for-byte content comparison with no trust placed in lockfile hashes alone -- exactly the security posture the #3391 rule established. Fail-closed semantics hold on every error path: download failure, hash mismatch, and user-edited managed files all abort before any package writes. The test-coverage-expert confirms two new e2e lifecycle regression traps (test_receipt_less_update_replaces_unchanged_locked_files and test_receipt_less_update_with_edited_file_fails_closed in tests/integration/test_update_receipt_less_lifecycle.py) pass on this head and fail on main, proving both the happy-path adoption and the fail-closed guard are load-bearing on this commit.

Strategically, this is a straightforward P0 fix inside approved scope. If apm update fails on a fresh clone, every apm-action user hits it on the next scheduled run. The disclosed trade-offs (extra cached fetch on the failure path, no locked fallback for registry/local-path packages) are honest and scoped. No breaking change, no new flags, no public API surface change. auth-expert matched the install/pipeline.py fast-path but was not spawned: the locked-commit fetch routes through the existing downloader.download_package / AuthResolver with no token, host or header change.

Aligned with: Secure by default -- full-SHA locked-commit fetch and byte-for-byte comparison, no lockfile hash trust, fail-closed preflight before any writes. Portable by manifest -- receipt-less update works from apm.yml + apm.lock.yaml alone. Pragmatic as npm -- apm update on a clean checkout replaces skill files and exits 0 with no extra flags.

Panel summary

Persona B R N Takeaway
Supply Chain Security Expert 0 0 0 Locked-source adoption uses full-SHA pins, byte-for-byte content comparison (no lockfile hash trust), fail-closed on every error path, and all-or-nothing preflight before any writes.
Test Coverage Expert 0 2 0 Both receipt-less update lifecycle regression traps pass on this head and failed on main; unit coverage thorough; no gap found.

B = blocking-severity findings, R = recommended, N = nits.
Counts are signal strength, not gates. The maintainer ships.

Recommendation

Zero required findings from either panelist, clean security posture, load-bearing regression traps proven on this commit. This is a scoped P0 fix inside human-approved boundaries with no breaking changes. Ship once CI is green.


Full per-persona findings

Supply Chain Security Expert

No findings.

Test Coverage Expert

  • [recommended] Lifecycle regression trap covers happy-path receipt-less update replacing unchanged locked files. at tests/integration/test_update_receipt_less_lifecycle.py
    Informational positive evidence; no gap.
    Proof (passed): tests/integration/test_update_receipt_less_lifecycle.py::test_receipt_less_update_replaces_unchanged_locked_files
  • [recommended] Lifecycle regression trap covers fail-closed path when user has edited a managed file. at tests/integration/test_update_receipt_less_lifecycle.py
    Informational positive evidence; no gap.
    Proof (passed): tests/integration/test_update_receipt_less_lifecycle.py::test_receipt_less_update_with_edited_file_fails_closed

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-review-worker. This comment is AI-generated and may contain errors.

Addresses Copilot inline on skill_preflight.py:264: an identical managed
member without a baseline is now refused in preflight unless copying keeps
it through the raw-identical sub-skill shortcut, so a native skill whose
removed file was edited cannot leave a partial failed update.

Addresses Copilot inline on skill_adoption.py:240: the locked tree renders
links with a resolver rooted at the locked package and projected into the
current deployment root, matching what the earlier deployment wrote.

Moves the update-only locked-source fetcher out of install/pipeline.py to
keep it under its LOC budget, and makes the lifecycle fixture remove
read-only Git packs on Windows.

apm-spec-waiver: local deployment receipts and receipt-less skill adoption are implementation state not covered by any OpenAPM v0.1 requirement

Co-authored-by: Copilot <[email protected]>
The architecture linter reserves deployment-frame projection for its
owners and the pipeline ownership-snapshot shape for one canonical with
block. The locked-source renderer is now BaseIntegrator.projected_resolve_links
and the pipeline closes locked sources in a finally around the unchanged
snapshot block.

apm-spec-waiver: local deployment receipts and receipt-less skill adoption are implementation state not covered by any OpenAPM v0.1 requirement

Co-authored-by: Copilot <[email protected]>
@danielmeppiel

Copy link
Copy Markdown
Collaborator Author

APM Review Panel: ship_now

Delta tightens preflight and link rendering for locked skill adoption, closing a partial-write hole and a false-refusal path, both mutation-break verified.

panel-mode=delta; personas=apm-ceo

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

The prior lean advisory on 6b2b462 returned ship_now with zero gap findings from both supply-chain-security-expert and test-coverage-expert. The delta on 5732a01 folds two Copilot inline findings that each address a real correctness gap in the new adoption machinery. Neither weakens the security posture; both make it strictly tighter or strictly more correct.

Delta 1 (preflight partial-write hole) is the material change: an identical managed member without a baseline or adoption could pass preflight and then let sibling files write. Preflight now refuses it unless copying keeps it through the same raw-identical sub-skill shortcut _promote_sub_skills uses, so the all-or-nothing assumption holds unconditionally. test_identical_member_needs_a_baseline_unless_copy_keeps_it is mutation-break verified.

Delta 2 (link rendering false refusals) is a correctness fix: the locked tree was rendered with the new package's resolver, so links to package assets outside the skill failed containment. BaseIntegrator.projected_resolve_links now renders with a resolver rooted at the locked package and projected into the current deployment frame, inside the owner set the architecture linter enforces. It still fails closed. Delta 3 is housekeeping: install/pipeline.py back under its LOC budget (998/1000), the canonical ownership-snapshot block unchanged, and Windows-safe fixture cleanup. CI is green on 5732a01: 23 pass, 3 skipping, 0 failing, including the Windows Compatibility Gate and Architecture Ratchet.

Aligned with: Secure by default -- preflight is strictly tighter and link rendering still fails closed. Governed by policy -- LOC ratchet and ownership-snapshot guard respected. Portable by manifest -- locked links render into the current deployment frame.

Recommendation

Prior lean advisory was already ship_now with zero gaps. The delta strictly tightens the preflight contract and fixes a false-refusal path, both backed by mutation-break verified regression tests with full CI green. No follow-ups needed.

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-review-worker. This comment is AI-generated and may contain errors.

@danielmeppiel
Daniel Meppiel (danielmeppiel) merged commit cca7219 into main Nov 12, 2026
27 checks passed
@danielmeppiel
Daniel Meppiel (danielmeppiel) deleted the danielmeppiel-fix-update-cold-baseline-3625 branch November 12, 2026 18:01
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 12, 2026
Main's #3638 refuses receipt-less skill replacement before any package
write. Prove that such a refusal fails the install before the lock and
before the native Claude phase, so no plugin registration changes for an
install a gate rejected. Mutation-break: dropping the FAILED precommit
return lets resync_claude_plugins run and fails both scope cases.

Addresses delta panel test-coverage-expert finding at 0d91bcc.

Co-authored-by: Copilot App <[email protected]>
Jake Aitchison (milkshakeuk) added a commit to milkshakeuk/dependabot-core that referenced this pull request Nov 18, 2026
0.36.0 includes microsoft/apm#3638, which adopts unchanged committed
skills when the local deployment receipts are missing, but only for
`apm update`. After a manifest edit, `apm install` on a fresh checkout
still refuses every committed file of the changed package ("no
trustworthy local deployment baseline") and fails, so the dependabot#3625
workaround and the edited-file check are still needed. With them, every
end-to-end scenario matches a fresh install of the new version and
passes `apm install --frozen`.

0.36 also copies the source licence into subdirectory packages
(microsoft/apm#3646). The copied LICENSE is recorded in
`deployed_files` and `deployed_file_hashes` like any other deployed
file, so the updater handles it without change. The checksums come from
the release's `.sha256` files and match both downloaded archives.
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 19, 2026
…3883)

On a fresh clone without deployment receipts, `apm install` after an
apm.yml ref bump (the Renovate flow) refused every file of a changed skill
with "no trustworthy local deployment baseline", although the committed
files are byte-identical to what the currently locked version renders.
The locked-source baseline from #3638 was gated on `apm update` only.

skill_adoption now supplies that baseline whenever a lock entry exists
and the commit being installed (installing_commit) differs from it, and
skips the redundant download when they match. Lockfile hashes are still
never trusted and edited files still fail closed. A new
install-deployment-skill-adoption-baseline guard pins the owner.

apm-spec-waiver: receipt-less skill adoption is APM deployment-state behavior with no OpenAPM requirement
Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 19, 2026
* fix(install): reuse an apm_modules copy only when it matches the lock (#3884)

The resolver gate (drift.should_force_ref_recheck) compared only the
manifest ref with the lock, so a package copy left by an older lock was
read during resolution: its outdated apm.yml widened a locked skill
subset and the first `apm install --frozen` failed with "dependency
selections differ", while integrate later re-downloaded the copy and a
second run passed.

drift.locked_copy_proof now owns "does this copy hold the locked
content": git HEAD, then the .apm-pin marker naming the locked
resolved_commit, then the content-hash fallback (rows without a commit
or copies without a marker). The resolver gate, the parallel
pre-download skip and the integrate skip all consume it. Guarded by
install-deployment-locked-copy-validity.

apm-spec-waiver: cache-reuse correctness fix inside the existing resolver gate; no OpenAPM contract change

Co-authored-by: Copilot App <[email protected]>

* fix(install): adopt locked skill output after an apm.yml ref change (#3883)

On a fresh clone without deployment receipts, `apm install` after an
apm.yml ref bump (the Renovate flow) refused every file of a changed skill
with "no trustworthy local deployment baseline", although the committed
files are byte-identical to what the currently locked version renders.
The locked-source baseline from #3638 was gated on `apm update` only.

skill_adoption now supplies that baseline whenever a lock entry exists
and the commit being installed (installing_commit) differs from it, and
skips the redundant download when they match. Lockfile hashes are still
never trusted and edited files still fail closed. A new
install-deployment-skill-adoption-baseline guard pins the owner.

apm-spec-waiver: receipt-less skill adoption is APM deployment-state behavior with no OpenAPM requirement
Co-authored-by: Copilot App <[email protected]>

* fix(mcp,lsp): record ${CLAUDE_PLUGIN_ROOT} portably so frozen replay works in any clone

MCP and LSP servers from Claude plugins were recorded with the placeholder
expanded to the absolute apm_modules path, in apm.lock.yaml and in committed
native configs. A clone at another path failed `apm install --frozen` and
`apm audit --ci`, and an ordinary install rewrote committed files (#3825).

- APMPackage keeps the authored placeholder in MCP/LSP declarations and binds
  the package root (deps/plugin_root_render.py, new owner); the lock write,
  --frozen comparison, audit config-consistency and native receipts all use
  the portable form. The extraction-time expansion path is removed.
- Only target renders expand it: ${CLAUDE_PROJECT_DIR:-.} in the shared root
  .mcp.json (Claude Code, Copilot CLI), ${workspaceFolder} for Cursor and
  VS Code, ${CLAUDE_PROJECT_DIR} in the Claude LSP plugin; other targets and
  user scope keep the absolute path.
- A lock from an earlier release holding the expanded value is equivalent
  (same root, or another clone's root with the same install path), so
  upgrades replay --frozen; the next install rewrites it once, refreshing the
  native receipt.
- Owner registered with mutation_writes.plugin_root_render and a mutation case.

Closes #3825 scope: #3825 (comment)

Co-authored-by: Copilot App <[email protected]>

* docs(changelog): note lock-derived expected state fixes (#3900)

Co-authored-by: Copilot App <[email protected]>

* fix(install): keep .apm-pin trust honest (#3884 panel folds)

Folds the lean panel on #3900:
- a readable .git HEAD decides alone; the marker cannot outrank it
  (python-architect A1);
- for deployment reuse a marker counts only on rows whose content_hash
  is verified before the bytes are reused, so commit-only rows keep
  main's re-download (supply-chain S2, test-coverage T2);
- sync_markers_for_lockfile stamps only copies the copy-validity owner
  proves (or legacy unmarked, unhashed copies), so a copy left by an
  older lock is never marked as current (supply-chain S1, T3);
- staleness needs contradicting evidence (hash, marker or .git), so
  legacy unmarked, unhashed copies keep main's no-network replay
  (spec req-rs-015 frozen short-pin contract);
- unit coverage for every owner branch, the integrate marker paths and
  the marker writer (T1, T2), each mutation-broken.

Co-authored-by: Copilot App <[email protected]>

* fix(mcp): keep pre-#3825 MCP state replayable and removable; refuse plugin-root agent export

Review follow-ups for #3825 on #3900:

- Ownership keeps the recorded baseline. A lock written before #3825 holds
  ${CLAUDE_PLUGIN_ROOT} expanded; normalizing it to the portable declaration
  made an unfingerprinted Claude or Cursor entry look foreign, so install
  reported a collision instead of migrating it. The stored baseline now
  proves the old write, and the install rewrites it in the portable form.
- `apm install --frozen` replays a legacy-equivalent server at its recorded
  root (CurrentMcpConfigView.replay_recorded_roots), so native files keep
  matching their lock receipts and an immediate uninstall can remove them.
- The legacy match accepts only a normalized absolute root (no empty, "." or
  ".." segments), since --frozen now writes the recorded value.
- `apm pack --format agent-plugin` refuses an MCP server using
  ${CLAUDE_PLUGIN_ROOT}: Agent Plugins do not resolve it and the bundle does
  not include the plugin's files.

Co-authored-by: Copilot App <[email protected]>

* fix(install): .apm-pin never proves bytes about to be deployed

The pre-download skip trusted a matching marker on a tampered copy and
left the re-download to integrate's sequential path, which classifies a
Claude plugin differently and rewrote package_type in apm.lock.yaml
(test_plugin_redownload_and_update_restamp_verify_on_fresh_clone).
Deployment reuse now needs the git HEAD or the verified content hash, as
on main; the marker only gates resolution freshness and staleness.

Co-authored-by: Copilot App <[email protected]>

* fix(install): strict-by-default copy proof; marker writer asks the owner

Delta panel folds on #3900:
- locked_copy_proof never consults .apm-pin unless trust_marker=True, so
  a new deployment caller cannot trust the marker by omission; only
  locked_copy_is_stale (resolution freshness) opts in, and the guard
  rejects trust_marker=True in download/integrate (python-architect).
- sync_markers_for_lockfile now asks locked_copy_is_stale instead of a
  second legacy rule, so a checkout whose git HEAD contradicts the lock
  is never stamped (python-architect, supply-chain).
- Owner record text updated; unit traps for the .git staleness clause and
  the marker writer, each mutation-broken (test-coverage).

Co-authored-by: Copilot App <[email protected]>

* fix(mcp): --frozen never writes a lock-sourced plugin root

A pre-#3825 lock records ${CLAUDE_PLUGIN_ROOT} expanded, and the moved-clone
match accepts any normalized absolute prefix ending in the install path. The
frozen replay rendered native MCP commands at that root, so lock text chose
the absolute path a command runs (for example a rebuilt, uncommitted
.cursor/mcp.json), and audit --ci accepted it.

- replay_recorded_roots no longer renders the recorded root. It marks the
  server so --frozen keeps a native entry that already equals the recorded
  render (no new path; its lock receipt stays the uninstall proof), and every
  other entry gets this project's own portable render.
- Ownership accepts an entry that is exactly this project's portable render
  of a recorded other-clone baseline (portable_rewrite_equivalent), so the
  portable entries a frozen install writes stay removable without a receipt.

Co-authored-by: Copilot App <[email protected]>

* docs(changelog): one line per #3900 change, caveat inline (#3914 rule)

Co-authored-by: Copilot App <[email protected]>

---------

Co-authored-by: danielmeppiel <[email protected]>
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] apm update without deployment receipts deletes (0.35.0) or refuses to replace (0.35.1+) the files of the package it updates

2 participants