Skip to content

Fix two crashes the first live run exposed - #17

Merged
brunoborges merged 1 commit into
mainfrom
fix-live-run-crashes
Aug 5, 2026
Merged

Fix two crashes the first live run exposed#17
brunoborges merged 1 commit into
mainfrom
fix-live-run-crashes

Conversation

@brunoborges

Copy link
Copy Markdown
Collaborator

The first live run of the rescoped benchmarks (after #15 merged) surfaced two defects that unit tests could not catch.

requireEnv used as a getter. It validates a list of names and returns nothing. check-cache-keys.mjs and report-cache-value.mjs both called it as requireEnv(env, "NAME") and assigned the result, so it received a string where it expected an array and threw names.filter is not a function. The key stability check died before reading a single key — all four probe jobs had succeeded — and the cache value report would have died after collecting every sample.

@actions/cache cannot be required by name. It publishes an exports map with no "." entry, so require("@actions/cache") throws ERR_PACKAGE_PATH_NOT_EXPORTED. Every cache save slot failed on it. Resolving the package manifest and requiring what its main points at goes around the map, and keeps working across the different toolkit versions each setup-java ref pins — which is the whole reason that workflow installs each ref's own dependencies. Verified locally against @actions/cache@4.

Run evidence: key stability 30983228434, cache save 30983247712.

Action overhead, Transfer overlap and JDK cache all passed on that same run.

`requireEnv` validates a list and returns nothing; two reports called it as a
getter and assigned its result, so the key stability check died before reading a
single key and the cache value report would have died after collecting all of
its samples.

`@actions/cache` publishes an `exports` map with no "." entry, so requiring it
by package name throws ERR_PACKAGE_PATH_NOT_EXPORTED and every cache save slot
failed. Resolve its manifest and require what `main` points at instead, which
goes around the map and keeps working across the versions different setup-java
refs pin.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 71c45320-1417-4029-8402-69075d61dac1
Copilot AI lite review requested due to automatic review settings August 5, 2026 07:05
@brunoborges
brunoborges merged commit ad2418b into main Aug 5, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes two runtime failures encountered in the first live run of the rescoped benchmarks by aligning requireEnv usage with its actual contract and by making @actions/cache loadable despite its restrictive exports map.

Changes:

  • Update check-cache-keys.mjs and report-cache-value.mjs to call requireEnv(env, [...]) for validation and then read values from env.
  • Update cache-save.sh to load @actions/cache by resolving and requiring its main entry via the package manifest, avoiding ERR_PACKAGE_PATH_NOT_EXPORTED.
Show a summary per file
File Description
scripts/report-cache-value.mjs Switches from treating requireEnv as a getter to using it for validation and reading env vars directly.
scripts/check-cache-keys.mjs Same requireEnv contract fix for cache key stability metadata inputs.
scripts/cache-save.sh Adds a manifest-based loader for @actions/cache to avoid failures caused by the package exports map.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Suppressed comments (1)

scripts/cache-save.sh:286

  • loadCacheClient() redeclares the manifest parameter as a const manifest, which is a syntax error and will cause the cache-save Node snippet to fail at parse time.
  const manifest = JSON.parse(readFileSync(manifestPath, "utf8"));
  return require(join(dirname(manifestPath), manifest.main ?? "lib/cache.js"));
  • Files reviewed: 3/3 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment thread scripts/cache-save.sh
Comment on lines +239 to +240
const manifest = JSON.parse(readFileSync(manifestPath, "utf8"));
return require(join(dirname(manifestPath), manifest.main ?? "lib/cache.js"));
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.

2 participants