Skip to content

feat(cache): keep soldr's syslib store in RUNNER_TOOL_CACHE on act/self-hosted runners (#553) - #554

Merged
zackees merged 1 commit into
mainfrom
fix/553-syslib-toolcache
Oct 2, 2026
Merged

zackees merged 1 commit into
mainfrom
fix/553-syslib-toolcache

Conversation

@zackees

@zackees zackees commented Oct 2, 2026

Copy link
Copy Markdown
Collaborator

Closes #553.

What this changes

soldr prepare and soldr build install syslib bundles (zstd, sqlite, zlib-ng, lzma, bzip2, cmake, ninja, and the GNU/Linux GCC toolchain) under $SOLDR_CACHE_DIR/bin/syslib/<lib>/<version>/<slug>/. setup-soldr puts SOLDR_CACHE_DIR under RUNNER_TEMP, which starts empty in every new container. Under act (bosn ci, forge-ci/bosn#323), every warm run of clud's build-linux-x64 therefore re-downloaded the whole set, taking 35–77 s.

This PR uses option (a) from the issue. After the parallel cache restore and before any soldr process starts, setup-soldr makes $SOLDR_CACHE_DIR/bin/syslib a symlink to:

$RUNNER_TOOL_CACHE/soldr-syslib/<platform>-<arch>

It exports the store path as SETUP_SOLDR_SYSLIB_STORE. SOLDR_CACHE_DIR, the zccache directory, and the rest of bin/ do not move. soldr has no override for its syslib directory (every call site uses paths.bin.join("syslib")), so the change belongs in setup-soldr and soldr needs no change.

Where it is on

Runner Default Why
act (ACT=true, e.g. bosn ci) on bosn persists act's /opt/hostedtoolcache (forge-ci/bosn#352)
self-hosted (RUNNER_ENVIRONMENT=self-hosted) on the tool cache outlives the job
GitHub-hosted off the tool cache dies with the VM. setup-cache already carries $SOLDR_CACHE_DIR/bin, including syslib/. A symlink there would make setup-cache save a pointer instead of the content, which would make hosted runs slower
cross-targets lanes off setup-soldr's prepare archive already persists syslib, and soldr's --restore (tar unpack) refuses to write through a link that leaves its root
Windows off would need a junction, and soldr's Windows extractors special-case reparse points (soldr#2300)

SETUP_SOLDR_SYSLIB_TOOL_CACHE=0|1 overrides the default. If bin/syslib is already a real, non-empty directory (for example one setup-cache restored), setup-soldr leaves it alone. An empty directory, a stale link, or a dangling link is replaced. A failure to link only produces a warning, and soldr then downloads into RUNNER_TEMP as it does today.

Why sharing the store is safe

soldr is responsible for the store's integrity (soldr-fetch/src/fetch/syslib_common.rs::ensure_syslib_bundle):

  • each bundle is sha256-verified against the soldr-toolchain catalogue before extraction (soldr: trust: verified syslib … sha256=…)
  • extraction goes to a staging directory beside the install, is promoted atomically, and the .complete stamp is written last, so an interrupted install is never mistaken for a finished one
  • a cross-process flock in the syslib directory serializes concurrent installs, so parallel jobs sharing a self-hosted tool cache wait for each other and reuse the result instead of racing
  • install paths include the version (<lib>/<version>/<slug>), so a new version is installed beside the old one rather than over it

This is the same model as a developer's long-lived ~/.soldr.

Tests (RED then GREEN)

__tests__/syslib-tool-cache.test.ts (7 tests):

  • the store path is under RUNNER_TOOL_CACHE, and the decision matrix above holds, including both overrides
  • a second, fresh SOLDR_CACHE_DIR does not download. Run 1 links and installs through a mocked fetch. Run 2 uses an empty new soldr root with the tool cache persisted, relinks, and the stamp check that mirrors soldr's short-circuits, so the fetch count stays at 1. A second link in the same job reports already-linked
  • a non-empty restored syslib/ is kept, and empty directories and stale or dangling links are replaced

Local gates: npm run typecheck is clean. npm test reports 851 tests, 850 passed, 0 failed, 1 skipped (the watchdog self-test). npm run lint:vendor-prose passes, and npm run build was run, which changed only dist/main.js.

npm run pretest (two-phase-actions-cache.test.ts, "default Actions-cache wrapper round trips…", 'failed' !== 'saved') also fails on unmodified origin/main on this NixOS host. That failure is environmental and comes from before this PR.

Taking effect for consumers

clud uses zackees/setup-soldr@v0. Nothing changes for clud until this is merged and v0 is promoted through the manual Update v0 tag workflow (AGENTS.md gate). No consumer input change is needed: under bosn ci the action sees ACT=true and links automatically. The first run populates /opt/hostedtoolcache/soldr-syslib/linux-x64, and runs after that skip the downloads.

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.

cache soldr prepare's syslib/toolchain downloads (77 s per warm run under act/bosn ci)

1 participant