Untitled conversation
- User
[BUG] apm install fail second time with Content hash mismatch Describe the bug I can install my repo (see apm.yml further down) via
apm install <org>/<repo>/package/<project>just fine (kinda, see the logs, it looks wonky but maybe it's just a new feature) but the second time I runapm installit will fail consistently withContent hash mismatch.To Reproduce Steps to reproduce the behavior:
- apm install <repo>
- apm install
Expected behavior A clear and concise description of what you expected to happen.
Environment (please complete the following information):
- OS: Windows
- APM Version: 0.16.0
Logs
powershell - Assistant
I’ll trace how remote file content is hashed and cached across the first and second install. Because this touches integrity verification and dependency caching, I’m applying the supply-chain security guidance before editing, then I’ll add a regression test and run the focused suite.
- Assistant
The security guidance requires integrity checks to remain fail-closed, so the fix will normalize what is recorded or retrieved—not weaken the mismatch check. I’m now locating the lockfile hash writer and the cached-file verification path.
- Assistant
The mismatch path is preserving the security failure correctly. The strongest local clue is that APM adds its own
.apm-pincache metadata after recording the package hash; if that metadata participates in the next hash, identical upstream content appears tampered with. The hasher already contains an exclusion for that marker, so I’m checking whether the marker can be nested for virtual single-file packages and whether the current tests actually cover this Azure-style reinstall. - Assistant
I found the ADO-specific break: a virtual file download learns no commit identity, and the install source then discards the commit carried by the downloaded package whenever pre-resolution was unavailable. That leaves the lock entry unpinned, forces a fresh download on run two, and compares mutable branch content against the prior hash. I’m fixing both halves: resolve ADO virtual files through the existing git resolver, and always persist the downloaded package’s resolved commit.
- Assistant
The code and regression tests are in place. The first test invocation used the system Python and could not import the project package, so I’m switching to the repository’s configured test environment and will address any real failures there.
- Assistant
The focused tests now pass (51/51), including ADO resolution failure fallback and lockfile commit persistence. I’m running the broader downloader/install regression groups next, then I’ll inspect the final diff for unintended behavior.
- Assistant
The broader regression run passes all 1,704 tests. It also exposed a test-side mutation of the repository’s own
apm.lock.yaml; that file was clean before testing and is unrelated to the fix, so I’m restoring only that generated change before final validation.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.