Repository navigation
fix(git): pin core.eol=lf so text=auto package hashes match across platforms - #3599
Daniel Meppiel (danielmeppiel) merged 25 commits into
Conversation
…atforms Under .gitattributes text / text=auto, Git writes the line ending that core.eol selects. Its default (native) is CRLF on Windows, and the #2971 core.autocrlf=false pin does not override it, so a package committed with LF was materialized with CRLF on Windows, recorded a different content_hash and failed `apm install --frozen` across platforms. - utils/git_env owns the line-ending pins (core.autocrlf=false and core.eol=lf) as -c args and in the network config snapshot, which replaces host autocrlf/eol entries like the core.symlinks pin. - GitCache, shared-bare materialization and the uncached fallback clone/checkout carry the pins; cache shards record them and older shards without core.eol are rematerialized on hit. - Explicit eol=lf/eol=crlf attributes, binary paths and committed CRLF blobs keep their repository-defined bytes. - Real-git component tests and installed-CLI lifecycle tests run in the windows_compat lane; docs describe the guarantee and the reviewed `apm install --update` recovery for locks with pre-fix CRLF hashes. Fixes #3270 apm-spec-waiver: remote package content_hash is reserved for OpenAPM v0.2; this fixes platform materialization only Co-authored-by: Copilot App <[email protected]>
apm-spec-waiver: remote package content_hash is reserved for OpenAPM v0.2; this fixes platform materialization only Co-authored-by: Copilot App <[email protected]>
There was a problem hiding this comment.
🟡 Changes recommended
The documentation promises a same-pin hash refresh from apm install --update, but the command can reuse the old installation or re-resolve mutable refs, so it should instead reference the recovery steps.
1 open issue
What changed in this PR
This PR addresses #3270 by extending APM's Git checkout policy with core.eol=lf, preventing host-selected line endings from changing dependency hashes across platforms without altering raw-byte hashing.
Changes:
- Centralizes line-ending pins and applies them to cached, shared-bare, fallback, and snapshot-based Git operations.
- Records the pins in cache checkouts and rematerializes older entries that lack them.
- Adds cross-platform regression coverage, architecture checks, and recovery documentation.
| File | Description |
|---|---|
tests/unit/cache/test_proxy_compat.py |
Updates cache-hit fixtures with the EOL pin. |
tests/unit/cache/test_git_text_eol_pin.py |
Tests checkout bytes, host overrides, and legacy-cache repair. |
tests/unit/cache/test_git_env.py |
Verifies both line-ending pins precede clone and checkout. |
tests/unit/cache/test_git_cache.py |
Updates valid-cache fixtures for the new pin requirement. |
tests/unit/cache/test_git_cache_symlinks.py |
Checks that cache entries require all materialization pins. |
tests/unit/cache/test_git_cache_recency.py |
Updates the sparse-validation cache fixture. |
tests/unit/cache/test_git_cache_hardening.py |
Updates the logging test's cache fixture. |
tests/unit/cache/test_git_cache_autocrlf.py |
Uses the consolidated materialization-pin validator. |
tests/integration/test_git_text_eol_lifecycle.py |
Adds CLI coverage for cross-host replay, cache repair, and recovery. |
tests/integration/test_git_cache_hermetic.py |
Updates cache fixtures and expected config-write counts. |
src/apm_cli/utils/git_env.py |
Owns canonical line-ending pins and applies them to Git environments. |
src/apm_cli/deps/bare_cache.py |
Applies and persists line-ending pins for shared-bare checkouts. |
src/apm_cli/cache/git_cache.py |
Applies pins and requires them when reusing cache entries. |
scripts/architecture_linter/checks/transport_auth_platform.py |
Guards centralized ownership of line-ending configuration. |
packages/apm-guide/.apm/skills/apm-usage/dependencies.md |
Documents checkout line endings and legacy-hash recovery. |
docs/src/content/docs/troubleshooting/common-errors.md |
Explains EOL-related hash mismatches and cache repair. |
docs/src/content/docs/reference/lockfile-spec.md |
Updates the materialized-byte contract for content_hash. |
docs/src/content/docs/consumer/install-packages.md |
Describes cross-platform behavior and links recovery guidance. |
CHANGELOG.md |
Records the portability fix and recovery caveat. |
.apm/architecture/owners/transport-auth-platform.json |
Registers line-ending pins under the existing Git environment owner. |
Review effort: Balanced
…0-windows-text-auto-hash
Co-authored-by: Copilot App <[email protected]>
APM Review Panel:
|
| Persona | B | R | N | Takeaway |
|---|---|---|---|---|
| Python Architect | 0 | 1 | 1 | Canonical single-owner discipline is well applied; one forbid-scan gap for core.autocrlf leaves the guardrail incomplete. |
| Test Coverage Expert | 0 | 1 | 0 | Determinism fix is exhaustively regression-trapped; the new core.eol forbid scan and pin needles have no mutation-test teeth. |
| Performance Expert | 0 | 2 | 1 | Correctness sound; one extra git-config spawn per bare consumer and a one-time full-shard rematerialization on upgrade. |
| Supply Chain Security Expert | 0 | 1 | 1 | Integrity model sound; recovery wording could lead users to advance mutable refs without review. |
| Doc Writer | 0 | 1 | 1 | Two pages overclaim what apm install --update fixes; the pin mechanism is restated in three places. |
| Auth Expert | 0 | 0 | 0 | Auth-neutral: pinned_keys filters only core.* keys; auth fence, helper suppression and #2999 TLS entries unchanged. |
B = blocking-severity findings, R = recommended, N = nits.
Counts are signal strength, not gates. The maintainer ships.
Top 5 follow-ups
- [Doc Writer + Supply Chain Security Expert] Fix
--updaterecovery wording independencies.mdand the CHANGELOG to point at thecommon-errors.mdrecovery steps instead of implying a plain--updatere-records the hash at the same pin. -- Three-source convergence;integrate.pyskips re-download when the installed HEAD matches the locked SHA. - [Test Coverage Expert] Add architecture-rule mutation tests proving the
core.eolforbid scan and thegit_cache/bare_cacheline-ending needles fire. -- Without them a refactor could silently drop the guardrail. - [Performance Expert] Persist pins in
materialize_from_bareviagit clone --configinstead of extragit configspawns; add elapsed-ms to the rematerialize log and note the first post-upgrade cost in docs. -- Non-amortized per-consumer path; one-time migration cost deserves visibility. - [Python Architect] Add a one-line comment in
bare_cache.pyexplaining why only some pins are persisted there. -- Prevents a future contributor from "fixing" an intentional asymmetry. - [Python Architect + Supply Chain Security Expert] Post-merge: track a
core.autocrlfforbid scan andcodex_plugins/snapshot.pyowner rerouting under Codex native transport scope. -- Completes the guardrail but changes Codex transport semantics, outside [BUG] Packagecontent_hashdiffers on Windows when the dependency repository setstext=autoin.gitattributes#3270.
Architecture
classDiagram
direction LR
class git_env {
<<CanonicalOwner>>
+git_line_ending_pin_entries() tuple
+git_line_ending_pin_args() tuple
+git_symlink_pin_entry() tuple
+git_symlink_pin_args() tuple
+_materialize_git_config_snapshot()
+clone_git_worktree()
+checkout_git_worktree()
}
class git_cache_module {
<<Module>>
+_safe_git_args() list
+_checkout_materialization_pins() tuple
+_checkout_has_materialization_pins() bool
}
class bare_cache_module {
<<Module>>
+materialize_from_bare()
}
class transport_auth_platform {
<<StaticGuard>>
+_check_git_child_environment()
}
git_cache_module ..> git_env : delegates pins
bare_cache_module ..> git_env : delegates pins
transport_auth_platform ..> git_env : forbid scan exempt
transport_auth_platform ..> git_cache_module : needle check
transport_auth_platform ..> bare_cache_module : needle check
class git_env:::touched
class git_cache_module:::touched
class bare_cache_module:::touched
class transport_auth_platform:::touched
classDef touched fill:#fff3b0,stroke:#d47600
flowchart TD
A["apm install / apm lock"] --> B{"Materialization path"}
B -->|cached| C["GitCache.get_checkout"]
B -->|bare| D["materialize_from_bare"]
B -->|uncached fallback| E["clone_git_worktree"]
C --> F{"shard records all pins?"}
F -->|yes| G["reuse shard"]
F -->|"no: missing eol=lf or symlinks"| H["rematerialize under shard lock"]
H --> I["clone + checkout with -c pins"]
D --> L["clone --no-checkout, persist pins, checkout with -c pins"]
E --> O["clone + checkout with -c pins"]
C -->|snapshot children| Q["_materialize_git_config_snapshot drops host autocrlf/eol/symlinks, appends pins"]
Recommendation
The core determinism fix is sound and the panel is unanimous. The merge worker's fold plan covers every in-scope finding; verify the dependencies.md / CHANGELOG --update wording fix (highest signal) and the architecture mutation tests land before shipping. The deferred core.autocrlf forbid scan plus Codex snapshot rerouting should be tracked in a follow-up issue and does not need to hold this PR.
Full per-persona findings
Python Architect
- [recommended] Missing
core.autocrlfforbid scan leaves the line-ending dual guardrail incomplete atscripts/architecture_linter/checks/transport_auth_platform.py
A literalcore.autocrlf=falseexists atcodex_plugins/snapshot.py:62, outside the canonical owner. Merge worker: deferred (Codex native transport, outside [BUG] Packagecontent_hashdiffers on Windows when the dependency repository setstext=autoin.gitattributes#3270 scope). - [nit]
bare_cache.pypersists only the line-ending pins; add a one-line comment for the intentional asymmetry atsrc/apm_cli/deps/bare_cache.py:678
Test Coverage Expert
- [recommended] New
core.eolforbid scan andgit_line_ending_pin_*needle checks have no mutation case proving they fire attests/integration/test_architecture_owner_rule_mutations.py
Proof (missing):tests/integration/test_architecture_owner_rule_mutations.py-- proves: a future PR cannot bypass or regress thecore.eol=lfpin without a test failing.
Performance Expert
- [recommended]
materialize_from_barespawns twogit configsubprocesses per consumer instead of one, on a non-amortized path atsrc/apm_cli/deps/bare_cache.py:679 - [recommended] The stricter pin check rematerializes every pre-existing GitCache shard on first touch after upgrade; the cost is unobservable at
src/apm_cli/cache/git_cache.py:136 - [nit] No spawn-count assertion for the config phase of
materialize_from_bare
Supply Chain Security Expert
- [recommended]
dependencies.mdrecovery guidance ("re-records the hash at the same pin") can mislead users into silently advancing mutable refs atpackages/apm-guide/.apm/skills/apm-usage/dependencies.md:97 - [nit] No
core.autocrlfforbid scan (same as architect)
Doc Writer
- [recommended]
dependencies.mdand CHANGELOG claimapm install --updatere-records the hash at the same pin; the code only does that when the installed copy is gone atpackages/apm-guide/.apm/skills/apm-usage/dependencies.md:96 - [nit] The pin mechanism is restated near-verbatim in
install-packages.md,lockfile-spec.mdanddependencies.mdatdocs/src/content/docs/consumer/install-packages.md:250
Auth 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-review-worker. This comment is AI-generated and may contain errors.
A plain `apm install --update` does not re-record a stale CRLF hash when the installed copy still matches the locked SHA (install/phases/integrate.py skips the re-download), and it re-resolves mutable refs. The packaged usage guide and the CHANGELOG promised a same-pin in-place refresh; both now point at the `Content hash mismatch` recovery steps, which require a fresh consumer or removal of the installed copy and review of the SHA and hash diff. install-packages.md links the lockfile content_hash definition instead of restating it, and notes that older cached checkouts are re-created on their next use. Addresses Copilot inline on packages/apm-guide/.apm/skills/apm-usage/ dependencies.md:97 and panel follow-ups (doc-writer, supply-chain, performance). Co-authored-by: Copilot App <[email protected]>
materialize_from_bare runs once per consumer and is not amortized across installs. Writing the two line-ending pins with one `git config` spawn each added a process per dependency on every install (Windows pays the most per spawn). `git clone --config` records the same values in the new repository's config with no extra process; the checkout still carries the `-c` pins that outrank env snapshots. A comment notes why the symlink pin travels only as `-c` there. The rematerialization of a cache shard that lacks the pins now logs its elapsed time, so the one-time cost after upgrading is observable. The bare regression test asserts the consumer config records both pins; mutation-break: dropping the `--config` args fails it. Addresses panel follow-ups (performance-expert, python-architect). Co-authored-by: Copilot App <[email protected]>
The PR extends transport-platform-git-child-environment with needles for git_line_ending_pin_* in git_env.py, git_cache.py and bare_cache.py and a forbid scan for core.eol literals outside git_env.py, but no test proved those checks fire. Three source-override mutations now do: a core.eol literal in bare_cache.py, git_cache.py bypassing git_line_ending_pin_args, and the config snapshot no longer appending the line-ending pins. Each must report a violation with the matching message. Mutation-break: restoring the pre-PR linter check makes all three fail. Addresses panel follow-up (test-coverage-expert). Co-authored-by: Copilot App <[email protected]>
A mocked materialize_from_bare must carry the line-ending pins as clone --config arguments and spawn no separate `git config core.*` process, so a later change that reintroduces per-key spawns on this non-amortized path is a reviewed decision. Mutation-break: the previous per-key loop fails it. Addresses panel follow-up (performance-expert nit). Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot App <[email protected]>
Resolves conflicts with #3603 (links materialized from Git objects) by keeping both intents: core.symlinks=false plus the apm.linkMaterialization marker from #3603, and the core.autocrlf=false + core.eol=lf line-ending pins from #3270. Cache shards now require all four entries; the snapshot materializer replaces host symlink and line-ending entries; the git-child-environment needles cover both the link materializer and the line-ending owner. Co-authored-by: Copilot App <[email protected]>
#3603 resolves a tracked link whose target a sparse cone left out with `git cat-file --filters`, which applies checkout conversion. Callers such as the downloader's sparse fallback and git_file_transport pass no `-c` pins, so under a host `core.eol=crlf` (or the Windows native default) a link to a `text=auto` file was written with CRLF and its content_hash diverged across platforms, the #3270 failure on a new materialization path. The resolver now appends git_line_ending_pin_args to its own Git calls, so every caller gets the committed LF bytes. Regression: test_link_target_outside_sparse_cone_ignores_host_eol (global and env-count host core.eol=crlf; host-default control). Mutation-break: without the pin both crlf cases fail. Co-authored-by: Copilot App <[email protected]>
After #3603 the shard checkout runs materialize_tracked_symlinks, which parses bytes; TestCreateCheckout's text-mode subprocess mocks fed it str and three cases failed on main as well, alongside a stale config-call count. The class fixture now stubs the resolver (covered by real-git tests) and the counts derive from _checkout_materialization_pins, so the line-ending and link pins are both accounted for. The bare spawn test returns bytes when the caller did not ask for text. Co-authored-by: Copilot App <[email protected]>
#3603's sparse-symlink rule required _LINK_MATERIALIZATION_PIN three times in git_cache.py (definition, persisted pins, cache-hit check). With the #3270 line-ending pins both the persisted list and the cache-hit check route through the single _checkout_materialization_pins(), so the marker now appears in its definition and that list, and the rule also requires the helper at its definition, persistence and validation sites. Dropping the marker from the list still reports a violation. Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot App <[email protected]>
GitCache wrote each materialization pin with its own `git config` spawn after cloning a shard; with the line-ending and link pins that became four extra processes per new or rematerialized shard. The pins now ride on the existing clone as `-c key=value`, which git clone records in the new repository, as bare_cache already does. The checkout keeps the `-c` pins from _safe_git_args. Hermetic call counts drop to clone plus checkout. Mutation-break: dropping the pins from the clone fails test_cached_checkout_ignores_host_eol (shard no longer recognized). Addresses delta-panel follow-up (performance-expert). Co-authored-by: Copilot App <[email protected]>
The sparse-symlink rule now requires git_cache.py to route persisted and required pins through _checkout_materialization_pins(). A fourth source-override case inlines the pin tuple at the persistence site and expects the rule to report it. Mutation-break: main's count-only rule misses it. Addresses delta-panel follow-up (test-coverage-expert). Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot App <[email protected]>
APM Review Panel:
|
| Persona | B | R | N | Takeaway |
|---|---|---|---|---|
| Python Architect | 0 | 0 | 0 | Delta strengthens the canonical owner; clone -c persists pins after init probes; cache-hit validation sound. |
| Test Coverage Expert | 0 | 0 | 0 | Shard-pin persistence covered by a real-git test; the new architecture case closes the sparse-rule gap (round-1 item folded). |
| Supply Chain Security Expert | 0 | 0 | 0 | Delta closes a real integrity gap (host core.eol leak on out-of-cone link targets); pin persistence on clone is trust-equivalent. |
| Performance Expert | 0 | 0 | 0 | Prior findings resolved: pins ride on the single clone for both bare consumers and cache shards. |
| Doc Writer | 0 | 0 | 0 | Recovery wording, merged symlink and line-ending bullets, and the CHANGELOG entry are accurate and consistent. |
| Auth Expert | 0 | 0 | 0 | Merged git_env.py and the git_sparse pin are auth-neutral; no credential, header or TLS change. |
B = blocking-severity findings, R = recommended, N = nits.
Counts are signal strength, not gates. The maintainer ships.
Top 1 follow-ups
- [Python Architect] Add a
core.autocrlfforbid scan parallel to thecore.eolscan and routecodex_plugins/snapshot.pythrough the canonical line-ending owner. -- Completes the guardrail; kept out of this PR because the Codex snapshot is Codex native transport (hash-object --no-filters), outside [BUG] Packagecontent_hashdiffers on Windows when the dependency repository setstext=autoin.gitattributes#3270 scope.
Recommendation
Every in-scope finding from the original and delta panels has been folded and verified by the returning panelists. The cross-PR link-resolver fix closes an integrity gap that would otherwise have shipped with #3603. Track the core.autocrlf forbid scan plus Codex snapshot rerouting as a separate issue.
Folded in this run
- (copilot)
dependencies.mdpromised a same-pin in-place--updaterefresh -- resolved in 0b1a634. - (panel) CHANGELOG and docs recovery wording, first post-upgrade rematerialization note -- resolved in 0b1a634.
- (panel) Bare consumer pins via
clone --config, symlink-pin comment, rematerialization elapsed-ms log -- resolved in a62d5d7. - (panel) Architecture tests proving the line-ending needles and
core.eolforbid scan fire -- resolved in b89e649. - (panel) Spawn trap for the bare consumer path -- resolved in a97326f.
- (panel) Link resolver applies the line-ending pins to
cat-file --filters(cross-PR with fix(git): materialize package links from Git objects on every host #3603) -- resolved in a92f0ca. - (panel) Hermetic checkout mocks kept off the link resolver (also failing on main) -- resolved in 589bb90.
- (panel) Sparse-symlink rule counts the marker through the shared pin list -- resolved in ed3747c.
- (panel) Shard pins ride on the clone instead of config spawns -- resolved in 9c997dd.
- (panel) Architecture case for the shard pin-list count guard -- resolved in 80183ed.
Copilot signals reviewed
packages/apm-guide/.apm/skills/apm-usage/dependencies.md:97-- LEGIT:--updatecan reuse a matching installed copy and re-resolve mutable refs, so the same-pin promise was inaccurate (resolved in 0b1a634).
Deferred (out-of-scope follow-ups)
- (panel)
core.autocrlfforbid scan andcodex_plugins/snapshot.pyowner rerouting -- scope boundary: Codex native transport snapshot built from admitted bytes, not upstream dependency materialization ([BUG] Packagecontent_hashdiffers on Windows when the dependency repository setstext=autoin.gitattributes#3270 excludes unrelated transport changes); suggested follow-up: separate hardening issue.
Regression-trap evidence (mutation-break gate)
test_bare_materialization_ignores_host_eol-- deleted the--configpins from the bare clone; test FAILED as expected; guard restored.test_bare_materialization_pins_line_endings_without_extra_spawns-- restored the per-keygit configloop; test FAILED as expected; guard restored.test_line_ending_pin_guard_rejects_owner_bypass-- restored the pre-PR linter check / main's sparse rule; cases FAILED as expected; guard restored.test_link_target_outside_sparse_cone_ignores_host_eol-- removed the resolver's line-ending pin; crlf cases FAILED as expected; guard restored.test_cached_checkout_ignores_host_eol-- removed the pins from the shard clone; test FAILED as expected; guard restored.test_bare_materialization_ignores_host_eol[full-system]-- removedcore.eol=lffrom the owner; test FAILED as expected; guard restored.
Lint contract
The full CI lint mirror (ruff check, ruff format --check, YAML I/O, file length, relpath, pylint R0801, lint-auth-signals, lint-architecture-boundaries) exits 0 on the merged head.
Full per-persona findings
Python Architect
No findings.
Test Coverage Expert
No findings (round 1 item on the sparse-rule count mutation test folded in 80183ed).
Supply Chain Security Expert
No findings.
Performance Expert
No findings (round 1 item on shard config spawns folded in 9c997dd).
Doc Writer
No findings.
Auth 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-review-worker. This comment is AI-generated and may contain errors.
…auto-hash Co-authored-by: Copilot App <[email protected]>
Avoids landing-order conflicts with other queued PRs. Co-authored-by: Copilot App <[email protected]>
Lane L: main merged for landing
This comment was generated by an AI agent (Lane L landing desk) on behalf of Daniel Meppiel (@danielmeppiel). |
Resolve tests/integration/test_architecture_owner_rule_mutations.py by keeping main's orphan-selection mutation tests (#2926) and this PR's line-ending pin guard test (#3270). Co-authored-by: Copilot App <[email protected]>
Resolve conflicts with the link-text checkout rewrite (#3599/#3602) in git_cache.py, bare_cache.py, git_env.py and git_sparse.py by taking main's version and re-applying this PR's mechanical text=True -> run_git_text rewrite to the remaining Git text-mode calls. main's new bytes-mode ls-tree/cat-file path in git_sparse stays as is. The sparse regression test now drives main's public apply_sparse_cone, sparse_checkout_active and materialize_tracked_symlinks instead of the removed _tracked_symlinks helper. Co-authored-by: Copilot App <[email protected]>
Resolve docs/src/content/docs/reference/lockfile-spec.md content_hash row: keep this PR's core.autocrlf/core.eol pin wording (#3270) and main's carried_licenses exclusion (#3646). Co-authored-by: Copilot App <[email protected]>
…auto-hash Co-authored-by: Copilot App <[email protected]>
Avoids landing-order conflicts with other queued PRs. Co-authored-by: Copilot App <[email protected]>
Lane L: main merged for landing
This comment was generated by an AI agent (Lane L landing desk) on behalf of Daniel Meppiel (@danielmeppiel). |
Clean merge of #3599, #3647, #3650, #2933; no lockfile or autopilot package conflicts. Co-authored-by: sergio-sisternes-epam <[email protected]> Co-authored-by: Copilot App <[email protected]>
Resolve git_cache.py, bare_cache.py and git_sparse.py by taking main's line-ending pin rewrite (#3599) and re-applying this PR's mechanical text=True -> run_git_text rewrite plus the SubprocessError cleanup and probe handlers, so GitOutputDecodeError still removes staged trees and counts as an incomplete sparse probe. Co-authored-by: Copilot App <[email protected]>
…3673) * fix(git): check out out-of-cone link targets with Git's own checkout A link whose target a sparse checkout left out was read with `git --attr-source=HEAD cat-file --filters`, falling back to plain `cat-file --filters` when that call failed. cat-file reads no index, so in a sparse checkout the fallback silently skipped the target's .gitattributes and wrote e.g. an eol=crlf file with LF. That is the post-merge red on macOS x86_64 since 90e76bf: the path: transport link to shared/notes.crlf returned LF while the checked-out target was CRLF. Out-of-worktree targets are now written by `checkout-index` into a throwaway work tree from a throwaway full index (`read-tree HEAD`), in one batch per materialization. Attributes come from that index exactly as `git checkout` reads them, on every Git version, with no version-gated option and no silent fallback. In-worktree targets still read the bytes Git already wrote. The line-ending pins (#3599) still apply; the content_hash domain is unchanged. Regression: test_out_of_sparse_eol_target_keeps_checkout_bytes_without_attr_source emulates a Git that rejects --attr-source; it fails on main with the CI assertion and passes here. Also re-points two #3603 downloader tests at the persistent-checkout seam that #3640 changed underneath them. Refs #3457 apm-spec-waiver: Git checkout byte fidelity for link targets; no OpenAPM statement or hash-domain change. Co-authored-by: Copilot App <[email protected]> * docs(changelog): reference #3673 on the link materialization entry Co-authored-by: Copilot App <[email protected]> * fix(links): report an unwritten out-of-cone target with the diagnostic A target that checkout-index leaves unwritten raised a bare FileNotFoundError; it now raises the 'did not check out ... as a regular file' diagnostic before any link is written. Panel follow-up (test-coverage-expert). Co-authored-by: Copilot App <[email protected]> * fix(links): rebuild shards from the cat-file materializer; honor APM_TEMP_DIR Review follow-ups (Copilot): - The shard marker is versioned to apm.linkMaterialization=git-objects-checkout. A sparse shard pinned by the first Git-object materializer could hold an out-of-cone eol=crlf target with LF and would otherwise be served as is; it is now rematerialized on its next cache hit. Regression: test_cache_hit_rematerializes_shard_without_link_materialization[pre-checkout-marker] (fails if the marker value is reverted). - The throwaway checkout scratch directory uses get_apm_temp_dir(), like the downloader's own scratch space, so APM_TEMP_DIR / temp_dir keep working on hosts with a restricted system temp directory. Co-authored-by: Copilot App <[email protected]> * chore: restore uv.lock swept in by a local uv rewrite Co-authored-by: Copilot App <[email protected]> --------- Co-authored-by: danielmeppiel <[email protected]> Co-authored-by: Copilot App <[email protected]>
apm 0.36.0 checks packages out with LF (microsoft/apm#3599), so the TUnit skill's content hash, recorded by apm 0.35.1 over a CRLF checkout on Windows, no longer matched and apm install failed. Upstream is unchanged (v1.85.0 at 399f07cf, same SKILL.md blob). apm install --update records the LF hash and now also deploys the skill's upstream MIT LICENSE. apm writes the skill with LF, so the .gitattributes exceptions that kept its copies at the platform's line endings are removed. Co-Authored-By: Claude Opus 5.5 <[email protected]>

TL;DR
A dependency whose
.gitattributesusestext/text=autowas checked out with CRLF on Windows (Git'score.eoldefaults tonative) and LF elsewhere, socontent_hashdiffered andapm install --frozenfailed across platforms. APM now pinscore.eol=lfnext to the existingcore.autocrlf=falsepin on every dependency materialization path, persists it in cache shards, and rematerializes older shards. Expliciteol=attributes, binary files, and committed CRLF blobs keep their repository-defined bytes.Fixes #3270
Note
Builds on #3409 (autocrlf on the uncached fallback) and #3545 (
core.symlinkspin), both merged. It follows the same owner pattern as #3545:utils/git_envowns the pin, and cache shards record it. Coordination note for Sheila Shahpari (@sheilagithub), who offered this follow-up on #2971: #3270 (comment)Problem (WHY)
* text=auto, Git writes LF-committed text using the line endingcore.eolselects.core.eoldefaults tonative, which is CRLF on Windows. APM hides user and system config from some dependency children, so Windows gets CRLF even when the user never set anything.content_hashrecords CRLF bytes on Windows when the system gitconfig setscore.autocrlf=true; lockfile is not portable to Linux #2971 pin (-c core.autocrlf=false) does not overridecore.eol._safe_git_argsdocumented this gap: "This pin does not overridecore.eolor.gitattributeseol=crlf/text=autorequests."mainatcbd9f2b11:GitCache.get_checkoutunder hostcore.eol=crlfwrote CRLFSKILL.mdfor both full and sparse checkouts, andcompute_package_hashdiverged from the committed bytes.Content hash mismatch for apm-fixture-org/eol-skills/pkg ... re-downloading/Install failed.Why these matter:
compute_package_hashhashes raw bytes and its docstring relies on "identical bytes at a pinned commit on every OS" (src/apm_cli/utils/content_hash.py). The accepted scope puts the repair in Git materialization, not in hashing (scope record).Approach (WHAT)
utils/git_envgainsgit_line_ending_pin_entries()/git_line_ending_pin_args()(core.autocrlf=false,core.eol=lf), replacinggit_autocrlf_pin_args().-cpins: GitCache clone, checkout and sparse operations (_safe_git_args), shared-barematerialize_from_bare, and the uncached fallbackclone_git_worktree/checkout_git_worktree._materialize_git_config_snapshot) replaces hostcore.autocrlf/core.eolentries with the pins, the same way #3545 handlescore.symlinks. This covers the snapshot-only children: the downloader's sparse fallback andgit_file_transport._checkout_has_materialization_pinsrejects shards withouteol = lfand rematerializes them in place under the existing shard lock.git_cache.py/bare_cache.pymust route through the line-ending owner, andcore.eolliterals are forbidden outsidegit_env.py.Implementation (HOW)
src/apm_cli/utils/git_env.py-- new line-ending pin owner; snapshot materializer drops hostcore.symlinks/core.autocrlf/core.eoland appends the canonical pins; clone and checkout helpers use the combined pin args.src/apm_cli/cache/git_cache.py--_safe_git_argsuses the owner;_checkout_materialization_pins()is the single list both persisted into shards and required on cache hits. The old autocrlf-only marker is folded into_checkout_has_materialization_pins.src/apm_cli/deps/bare_cache.py-- checkout and sparse operations carry the line-ending pins as well as the symlink pin; the consumer config persists both entries.scripts/architecture_linter/checks/transport_auth_platform.py,.apm/architecture/owners/transport-auth-platform.json-- required-substring needles plus acore.eolforbid scan under the existingtransport-platform-git-child-environmentguard (no new guard ID).consumer/install-packages.md,troubleshooting/common-errors.md,reference/lockfile-spec.md, packagedapm-usage/dependencies.md: line-ending guarantee, and recovery of a lock that recorded a pre-fix CRLF hash.Diagrams
Legend: every dependency Git child gets the same line-ending decision from
git_env, either as-carguments or through the env snapshot. Boxed nodes are new in this PR.flowchart LR owner["git_env.git_line_ending_pin_entries<br/>core.autocrlf=false + core.eol=lf"]:::new owner --> args["git_line_ending_pin_args (-c)"]:::new owner --> snap["_materialize_git_config_snapshot<br/>replaces host autocrlf/eol"]:::new args --> gc["GitCache clone / checkout / sparse<br/>(_safe_git_args)"] args --> bare["bare_cache.materialize_from_bare"] args --> fb["clone_git_worktree / checkout_git_worktree<br/>(uncached fallback)"] snap --> sp["downloader sparse fallback<br/>git_file_transport"] gc --> shard["shard .git/config records pins"]:::new shard -->|"hit without eol = lf"| remat["evict + rematerialize"]:::new classDef new stroke-width:3pxTrade-offs
compute_package_hashwould mask real CRLF content changes. The record excludes whole-tree hash normalization.core.eol=lfrather thantext=false/-text.core.eolchanges only the line ending Git itself selects. Expliciteol=crlf, binary paths, and CRLF blobs in the index keep their bytes (covered by controls).--frozenand its bytes are preserved. Recovery is a reviewedapm install --update, which the lifecycle test exercises (sameresolved_commit, corrected hash)._checkout_pins_autocrlf_falseremoved. Its lenient boolean parsing (0/no/off) was unnecessary, because APM itself always writesfalse.Benefits
text=autopackage locked on Windows replays--frozenon Linux/macOS and vice versa (4 lifecycle permutations).content_hashunder system, global,GIT_CONFIG_COUNT, andGIT_CONFIG_PARAMETERShostcore.eol=crlf, and under the Windows native default.apm cache clean.eol=crlf, binary, and committed-CRLF files arrive byte-identical on every host.Validation
Pre-fix (fix reverted in
src/, tests kept)With fix
Scenario evidence
host-default/crlf-env) installs--frozenon a fresh consumer with the oppositecore.eol, cold and warm, for subdirectory and whole-repo packagestests/integration/test_git_text_eol_lifecycle.py::test_locked_text_auto_package_replays_across_host_eol--frozenhonestly, leaves manifest and lock bytes untouched, and a reviewedinstall --updatere-records the intended hash at the same commitfrozen-stale-hash,reviewed-refreshsteps)frozen-legacy-shard)tests/unit/cache/test_git_text_eol_pin.py::test_legacy_shard_without_eol_pin_is_rematerializedcore.eol=crlf; expliciteol=crlf/eol=lf, binary, and committed-CRLF controls are preservedtests/unit/cache/test_git_text_eol_pin.py(cached, bare, fallback, network-env tests)core.eol=nativewindows_compat, so they run in the PR Windows Compatibility Gatewindows-latestNote
Local preflight skipped by maintainer instruction (2026-11-12); CI is the gate. The full preflight run was stopped during phase A (T0 lint and T1 contracts above were green); the full unit suite and lifecycle shards run in CI.
How to test
uv run --extra dev pytest tests/unit/cache/test_git_text_eol_pin.py -qAPM_E2E_TESTS=1 APM_BINARY_PATH=.venv/bin/apm uv run --extra dev pytest tests/integration/test_git_text_eol_lifecycle.py -qsrc/only and re-run both: the cross-host cases fail withContent hash mismatch.windows-latest.Issue and approved scope
Issue: Fixes #3270
Human scope-approval comment: #3270 (comment) (
apm-scope:v1, review contact Daniel Meppiel (@danielmeppiel))Completes the issue. Native Windows evidence comes from the
windows_compatlane on this PR.Type of change
Testing
Spec conformance (OpenAPM v0.1)
content_hashsemantics are unchanged; only platform materialization is fixed (same rationale as the fix(git): pin core.symlinks=true so package hashes match across platforms #3545 waiver).Co-authored-by: Copilot [email protected]