Skip to content

fix(ci): stop evaluating pantry env, which sometimes re-installs JS deps mid-job - #107

Merged
glennmichael123 merged 1 commit into
mainfrom
fix/ci-drop-pantry-env
Sep 3, 2026
Merged

fix(ci): stop evaluating pantry env, which sometimes re-installs JS deps mid-job#107
glennmichael123 merged 1 commit into
mainfrom
fix/ci-drop-pantry-env

Conversation

@glennmichael123

@glennmichael123 glennmichael123 commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

integration failed on #106 at "Build TypeScript SDK" with Cannot find package 'typescript', while typescript-sdk — same commit, same runner, same command, same shim — passed. The difference is one step earlier: integration runs eval "$(pantry env …)" && zig build, and in that run the log shows pantry running a workspace setup inside the eval — installing its own typescript@7.1.0-dev (not what the lockfile names), then its own bun install with an explicit --linker (js_delegate.zig:208) that overrides bunfig.toml's hoisted. The explicit install step had produced 351 packages; this produced 683, and root node_modules/typescript was gone.

It is intermittent, and that is the argument for this PR

main is currently green, including integration, without this change. Same workflow, same cache key, same pantry version — the setup simply did not fire:

pantry cache Installing JS deps result
#106 run 33776563410 hit yes — 683 packages, typescript@7.1.0-dev integration fail
main run 33779108264 hit no integration pass

pantry skips the install when it decides deps are already in sync (js_delegate.zig:33), so whether node_modules gets rewritten mid-job depends on runner state rather than on anything in this repo. That is worse than a deterministic break: it fails a job that nothing in the diff touched, and it passes on retry.

So this is not a fix for a red mainmain is green. It removes the nondeterminism.

The eval was never load-bearing

pantry env exports only PANTRY_* variables (0.10.3 exports none), and no workflow reads them. zig is on PATH because the pantry action already puts every installed bin there (packages/action/src/index.ts:852–912) — which is why bun install runs with no eval at all, and why zig-js's CI uses the same action with bare zig build.

Removed from all 16 sites across five workflows. The Apple signing gate in release.yml is untouched.

Verification

All 9 checks green on this PR, including zig-core on both platforms (proving zig resolves without the eval) and integration (proving the shim survives).

`integration` kept failing at "Build TypeScript SDK" with

    error: Cannot find package 'typescript' from '…/packages/typescript/scripts'

while `typescript-sdk` — same commit, same runner, same `bun run build`,
same shim — passed. The difference is one step earlier: `integration` runs
`eval "$(pantry env | sed -n '/^export /,$p')" && zig build`, and the log
inside that step reads:

    + typescript@7.1.0-dev.20260708.3
    + better-dx@0.2.20
    Linked 11 workspace package(s)
      Installing JS deps via bun
    683 packages installed
    ✗ Patch failed for ts-maps
    ⚡ pantry env activated → craft

`pantry env` does not just print exports. It runs a workspace setup: it
installs its own typescript and better-dx — neither the version the lockfile
names — then runs its own `bun install` with an explicit `--linker` flag
(`js_delegate.zig:208`), which overrides `bunfig.toml`'s `hoisted` and
re-links the whole tree. The explicit install step had put 351 packages in
place; this put 683, and root `node_modules/typescript` was gone.

The eval contributed nothing a step used. `pantry env` exports only
`PANTRY_*` variables (0.10.3 exports nothing at all), and no workflow reads
them. `zig` was found because the pantry action already puts every installed
bin on PATH — `packages/action/src/index.ts:852–912` — which is why `bun
install` runs without any eval. zig-js's CI uses the same action and runs
bare `zig build`.

Removed from all 16 sites across five workflows. The Apple signing gate in
release.yml is untouched; the only lines changed there are three build
prefixes and one bare eval inside the cross-compile loop.

This was also the origin of the `integration` break #104 set out to fix:
the dev-build `tsc` that could not find its linux-x64 binary was the one
`pantry env` had just installed and put on PATH.
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown

✅ Binary load time

rounds:    25 interleaved
base:      p50 23.1ms   p95 25.9ms   (22.2–26.4ms)
head:      p50 23.1ms   p95 24.9ms   (22.2–25.1ms)
delta:     -0.3%  (fails above +20.0%)

No binary load time regression.
What this measures

craft --help: process spawn, dynamic linking and argument parsing.
It never opens a window, so it cannot see a change in window or
webview startup — real startup is benchmarks/startup.bench.ts, which
needs a display.

Both binaries are measured interleaved on this runner and compared by
p50, rather than against a number recorded on another machine. On
byte-identical binaries that method reads within ~3.5%; the old one
swung 45%.

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown

✅ Binary Size Report

Metric Value
Current Size 14929KB (14.57MB)
Change 0KB (0%) unchanged
Size limits
  • Warning: 14.50MB
  • Maximum: 16.00MB

@glennmichael123 glennmichael123 changed the title fix(ci): stop evaluating pantry env, which re-installs JS deps mid-job fix(ci): stop evaluating pantry env, which sometimes re-installs JS deps mid-job Sep 3, 2026
@glennmichael123
glennmichael123 merged commit dbbe0af into main Sep 3, 2026
10 checks passed
@glennmichael123
glennmichael123 deleted the fix/ci-drop-pantry-env branch September 3, 2026 16:48
chrisbbreuer pushed a commit that referenced this pull request Sep 3, 2026
…issed (#111)

#107 removed `eval "$(pantry env …)"` from 16 sites across five workflows and
said so. It missed eight more in `package.json`, and `integration` found them:
its "Run root verification" step runs `bun run verify`, which reaches
`build:core`, which evals `pantry env`, which runs the workspace setup —

    ✗ Patch failed for ts-maps
    error: Cannot find package 'typescript' from …/packages/typescript/scripts

— the same clobbered `node_modules`, one door further along. The failing step
moved from "Build TypeScript SDK" to "Run root verification"; the cause did
not change at all.

Guarded rather than removed, because these are not the workflow's sites. In CI
the pantry action puts `zig` on PATH, so the guard short-circuits and nothing
runs a workspace setup. On a developer's machine `zig` is usually not on PATH,
and the eval is exactly how these scripts have always made it available — that
still happens, unchanged. `.github/CONTRIBUTING.md` documents activating
pantry for a shell, and this keeps working for anyone who has not.

Verified both directions: with `zig` on PATH the guard skips the eval and
`bun run fmt:check` exits 0; without it, the eval runs as before.
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