fix(sandbox): read the golden's own mtime for TTL pruning, not its lockDir's - #5883
Merged
Conversation
pedrofrxncx
enabled auto-merge (squash)
August 11, 2026 14:39
pedrofrxncx
force-pushed
the
fix/golden-cache-prune-mtime-w2
branch
from
August 11, 2026 14:40
d6a9a25 to
96144dc
Compare
decocms Bot
pushed a commit
that referenced
this pull request
Aug 11, 2026
PR: #5883 fix(sandbox): read the golden's own mtime for TTL pruning, not its lockDir's Bump type: patch - @decocms/sandbox (packages/sandbox/package.json): 1.49.1 -> 1.49.2 - deploy/helm/sandbox-env (chart 0.14.4) (deploy/helm/sandbox-env/values.yaml deploy/helm/sandbox-env/Chart.yaml): image.tag/appVersion -> 1.49.2 Deploy-Scope: both
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.
Follows #5824/#5843 (the L1/L2 golden-tier rework merged today) — a bug in the L1 pruning code, not a follow-up feature.
Bug:
pruneGoldens(packages/sandbox/daemon-go/internal/setup/golden.go) computes each entry's mtime from the lockDir itself (golden/<repo>/<pm>-<lockHash>), butTryRestoreGoldenmarks a golden as recently-used by callingos.Chtimeson.../node_modules— the child directory, not the lockDir. Updating a child's mtime viautimesnever touches its parent directory's own mtime, so the lockDir's mtime is set once at publish time (via the rename inPublishGolden) and never again. The code comment even claims the opposite ("Restore touches a golden's mtime, so an actively-used lockfile never ages out" — golden.go:22), but it touches the wrong path for that claim to hold.Failure scenario: any lockfile whose golden was published more than
GoldenTTL(7 days) ago keeps getting restored-from every day, but the periodic prune sweep still reaps it once past the TTL, because the mtime it reads never moved. Every subsequent boot for that lockfile silently falls back to a full install — the exact perf regression the golden cache exists to prevent — with no error or signal, since restore itself doesn't check TTL, only the sweep does.Fix:
pruneGoldensnow stats<lockDir>/node_modules(the same pathTryRestoreGoldentouches) instead of the lockDir. UpdatedTestPruneGoldens'smkGoldenhelper to build the real nested layout, and added a regression case (a restore touching only node_modules' mtime still protects the golden) that fails against the old code (verified locally by reverting golden.go and re-running: 3 of 6 subtests failed, including the new one) and passes with the fix.Verify:
cd packages/sandbox/daemon-go && go test ./internal/setup/... -run TestPruneGoldens -vChecked locally:
go test ./internal/setup/...(full package, green),gofmt -l(clean),go vet ./internal/setup/...(clean). Full CI runs the rest.Summary by cubic
Fixes golden cache pruning to read
<lockDir>/node_modulesmtime so active goldens aren’t reaped by TTL. Prevents silent full installs when a golden is still in use.pruneGoldensto stat<lockDir>/node_modules(matchesTryRestoreGolden) instead of the lock directory.Written for commit 96144dc. Summary will update on new commits.