Repository navigation
fix(install): projects installed before 0.37 upgrade seamlessly (#4398) - #4522
Merged
Daniel Meppiel (danielmeppiel) merged 18 commits intoNov 20, 2026
Conversation
…de (#4398) Fixture tests/fixtures/pre036_upgrade/v0.35.1 is produced by the released apm-cli 0.35.1 wheel (generate.py; FIXTURE.json records the version): a project with a local package whose Cursor applyTo "**" rule and linked Codex agent render differently in 0.37. C1: an unedited clone re-renders silently once (exit 0, no Kept line, files equal the 0.37 render, lock rewritten and matching disk, receipts recorded, audit --ci, install --frozen and a repeat install change nothing). C2: one edited file stays byte-identical with exactly one Kept line from the shared template, the others converge; exit 1 when 0.37 brings new bytes for the edited file, 0 when it brings the same bytes (#4504). C4: install --frozen on the untouched clone exits 0 and writes nothing. All four fail on the parent b7bd508 (Kept refusals, exit 1, frozen writes). Co-authored-by: Copilot App <[email protected]>
…anielmeppiel-seamless-legacy-upgrade-4398
…essly (#4398) APM 0.35 and earlier recorded no deployment receipts, so their lockfile hash is the only record of what they deployed. On a lockfile stamped before 0.36 (or unstamped), a managed file whose bytes equal its recorded hash and that git tracks unchanged is proven APM-owned: install re-renders it once and records receipts and a new lock. A file whose bytes differ is a proven edit: it is kept and named once through kept_edit_message; it warns (exit 0) when the package renders the recorded bytes and errors (exit 1) when it renders new ones. install --frozen verifies such a project and adopts the files as they are, writing nothing. Locks from 0.36 on keep the #4360 rule: a lock hash is never evidence. Co-authored-by: Copilot App <[email protected]>
#4398) C3: a lock hash forged to match a local edit of .cursor/rules/everywhere.mdc. A >=0.36 stamp (v0.36.1 fixture) never overwrites it, dirty or clean. A <=0.35 stamp overwrites it only when the file is git-tracked and clean (edit committed, recoverable from git); tracked-dirty, staged and untracked are kept with one shared Kept line. The overwrite case is red on the parent b7bd508 (kept, exit 1); the kept cases are red on the Kept template only. C5: a project written by a released 0.36.1 (fixture tests/fixtures/pre036_upgrade/v0.36.1, FIXTURE.json records 0.36.1) keeps every deployed byte on upgrade, exits 0, prints no Kept line, and audit --ci, --frozen and a repeat install converge. Green on the parent (non-regression guard). The 0.36.1 wheel was built from the v0.36.1 release tag because PyPI file downloads time out on this host. Co-authored-by: Copilot App <[email protected]>
…ifecycle Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot App <[email protected]>
…anielmeppiel-seamless-legacy-upgrade-4398
Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot App <[email protected]>
Per the steward's #4398 update, the lock-hash migration covers any lock stamped before 0.37. C3 now runs eight cells: 0.35.1 and 0.36.1 stamps overwrite a forged-hash edit only when it is git-tracked and clean; a lock written by the binary under test (asserted >= 0.37) never does. C5b: a 0.36-stamped lock whose files differ from the 0.37 render converges with exit 0, no Kept line, a lock matching disk, and clean audit --ci, frozen and repeat installs. Released 0.36.1 renders every file primitive like 0.37, so C5b restamps the 0.35.1 renders as 0.36.1. FIXTURE.json for v0.36.1 records that its wheel was built at the v0.36.1 tag. Red on parent b7bd508: stamp036-clean (kept, exit 1), stamp037-clean (Kept template), C5b (exit 1). Co-authored-by: Copilot App <[email protected]>
…anielmeppiel-seamless-legacy-upgrade-4398
…s no edit Co-authored-by: Copilot App <[email protected]>
…anielmeppiel-seamless-legacy-upgrade-4398
) Per the steward's update, any lock stamped before 0.37 comes from an APM that did not require receipt evidence, so a git-clean file holding its recorded bytes migrates once. Docs, CHANGELOG and the ledger row follow; the ledger cites C3 and C5b. Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel)
requested a review
from Sergio Sisternes (sergio-sisternes-epam)
as a code owner
November 20, 2026 21:55
…nd Kiro (#4398) C6 upgrades a Copilot + Kiro project produced by the released 0.36.1 binary (GitHub release asset, sha256 recorded in FIXTURE.json via the new generate.py --case copilot-kiro-mcp and --provenance options): the self-defined MCP server moves from .github/mcp.json to the root .mcp.json, the package's Kiro agent naming '@notes' (refused by 0.36.1) deploys, every file equals a fresh 0.37 render, the lock matches disk, and audit --ci, install --frozen and a repeat install change nothing. Green on b7bd508. Co-authored-by: Copilot App <[email protected]>
…4398) Steward rule: a forger can only know committed bytes, which stay recoverable, so a file git tracks unchanged or does not track at all (untracked, ignored, no repository) migrates; a tracked file with a staged or unstaged change matching the lock is kept; other git errors fail closed. C1 gains nogit and gitignored cells; C3 stamp035-untracked now expects the overwrite. Co-authored-by: Copilot App <[email protected]>
…anielmeppiel-seamless-legacy-upgrade-4398
Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel)
merged commit Nov 20, 2026
0d134c7
into
train/0.37-final-2
6 checks passed
Daniel Meppiel (danielmeppiel)
deleted the
danielmeppiel-seamless-legacy-upgrade-4398
branch
November 20, 2026 22:06
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 20, 2026
Co-authored-by: Copilot App <[email protected]>
5 of 12 tasks
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 20, 2026
… extraction, frozen-flag reader, legacy/strict cells (#4522 follow-ups) Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 20, 2026
Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 20, 2026
…update Co-authored-by: Copilot App <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The first 0.37 install of a project last installed by an APM before 0.37 refused unedited managed files whose render changed (for example the 0.35 Cursor
applyTo: "**"rule and the Codex agent with a relative link). It kept them, named them and exited 1, and the user had to move each one aside by hand. Daniel ruled this a 0.37 tag-gating bug: the upgrade must be seamless, as with npm.Mechanism, owned by
core/deployment_ledger.py:legacy_lock_hashesreads the recorded hashes only from a lock stamped before 0.37, or one with no stamp. A claim recorded with conflicting hashes is dropped.DeploymentMaterializationSession.legacy_owned(path, claim)proves APM wrote the file when three things hold: the file holds the recorded bytes, the lock predates 0.37, andgit_tracked_clean(path).git_tracked_cleanmeansgit ls-files --error-unmatchsucceeds andgit status --porcelainis empty. Outside a work tree, or on any git error, it fails closed.overwrite_authorizedaccepts that proof. The file is re-rendered silently once, with receipts and a new lock written, so the next run uses the 0.37 evidence model.kept_edit_message(proven_edit=True)(fix(install): one owner and one message for a kept edited file #4504). It warns with exit 0 when the package renders the recorded bytes, and errors with exit 1 when it renders new bytes.install --frozenverifies and never migrates: legacy-owned files are adopted as they are, and nothing is written.Stacked on #4504 (shared kept template). This PR's own commits start after 5b69e45.
Issue and approved scope
Issue: Fixes #4398
Human scope-approval comment: #4398 (apm-scope:v1 record). Daniel's 21:30 ruling, relayed by the conductor, makes part 2 tag-gating. The steward's acceptance cells C1-C5 were relayed by PM v2, including the "< 0.37" boundary update.
Does this PR complete the issue, or what remains? It completes it. Part 1 (the
--frozenlocked-render fallback) is fixed by 3de827c. The steward accepted closing it without a new cell: under--frozenthe current render is the locked render, and #4519 refuses dropped targets and removed dependencies first. The pins aretest_architecture_lockfile_write_authority, C4, and #4519's dropped-target frozen cell.Type of change
Testing
-p no:xdist, via the host guard):pytest tests/integration/test_legacy_lock_upgrade_lifecycle.py tests/quality/test_lifecycle_bug_ledger.py tests/integration/test_receiptless_overwrite_lifecycle.py: 27 passed.tests/fixtures/pre036_upgrade/v0.35.1was generated by the released apm-cli 0.35.1 wheel.v0.36.1was built from the v0.36.1 tag because PyPI timed out.FIXTURE.jsonrecords each version. Cells by 9fd217b2 and 6f50edad.Changelog
### Changed. The fix(install): replace a managed file only with deployment evidence (#4360) #4382 upgrade note drops "may be refused once".Spec conformance (OpenAPM v0.1)
Agent note, not authored by Daniel.