Skip to content

Stop building sight binaries whose console can't start - #339

Merged
jbearak merged 1 commit into
mainfrom
t3/fix-console-pty-support
Oct 31, 2026
Merged

jbearak merged 1 commit into
mainfrom
t3/fix-console-pty-support

Conversation

@jbearak

@jbearak jbearak commented Oct 31, 2026 •

Copy link
Copy Markdown
Owner

sight console failed in a locally built binary with "this runtime has no pseudo-terminal support". A compiled binary embeds the Bun that built it, and the console's PTY (Bun.Terminal) only exists in Bun 1.3.5 and later. Building with an older Bun silently produced a binary whose console could never start.

scripts/build-binary.ts now refuses to compile with Bun older than 1.3.5 and tells you to run bun upgrade. It also compiles with the Bun that runs the script (process.execPath) rather than whichever bun is first on PATH, so the version it checks is the version that compiles. CI and release builds already use Bun 1.3.13 and are unaffected.

Proof: at main, a Bun 1.3.1 build reproduced the PTY error under a real terminal. On this branch the same build exits 1 with the upgrade message, and a Bun 1.4.4 build starts Stata's console. Typecheck, lint, line-endings and bun test ./tests (8166 tests) pass.

Reviewed with sol-loop: 1 round with gpt-6.1-sol. Sol verdict: approved

Created with Claude Opus 5.5 in Claude Code (T3 Code), reviewed by gpt-6.1-sol.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Build Improvements
    • Binary builds now check that the installed Bun version supports required native features and provide a clear error when it is too old.
    • Builds use the active Bun executable, so they no longer depend on finding Bun through the system’s PATH.
  • Tests
    • Added checks for rejecting older Bun versions and accepting supported versions.

A native binary embeds the Bun runtime that compiled it. Bun before
1.3.5 has no Bun.Terminal, so `sight console` in such a binary fails
with "this runtime has no pseudo-terminal support". The build now
stops with an upgrade hint instead, and compiles with the Bun it
checked (process.execPath) rather than whichever bun is on PATH.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Team
  • Run ID: 7bf55c3c-baf4-4de7-a486-096de04578b1
Commits

Reviewing files that changed from the base of the PR and between a69f5d7 and d2f1d37.

Files selected for processing: 2
  • scripts/build-binary.ts
  • tests/unit/build-binary-bun-version.test.ts

Included review availability: This review used your included allowance. 0 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 2 reviews per hour.

Walkthrough

The build script requires Bun 1.3.5 or later before building. The compile command uses the current Bun executable. Unit tests cover rejected and accepted versions.

Changes: Binary build version gate

Layer / File(s) Summary
Minimum version contract and tests
scripts/build-binary.ts, tests/unit/build-binary-bun-version.test.ts
The script exports MIN_BINARY_BUN_VERSION and assert_binary_bun_version. Tests check that versions below 1.3.5 fail and that the minimum and later versions pass.
Build checks and executable selection
scripts/build-binary.ts
build_binary checks Bun.version before proceeding. The compile command invokes process.execPath instead of resolving bun from PATH.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: Low · up to d2f1d

Binary builds reject newer Bun canaries. Stable Bun remains a workaround, so the change is mergeable with this limitation.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly describes the main change: preventing builds of binaries whose console cannot start due to an incompatible Bun runtime.
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 2 functions across 2 files.

Finishing Touches
Generate docstrings
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@jbearak
jbearak merged commit 4554690 into main Oct 31, 2026
14 checks passed
@jbearak
jbearak deleted the t3/fix-console-pty-support branch October 31, 2026 18:11
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