Skip to content

fix(capy-install): read project pins with an isolated Bun (GST-1747) - #4115

Merged
capy-ai[bot] merged 2 commits into
mainfrom
capy/gst-1747-installer-bun-isolation
Nov 7, 2026
Merged

capy-ai[bot] merged 2 commits into
mainfrom
capy/gst-1747-installer-bun-isolation

Conversation

@garrytan

@garrytan garrytan commented Nov 7, 2026 •

Copy link
Copy Markdown
Owner
{
  "schema_version": 1,
  "pr": 4115,
  "head": "0d9ecacf013c424ca71af3b590e444572ed1dabd",
  "version": "1.97.0.0",
  "base": "main",
  "gate": {
    "focused": {
      "pass": 70,
      "fail": 0,
      "skip": 0
    }
  },
  "session_kind": "unattended",
  "head_tree": "7c0cc1c7b48294d2d2cec1ca3d1e4e13bbabc4e6",
  "product_patch_id": "316eb63f72d8f3ac16683adc3852e5a7bf5f88b9",
  "gstack_version": "1.97.0.0",
  "review_depth": {
    "depth": "light",
    "class": "code",
    "runtime_lines": 7,
    "rules": "70895942bb8a8ee2",
    "base": "94392a61ecba8ad674b750b1e93bcc9eeb14bd84",
    "registry": "94392a61ecba8ad674b750b1e93bcc9eeb14bd84",
    "gate_scan": {
      "tagged": 0,
      "head": "0d9ecacf013c424ca71af3b590e444572ed1dabd"
    },
    "reasons": [
      "runtime=7"
    ],
    "risk": [],
    "mode": "panel"
  },
  "pregate": "pass @7c0cc1c7b482 (8 checks, current for 0d9ecacf013c)",
  "issues": {
    "fixes": [],
    "refs": [],
    "flakes": []
  },
  "docs": {
    "status": "updated",
    "scope": "README.md, AGENTS.md, CLAUDE.md, CONTRIBUTING.md and docs/ (141 files inventoried; installer and Bun-isolation docs read)"
  },
  "review_loop": {
    "passes": 1,
    "blocking_found": 0,
    "deferred": 0,
    "noted": 0,
    "fixed": 0,
    "scope": "frozen",
    "rounds": 1,
    "est_input_tokens": 3211,
    "ledgers_read": 3,
    "dispatches": {
      "specialist-batched": 1
    }
  }
}

What changes

bin/gstack-capy-install reads the caller's Bun and Node pins by running bin/gstack-runtime-pins.ts while its working directory is still the caller's project. Its three calls (read_pins, pins_accept, node_accept) now pass --no-env-file --config="${GSTACK_BUN_CONFIG:-/dev/null}", with the standard GSTACK_BUN_CONFIG definition at the top of the script, as AGENTS.md requires for every Bun gstack starts. A project's bunfig.toml and .env no longer load into the installer.

test/bun-entry-isolation.test.ts only recognized a literal bun or a $BUN-style variable, so it missed a runner held in "$RUNNER". The shell-caller detector now also flags:

  • any variable at a command position (line start, after ;, &&, |, $(, !, a case arm, then/do/else/exec) that launches a .ts/.tsx/.mts file;
  • any variable whose name says Bun ($REC_BUN, $_bun) running -e/-p, a script or a bin path.

Across the tracked tree it flags exactly the three installer lines and nothing else; new negative cases (cp "$SRC" x.ts, "$NODE" -e, "$RUNNER" --version, [ -f "$X/y.ts" ]) stay clean.

Tests

  • New gstack-capy-install case: install and --check from a project whose bunfig.toml preloads a file that logs each run; asserts the log stays empty while Bun and Node pins still resolve through the parser. Fails on main (9 preload runs across the read, --bun and --node calls), passes here.
  • bun-entry-isolation repo scan fails on main naming bin/gstack-capy-install:193,232,355; passes here.
  • Focused: module-size-ratchet, bun-entry-isolation, bun-dotenv-isolation, gstack-capy-install, capy-review-voice, launch-env-echo-ratchet: 100 pass, 0 fail. bun run typecheck clean; typecheck:test ratchet: none new. Credential scan: 0 high, 0 advisory.

No network, secrets, permissions, workflow or dependency changes.

What changed

The installer's three pins-parser calls now start Bun with --no-env-file and --config, like every other Bun gstack starts

The installer's three pins-parser calls now start Bun with --no-env-file and --config, like every other Bun gstack starts.

Before/after as text
-bin/gstack-capy-install:193  PINS_OUT=$("$RUNNER" "$ROOT/bin/gstack-runtime-pins.ts" --project "$PROJECT" 2>/dev/null)
-bin/gstack-capy-install:232  parser) "$RUNNER" "$ROOT/bin/gstack-runtime-pins.ts" --project "$PROJECT" --bun "$1" ...
-bin/gstack-capy-install:355  node_accept() { ! "$RUNNER" "$ROOT/bin/gstack-runtime-pins.ts" --project "$PROJECT" --node "$1" ...
+bin/gstack-capy-install:194  PINS_OUT=$("$RUNNER" --no-env-file --config="${GSTACK_BUN_CONFIG:-/dev/null}" "$ROOT/bin/gstack-runtime-pins.ts" --project "$PROJECT" 2>/dev/null)
+bin/gstack-capy-install:233  parser) "$RUNNER" --no-env-file --config="${GSTACK_BUN_CONFIG:-/dev/null}" "$ROOT/bin/gstack-runtime-pins.ts" --project "$PROJECT" --bun "$1" ...
+bin/gstack-capy-install:356  node_accept() { ! "$RUNNER" --no-env-file --config="${GSTACK_BUN_CONFIG:-/dev/null}" "$ROOT/bin/gstack-runtime-pins.ts" --project "$PROJECT" --node "$1" ...

Why

AGENTS.md says every Bun that gstack starts ignores the working directory's .env files and bunfig.toml. The Capy installer broke that rule in one place. It reads a project's Bun and Node pins by running bin/gstack-runtime-pins.ts from inside that project, so the project's Bun configuration loaded into the installer. Now those calls are isolated, and the shell scan in test/bun-entry-isolation.test.ts catches a Bun held in a variable, so the same gap can't come back unnoticed.

Blast radius

Only the three pins-parser calls in bin/gstack-capy-install change. Every runner the installer picks is a Bun at or above the 1.3.3 floor, and those versions all accept both flags. With no project bunfig.toml, the isolated and plain calls print the same pins output (script ran: the adversarial reader compared them). The widened scan flags exactly these three lines across the tracked tree and nothing else (script ran: the repo-scan test passes at this head).

Approvals

No approvals recorded for branch capy/gst-1747-installer-bun-isolation.

Summary

The Capy installer now reads a project's pins with an isolated Bun, so the project's bunfig.toml and .env don't load into it. The Bun-isolation shell scan now also recognizes Bun runners held in variables, and a new installer test covers install and --check from a project with its own bunfig.toml. docs/capy-install.md now says how the pins parser runs.

Test Coverage

All new code paths have test coverage. Coverage: deterministic (the one changed runtime file has a changed test naming it).

Tests ran: focused 70

Pre-Landing Review

Pre-Landing Review: No issues found.

REVIEW_LOOP: passes=1 blocking_found=0 deferred=0 noted=0 fixed=0 scope=frozen ledgers_read=3 dispatches=1 est_input_tokens=3211

Gate edits: none detected (6 listed, 1 read; patterns: RH-1,RH-3,RH-4,RH-12,RH-13,RH-14,RH-15,RH-16; unlisted idioms: none)

Review plan: light depth, one pass. A batched specialist (testing, security, state machines, red team) found nothing. The native adversarial reader recommended shipping as-is and left two notes below the blocking floor. Outside voice: skipped by the review plan (code class, no numeric claims).

Review notes

Below the blocking floor (advisory, informational, test-gap or wording items); recorded here and not fixed in this PR.

  • INFORMATIONAL bin/gstack-capy-install:194 read_pins discards the parser's stderr; a failed isolated parser call falls back to the jq reader without a message (pre-existing fallback; unreachable with runners at or above the 1.3.3 floor)
  • CRITICAL test/bun-entry-isolation.test.ts:46 the shell scanner does not flag a Bun-named variable running x <pkg>; the only caller (gstack-browser-ensure) changes into gstack's root first

Exploratory QA

Surface: functional (the installer's pins read). Smoke, three probes, all on current inputs, verdict pass:

  • 001: the new installer test (bun test test/gstack-capy-install.test.ts -t "ignores the project's bunfig"): 1 pass, 0 fail.
  • 002: the installer's flagged Bun call reads pins from a project whose bunfig.toml declares a preload; the preload never runs and the pins print.
  • 003: control: the same read without the flags does run the preload, so probe 002 would catch a regression.

Not run: the Windows GSTACK_BUN_CONFIG=NUL branch (Linux machine; CI's windows-smoke covers it).

Design Review

No frontend files changed — design review skipped.

Eval Results

No prompt-related files changed — evals skipped.

Review bot comments

No review bot comments.

Scope Drift

Scope Check: CLEAN
Intent: run the installer's pins parser with an isolated Bun and make the isolation scan catch variable-held Bun runners.
Delivered: the three installer calls pass the isolation flags, the scan covers variable runners, one new installer test, a changelog fragment and one docs line.

Plan Completion

Plan completion audit: not run (no plan is bound to this branch and no docs/designs/ file matches). Fix: add "Plan: " to the PR body, or run /autoplan.

Verification Results

No Step 8.1 obligations (no plan bound to this branch).

TODOS

No TODO items completed in this PR.

Documentation

Scope: committed and working-tree diff from aaff474 on capy/gst-1747-installer-bun-isolation (installer pins-parser Bun isolation, isolation test widened to variable-held runners, new installer regression test, changelog fragment), plus docs that mention the runtime pins parser or Bun isolation.

Result: updated docs/capy-install.md Preflight step 2 to say the pins parser runs with --no-env-file --config="${GSTACK_BUN_CONFIG:-/dev/null}", so a project's bunfig.toml and .env never load into the installer. AGENTS.md and the changelog fragment were already accurate.

Debt: none found.

Test plan

  • bun test test/gstack-capy-install.test.ts test/bun-entry-isolation.test.ts: 70 pass, 0 fail
  • CI free-tests carried at the reviewed tree (run 42345033819/1, 36169 tests)

🤖 Generated with Claude Code

Open in Capy

bin/gstack-capy-install runs bin/gstack-runtime-pins.ts from the caller's
project directory. Its three calls (read_pins, pins_accept, node_accept)
now pass --no-env-file --config="${GSTACK_BUN_CONFIG:-/dev/null}", so the
project's bunfig.toml and .env do not load into the installer.

test/bun-entry-isolation.test.ts also checks Bun runners held in a
variable: any variable at a command position launching a TypeScript file,
and any Bun-named variable running -e or a script.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@trunk-io

trunk-io Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

😎 This pull request was merged.

…un (GST-1747)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@capy-ai
capy-ai Bot merged commit 40071a4 into main Nov 7, 2026
64 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