Skip to content

fix(cache): apply the Dylint thin-store skip only when the layer was not restored - #681

Merged
zackees merged 1 commit into
mainfrom
fix/dylint-thin-gate-restored-build-cache
Nov 19, 2026
Merged

zackees merged 1 commit into
mainfrom
fix/dylint-thin-gate-restored-build-cache

Conversation

@zackees

@zackees zackees commented Nov 19, 2026

Copy link
Copy Markdown
Collaborator

Problem

decideCacheSaveGate (src/lib/compile-cache-stats.ts) skipped the build-cache and target-cache saves whenever dylint-output-cache was restored. The rule from 658bcf9 is for the cold-seed case: nothing was restored, so a Dylint-output hit leaves a thin store (~294 MB vs ~1.2 GB) that would win the key and LRU-evict the real entry. When the build/target cache was restored, the store is the restored entry plus this run's compiles. That is a superset, so skipping only throws work away.

FastLED/fbuild run 44501733207 (Dylint Full job 135483075645, setup-soldr v0 = a2c1d42) logged:

build-cache: skipping save — dylint-output-cache was restored, so this run's store is thin (242 new compile(s)); a thin save would evict the real entry

Fix

Skip on dylintOutputRestored only when !input.restored. Otherwise the normal *-save-min-compiles gate decides: real compiles save, zero still skips, and a raised threshold still applies. Both wrappers (decideBuildCacheSave, decideTargetCacheSave) share the gate, so target-cache gets the same treatment with its own input name in the reason text.

Caveat (affects the fbuild symptom)

In that fbuild run the build cache was an exact hit (...-dylint-unified-v2-514fdd037a76e524-s57d57d7814452b77). saveOne returns exact-hit-skip before uploading whatever this gate decides, because cache keys are immutable. So this fix lets a fallback restore (for example the first run after a soldr bump, when the s<soldr> segment changes) seed the new key. It does not re-save an exact-hit entry, and it will not by itself stop recurring misses on an unchanged exact key.

Tests

  • The tests were RED first, then GREEN.
  • New: restored + dylint-output restored with 242 compiles saves; 0 compiles skips with the min-compiles reason; a raised threshold skips.
  • Target-cache gets the same cases, with the target-cache-save-min-compiles reason.
  • The cold-seed thin-store cases are unchanged and still skip.
  • One old assertion that expected restored + dylint-output restored to skip was inverted.
  • Local gate passed (lint, typecheck, tests); dist/ rebuilt; README thin-store rule and CHANGELOG updated.

…not restored

decideCacheSaveGate skipped the build-cache and target-cache saves
whenever dylint-output-cache was restored. The rule exists for the
cold-seed case (658bcf9): with nothing restored, a Dylint-output hit leaves
a thin store that would win the key and LRU-evict the real entry. When the
layer WAS restored, the store is the restored entry plus this run's
compiles, a superset, so skipping only throws away real work. FastLED/fbuild
run 44501733207 dropped 242 new compiles every run that way.

Skip on dylintOutputRestored only when !restored; otherwise fall through to
the normal min-compiles gate (real compiles save, zero still skips).

Local-Gate: v1 tree=5b1b0dadd02266aaa8fb846beee636db025e3942 secs=86 lanes=lint:run,typecheck:run,tests:run
Ci-Attestation: {"at":1795084191,"gate":"general/all/lint","host":"linux-x86_64","key":"cb0893725a96","lane":"lint","parents":["a2c1d423f9c57faf5ebb2e0a3c1c3baf1c24fb0b"],"secs":0,"stamp":"4c626b2fc479477bf0d88c8a95a24f84","tree":"5b1b0dadd02266aaa8fb846beee636db025e3942","v":1,"via":"run"}
Ci-Attestation: {"at":1795084191,"gate":"general/all/typecheck","host":"linux-x86_64","key":"c975705f878f","lane":"typecheck","parents":["a2c1d423f9c57faf5ebb2e0a3c1c3baf1c24fb0b"],"secs":9,"stamp":"3c9adac1df8a0e2afd13e3254ee75dcd","tree":"5b1b0dadd02266aaa8fb846beee636db025e3942","v":1,"via":"run"}
Ci-Attestation: {"at":1795084191,"gate":"general/linux-x86_64/test","host":"linux-x86_64","key":"5af576733f01","lane":"tests","parents":["a2c1d423f9c57faf5ebb2e0a3c1c3baf1c24fb0b"],"secs":75,"stamp":"ecf2eff923b125dc10d5c5192bd350f6","tree":"5b1b0dadd02266aaa8fb846beee636db025e3942","v":1,"via":"run"}
@zackees

zackees commented Nov 19, 2026

Copy link
Copy Markdown
Collaborator Author

The steady-state symptom from the caveat (an exact hit is never re-saved, so recurring misses persist) is tracked in #682. This PR only fixes the gate for restored, non-exact (fallback) build/target caches.

@zackees
zackees added this pull request to the merge queue Nov 19, 2026
Merged via the queue into main with commit a5ab4e6 Nov 19, 2026
42 of 43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant