Skip to content

feat(cache): cache-preset umbrella + thin-default for build-cache-mode (#251) - #252

Merged
zackees merged 2 commits into
mainfrom
chore/cache-preset-251
May 29, 2026
Merged

zackees merged 2 commits into
mainfrom
chore/cache-preset-251

Conversation

@zackees

@zackees zackees commented May 29, 2026

Copy link
Copy Markdown
Collaborator

Implements #251 — both proposals.

Proposal A — build-cache-mode: thin as the resolved default when target-cache is opted in

normalizeBuildCacheMode in src/lib/cache-keys.ts now returns "thin" (was "once") when the caller signals target-cache requested + no explicit build-cache-mode. When target-cache is off, the resolved mode stays "once" to preserve the env-visible SETUP_SOLDR_BUILD_CACHE_MODE value for downstream tools.

Proposal B — cache-preset umbrella input

New input + output:

  • cache-preset: minimal | foundation | full (default "").
  • cache-preset-effective output (the resolved value, or "").

Resolution mutates inputs near the top of resolveSetupInputs so downstream code (main.ts, cook-cache.ts) reads a single source of truth. Explicit fine-grained inputs always win — the preset only fills unset inputs. Empty cache-preset (the default) leaves every input untouched, so consumers who never set it see no behavior change.

Preset build-cache target-cache cargo-registry-cache prebuild-deps build-cache-mode
minimal false false false soldr-cook (unset → once env-visible)
foundation (= today's default) true false false soldr-cook (unset → once env-visible)
full true true true soldr-cook thin

To make the preset's mappings actually take effect, the action.yml defaults for build-cache, target-cache, and cargo-registry-cache were flipped from explicit literals ("true"/"false") to "". The existing downstream inputs.X.trim() || "<historical default>" fall-through patterns preserve identical behavior when no preset is set. prebuild-deps default stays "soldr-cook" (all three presets agree on cook=on, same as the historical default).

Other

  • Added enabled: boolean to BuildCachePlan (parity with TargetCachePlan.enabled / CargoRegistryCachePlan.enabled).
  • README: new "Cache policy presets" section with mapping table, examples, and a sub-section on the thin-default flip.
  • CHANGELOG: Unreleased entries for both proposals + the new plan field.

Test plan

  • All 559 tests pass (553 pass + 6 skipped + 0 fail).
  • New tests in __tests__/resolve-setup.test.ts cover: each preset's mapping (minimal/foundation/full), explicit-wins precedence, no-preset default (no mutation), invalid value rejection, cache-preset-effective output, the thin-default flip, and the explicit-build-cache-mode override.
  • Updated __tests__/cache-keys.test.ts to assert the new normalizeBuildCacheMode("", "", true) → "thin" contract + added a case for allowLegacyTranslation=false → "once" (target-cache off env-visible compatibility).
  • dist/main.js + dist/post.js rebuilt via npm run build.
  • Demo workflow / downstream consumer footprint regression check after release (acceptance criterion Optimize setup-soldr cache restore path #7 in the issue).

Closes #251.

🤖 Generated with Claude Code

zackees and others added 2 commits May 29, 2026 15:26
#251)

Two cache-policy refinements after the v0.9.12+ default trim arc
(#219, #225, #231, #232, #236):

**Proposal A — `build-cache-mode: thin` as the resolved default when
`target-cache` is opted in.** Empty + `target-cache: true` now resolves
to `thin` (the bounded dep-artifact shape) instead of `once` (the
heavier rust-plan bundle). One input enables the bounded variant
instead of having to set both. The heavier `once` and unbounded `full`
remain available as explicit opt-ins. When `target-cache` is off the
resolved mode stays `once` to preserve the env-visible
`SETUP_SOLDR_BUILD_CACHE_MODE` value for downstream tools.

**Proposal B — `cache-preset` umbrella input.** One-line policy
intent that fills any cache-affecting input the consumer leaves unset;
explicit fine-grained inputs always win.

  - `minimal`    → build-cache=false, target-cache=false,
                   cargo-registry-cache=false, prebuild-deps=soldr-cook
  - `foundation` → today's default (no behavior change)
  - `full`       → build-cache=true, target-cache=true,
                   cargo-registry-cache=true, prebuild-deps=soldr-cook,
                   build-cache-mode=thin

Resolution mutates `inputs` near the top of `resolveSetupInputs` so
downstream code reads a single source of truth. Empty `cache-preset`
(the default) leaves every input untouched, so consumers who never
set it see no behavior change. The resolved preset is surfaced via
the new `cache-preset-effective` output.

Also adds `enabled: boolean` to `BuildCachePlan` for parity with
`TargetCachePlan.enabled` and `CargoRegistryCachePlan.enabled`, which
makes the build-cache layer's resolved on/off state observable.

Empirical motivation (FastLED/fbuild#280, merged 2026-05-29): when
the foundation defaults are paired with coarse cache keys, the
setup-soldr cache footprint dropped from ~6.7 GB to ~437 MiB on a
72-board CI matrix with warm wall-clock 5 min → 2 m 23 s. This issue
makes that policy expressible in one line.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
#251)

Update the Python action.yml contract test fixture to reflect the new
input/output added by the cache-preset umbrella PR.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
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.

perf(cache): standardize build-cache-mode: thin default + add cache-preset umbrella for one-line policy selection

1 participant