Skip to content

fix(core): run installed formatter without bun on PATH - #5859

Merged
miguel-heygen merged 1 commit into
mainfrom
fix/generated-formatter-windows
Oct 19, 2026
Merged

miguel-heygen merged 1 commit into
mainfrom
fix/generated-formatter-windows

Conversation

@miguel-heygen

Copy link
Copy Markdown
Collaborator

What

Generated TypeScript now uses the checkout's installed oxfmt through the running Node/Bun executable. A formatting failure stops generation before the existing artifact is replaced.

Why

On Windows, PATH can contain bun.cmd/bun.ps1 without a directly spawnable bun executable. Spawning bun x oxfmt failed silently, so builds wrote unformatted tracked artifacts and left the checkout dirty.

Related work

Miguel's Windows generated-artifact formatter report. No separate issue required for this correction.

How

Resolve oxfmt/bin/oxfmt with createRequire and run that JS entry with process.execPath. Preserve synchronous formatting, CLI configuration and stdin-filepath. Throw with the original cause instead of returning unformatted input.

Test plan

  • Six targeted tests pass, including formatting in a subprocess with PATH empty and preserving an existing file after a formatter error.
  • Both affected generators run twice with PATH empty; their tracked artifacts remain byte-identical.
  • Normal commit hooks pass: core/Studio/scripts typecheck, lint, format, fallow audit, tracked artifacts and commit message.
  • Independent code review and launcher checks under Node and Bun passed.

What I measured

Before the fix, both new regressions fail: an empty-PATH subprocess returns raw source, and invalid source overwrites the existing artifact. After the fix, all six tests pass and repeated position-edits/SVG generator runs preserve tracked bytes.

What I did NOT exercise

Native Windows execution was unavailable on the Linux devbox. No render was produced. The subprocess test removes PATH resolution entirely, reproducing the launcher failure without relying on a platform shim.

fails without the fix: PATH-empty formatting returns raw source; malformed generated TypeScript is silently written instead of throwing before publication.

@somanshreddy somanshreddy 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.

Clean at 4607f4c8: no blocker.

  • oxfmt@0.41.0 has no exports map and declares bin/oxfmt (bun.lock, npm), so createRequire(...).resolve("oxfmt/bin/oxfmt") resolves. Running that entry with process.execPath works the same under tsx/node and bun.
  • The callers are only build scripts: buildInjectedArtifact.ts and producer/scripts/build-hf-early-stub.ts. build-hyperframes-runtime-artifact.ts calls only writeGeneratedFile, so failing closed can't affect the CLI or any runtime path.
  • The fail-closed change can't break the image builds. oxfmt is a root devDependency, and Dockerfile.test and gcp-cloud-run/Dockerfile run a full bun install --frozen-lockfile before any generator.
  • The test that throws on invalid source also checks that the existing artifact is left untouched, which is the property that matters here.

— Somu

@github-actions

Copy link
Copy Markdown
Contributor

Edit accuracy: accurate 271 (base branch 271), smooth 176 of those

The gate passes.
Smoothness is reported in the artifact, not gated. A case fails only if it fails 2 of 3 runs.

Quarantined, measured but not gated (0)

Unstable (3)

  • seqfastkeys-none-px-r0-root-z100: tracking 7.76, pressJump 0.05, drop 0, reload 0, render 0.02, renderKey -, undo true, teleport true / tracking 0.07, pressJump 0.05, drop 0, reload 0, render 0.02, renderKey -, undo true, teleport true / tracking 0.07, pressJump 0.05, drop 0, reload 0, render 0.02, renderKey -, undo true, teleport true
  • crop-idle-px-r0-nested-z100: tracking 0.04, pressJump 0, drop 0.08, reload 0.08, render 0.03, renderKey -, undo true, teleport true / tracking 0.04, pressJump 0, drop 0.08, reload 0.08, render 0.03, renderKey -, undo true, teleport true / tracking 0.04, pressJump 0, drop 0.08, reload 0.08, render 0.03, renderKey -, undo true, teleport true
  • crop-tween-px-r0-nested-z100: tracking 0.04, pressJump 0, drop 0.09, reload 0.09, render 0.26, renderKey -, undo true, teleport true / tracking 0.04, pressJump 0, drop 0.09, reload 0.09, render 0.26, renderKey -, undo true, teleport true / tracking 0.04, pressJump 0, drop 0.09, reload 0.09, render 0.26, renderKey -, undo true, teleport true

@miguel-heygen
miguel-heygen added this pull request to the merge queue Oct 18, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 18, 2026
@miguel-heygen
miguel-heygen added this pull request to the merge queue Oct 18, 2026
Merged via the queue into main with commit d369159 Oct 19, 2026
79 checks passed
@miguel-heygen
miguel-heygen deleted the fix/generated-formatter-windows branch October 19, 2026 00:12
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