You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(install): a converged install leaves an identical .apm-pin marker untouched - #4794
install/cache_pin.py::write_marker rewrote every apm_modules/<pkg>/.apm-pin cache-pin marker on every install, with identical bytes. So no apm install was ever write-free: a tree-10 no-op made 10 marker rewrites. This blocks a strict no-op fast path (#4775), which may replay only a run that wrote nothing, and it adds needless writes to every warm install.
Changes to the marker write (the only writer of .apm-pin):
An existing regular-file marker with identical bytes is left untouched; it is read without following links.
Otherwise the marker is written atomically as a regular file: a temp file in the same directory, fsync, then os.replace over the old entry. An existing link or other non-regular entry is replaced, never written through. A directory in the way is left alone, the temp file is removed, and install continues as before (silent, surfaced by the drift-replay verify step).
The marker format does not change.
Effect: marker rewrites per tree-10 no-op go from 10 to 0. Found by the #4775 recorder (ABAB#3 at 7161255: not recorded ['write:.../apm_modules/perf-org/pkg-000/.apm-pin', ...]).
… untouched
write_marker rewrote every apm_modules/<pkg>/.apm-pin on every install, so a
no-op install was never write-free (10 marker rewrites per tree-10 no-op).
An existing regular-file marker with identical bytes is now left as is; a
missing, different or symlinked marker is still (re)written. No marker
format change.
apm-spec-waiver: skips rewriting a byte-identical cache marker; the marker format and every observable outcome are unchanged
Co-authored-by: Copilot App <[email protected]>
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
An unreadable but writable marker triggers PermissionError and skips the best-effort write, regressing self-healing for markers that could previously be repaired.
This PR addresses #4790 by avoiding redundant .apm-pin writes during converged installs, removing one obstacle to the write-free no-op fast path proposed in #4775.
Changes:
Skip rewriting identical regular-file markers without changing their format.
Add regression tests for identical, missing, different and symlinked markers.
Document the reduced marker writes in a changelog fragment.
…nstall
A full eligible install records every input it observes (files read and
their SHA-256, directories listed, paths probed, realpath answers, env vars
read). When that run was itself a no-op (no writes, no network or subprocess
outside org-policy discovery, no prompt, clean exit 0, one No changes
summary) the inputs are stamped in the cache root. A later run whose
recorded inputs are all identical, whose LIVE org policy routes to the same
fingerprint and whose deployed files match the lockfile content hashes
replays the recorded output and writes nothing; anything else runs the full
pipeline. Off by default: APM_INSTALL_FAST_PATH=1 opts in (#4770 re-scope).
Rebased on #4794 (cache-pin markers no longer rewritten on a no-op).
Squash of the reviewed L5 history (backup ref l5-backup-6b1395d).
apm-spec-waiver: the opt-in no-op replay reproduces the full pipeline's observable install output and state; no OpenAPM requirement changes
Co-authored-by: Copilot App <[email protected]>
The marker is written to a temp file in the same directory and renamed over
the old entry, so an existing link or other non-regular entry is replaced
and never written through; an identical regular-file marker is still left
untouched. Tests: a symlinked marker becomes a regular file and its target
is unchanged; a directory in the way leaves no temp file behind.
Co-authored-by: Copilot App <[email protected]>
…nstall
A full eligible install records every input it observes (files read and
their SHA-256, directories listed, paths probed, realpath answers, env vars
read). When that run was itself a no-op (no writes, no network or subprocess
outside org-policy discovery, no prompt, clean exit 0, one No changes
summary) the inputs are stamped in the cache root. A later run whose
recorded inputs are all identical, whose LIVE org policy routes to the same
fingerprint and whose deployed files match the lockfile content hashes
replays the recorded output and writes nothing; anything else runs the full
pipeline. Off by default: APM_INSTALL_FAST_PATH=1 opts in (#4770 re-scope).
Rebased on #4794 (cache-pin markers no longer rewritten on a no-op).
Squash of the reviewed L5 history (backup ref l5-backup-6b1395d).
apm-spec-waiver: the opt-in no-op replay reproduces the full pipeline's observable install output and state; no OpenAPM requirement changes
Co-authored-by: Copilot App <[email protected]>
A read failure now prevents the marker from being repaired. For example, a stale write-only marker (mode 0200) makes the comparison raise PermissionError, so the outer handler returns even when the package directory permits atomic replacement. Treat a failed comparison as a cache miss and still attempt _replace_marker.
A failed comparison (for example a write-only marker) is a miss, so the
best-effort atomic write still runs, as before this change.
Co-authored-by: Copilot App <[email protected]>
…nstall
A full eligible install records every input it observes (files read and
their SHA-256, directories listed, paths probed, realpath answers, env vars
read). When that run was itself a no-op (no writes, no network or subprocess
outside org-policy discovery, no prompt, clean exit 0, one No changes
summary) the inputs are stamped in the cache root. A later run whose
recorded inputs are all identical, whose LIVE org policy routes to the same
fingerprint and whose deployed files match the lockfile content hashes
replays the recorded output and writes nothing; anything else runs the full
pipeline. Off by default: APM_INSTALL_FAST_PATH=1 opts in (#4770 re-scope).
Rebased on #4794 (cache-pin markers no longer rewritten on a no-op).
Squash of the reviewed L5 history (backup ref l5-backup-6b1395d).
apm-spec-waiver: the opt-in no-op replay reproduces the full pipeline's observable install output and state; no OpenAPM requirement changes
Co-authored-by: Copilot App <[email protected]>
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
The new cache-pin tests perform real filesystem I/O but are marked as unit tests, violating the no-filesystem unit-test definition and placing them in the wrong test selections.
No open issues 🎉
1 previously missed issue
In code that hasn't changed since last review
Classify filesystem marker tests as component, not unit
Please classify this module as component: every test exercises real filesystem I/O through tmp_path and write_marker, including metadata, symlinks and permissions. pyproject.toml:217-218 defines unit as having no filesystem access, and the existing marker tests use component in tests/integration/test_cache_pin.py:37-40. Using unit incorrectly includes these tests in pure-logic selections and excludes them from component selections.
…nstall
A full eligible install records every input it observes (files read and
their SHA-256, directories listed, paths probed, realpath answers, env vars
read). When that run was itself a no-op (no writes, no network or subprocess
outside org-policy discovery, no prompt, clean exit 0, one No changes
summary) the inputs are stamped in the cache root. A later run whose
recorded inputs are all identical, whose LIVE org policy routes to the same
fingerprint and whose deployed files match the lockfile content hashes
replays the recorded output and writes nothing; anything else runs the full
pipeline. Off by default: APM_INSTALL_FAST_PATH=1 opts in (#4770 re-scope).
Rebased on #4794 (cache-pin markers no longer rewritten on a no-op).
Squash of the reviewed L5 history (backup ref l5-backup-6b1395d).
apm-spec-waiver: the opt-in no-op replay reproduces the full pipeline's observable install output and state; no OpenAPM requirement changes
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
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
install/cache_pin.py::write_markerrewrote everyapm_modules/<pkg>/.apm-pincache-pin marker on every install, with identical bytes. So noapm installwas ever write-free: a tree-10 no-op made 10 marker rewrites. This blocks a strict no-op fast path (#4775), which may replay only a run that wrote nothing, and it adds needless writes to every warm install.Changes to the marker write (the only writer of
.apm-pin):os.replaceover the old entry. An existing link or other non-regular entry is replaced, never written through. A directory in the way is left alone, the temp file is removed, and install continues as before (silent, surfaced by the drift-replay verify step).Effect: marker rewrites per tree-10 no-op go from 10 to 0. Found by the #4775 recorder (ABAB#3 at 7161255:
not recorded ['write:.../apm_modules/perf-org/pkg-000/.apm-pin', ...]).Issue and approved scope
Issue: Fixes #4790
Human scope-approval comment: #4790 (accepted, 0.38.0 bug; VP ruling 19:41).
Does this PR complete the issue, or what remains? Completes it.
Type of change
Testing
tests/unit/install/test_cache_pin_idempotent.py:Changelog
changelog.d/4794.fixed.mdSpec conformance (OpenAPM v0.1)