Skip to content

feat: cache Electron lifecycle downloads - #11

Merged
Harold Hunt (huntharo) merged 3 commits into
mainfrom
agent/cache-lifecycle-downloads
Aug 12, 2026
Merged

Harold Hunt (huntharo) merged 3 commits into
mainfrom
agent/cache-lifecycle-downloads

Conversation

@huntharo

Copy link
Copy Markdown
Contributor

Summary

  • add opt-in cache-electron: "true" support for the two lifecycle download caches Electron applications need
  • point electron_config_cache and npm_config_cache at fixed roots beneath the selected working directory before install
  • include those roots in the dependency cache and key enabled entries with the normalized/schema segment electron-true-v1
  • reject real-path and symlink escapes before restore and again before save
  • document the gate/consumer rollout and add cross-platform unit and action-contract coverage

Root cause

The package-manager dependency cache does not include downloads made by lifecycle scripts. In the motivating PwrAgent failure, pnpm restored its store and reused every package, but root postinstall still asked prebuild-install to download the Electron-ABI better-sqlite3 binary and failed with a socket hang-up. Electron runtime downloads from @electron/get are separate for the same reason.

Design

The input is deliberately named cache-electron instead of exposing arbitrary additional cache paths. The action has a concrete two-cache contract, can assign the matching environment variables itself, and does not give callers a footgun that could archive unrelated home-directory or self-hosted-runner data.

When disabled (the default), the Electron paths and key segment are empty, so the evaluated cache paths and cache key remain unchanged. When enabled, the cache contains:

  • <working-directory>/.cache/configure-nodejs/npm for npm_config_cache (including _prebuilds)
  • <working-directory>/.cache/configure-nodejs/electron for electron_config_cache

The enabled key adds electron-true-v1. The explicit mode and schema keep it separate from immutable pre-feature caches and provide a cold-key migration point if the contract changes.

Consumer impact

After this action change lands, PwrAgent and PwrSnap should set cache-electron: "true" on every matching lookup-only primer and downstream consumer. Each OS/architecture gate remains separate. No home-directory cache environment is needed; this action exports both workspace-local variables before lifecycle scripts run.

This PR does not publish a release, create or move a tag, or update v1.

Validation

  • npm test — 89 passing tests
  • go run github.com/rhysd/actionlint/cmd/actionlint@v1.7.12 -color
  • git diff --check
  • added a three-platform workflow contract covering default/opt-in key separation, lookup-only miss priming, lookup-only hit probing, and restoration of both lifecycle cache markers

@huntharo
Harold Hunt (huntharo) marked this pull request as ready for review August 12, 2026 19:21
@huntharo
Harold Hunt (huntharo) merged commit e1bd1cc into main Aug 12, 2026
16 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