fix(make): prefer existing local artifacts - #197
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Review: prefer local cache before remote in readThroughCache
The core change is small and correct. Swapping readThroughCache.Get to read the local workspace cache first and fall back to remote short-circuits a per-module HTTP round-trip on incremental builds and lets locally built artifacts take precedence for a pinned version+matrix. This is consistent with Put writing only to the local cache. The refactored table-driven test in make_test.go is clear and locks in the ordering plus the per-branch call counts (gets/remoteGets). Nice.
One documentation fix worth making, plus two design notes for the record.
Should fix
- Stale comment contradicts the new read order —
cmd/llar/internal/make.go:208-209. The comment at thereadThroughCacheconstruction site still describes the old remote-first behavior:After this PR,// Reuse published artifacts from the public Kodo store when available, and // fall back to the local workspace cache and source builds otherwise.
Getreads local first (lines 54-60), matching the updated struct doc at lines 46-48 and the new tests. This inline comment now states the ordering backwards and will mislead the next reader. Suggested rewrite:// Reuse artifacts from the local workspace cache when available, and fall // back to published artifacts in the public Kodo store (and source builds) // otherwise.
Design notes (non-blocking — confirm this matches intent)
-
Local-first shadows republished/security-patched remote artifacts. Cache keys are keyed only on path/version/matrix. Once a local
.cache.jsonentry exists for a key, the remote artifact for that same key is never consulted again. If a corrected artifact is ever republished under an identicalversion+matrix, users with a populated workspace cache won't pick it up. If artifacts under a fixed version are considered immutable, this is fine — just confirming it's intended. -
Local hit trusts
installDiras-is without re-materializing or verifying it. On a local hit,localCache.Get(internal/build/cache.go:90-100) returns onlyMetadataand the builder trusts the on-disk install dir. Unlike the remote path, there's no checksum re-verification, and the dir isn't re-unpacked. If the.cache.jsonentry survives but itsinstallDiris deleted/partially removed, the local-first path reports a hit with a stale/empty output instead of falling back to remote. Worth confirming that the metadata entry and itsinstallDirare always written and invalidated together (or validatinginstallDirexistence on a local hit).
Additional findings
cmd/llar/internal/make.go:209: [P2] Stale comment describes old remote-first cache order: This comment still describes the pre-PR remote-first behavior, butreadThroughCache.Getnow reads local first and falls back to remote (matching the updated struct doc at lines 46-48 and the new tests). The ordering is stated backwards. Suggested rewrite:
|
》 LLARD Docker Image / build (pull_request) |
Prefer artifacts already installed in the local LLAR workspace and persist public remote hits for later commands.
The implementation includes:
readThroughCache.Getto return local cache hits before querying the public Kodo cache..cache.jsonentry.Putoperations scoped to the local cache..cache.jsonpersistence, and repeated reads that skip remote access.go test -ldflags="-checklinkname=0" ./cmd/llar/internal ./internal/build/cache ./internal/crosscompile/...; the full local suite previously reported the unrelated macOS zlib v1.2.11 build failure inTestE2E_RealLibpngBuild.This prevents existing artifacts from being overwritten and avoids downloading the same public artifact again on later
llar makeorllar testruns.