Skip to content

rust: fix cargo check --tests for bun_parsers and bun_sys after #34820/#35002 - #35068

Closed
robobun wants to merge 7 commits into
mainfrom
farm/4970c522/fix-bun-parsers-cargo-test
Closed

rust: fix cargo check --tests for bun_parsers and bun_sys after #34820/#35002#35068
robobun wants to merge 7 commits into
mainfrom
farm/4970c522/fix-bun-parsers-cargo-test

Conversation

@robobun

@robobun robobun commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

What does this PR do?

Restores cargo check -p <crate> --tests for the two crates broken on main, lets scripts/bench-json-rust.sh --test run to completion again, and adds a guard test so the next workspace-wide refactor can't silently break them. None of these paths are exercised by bun bd, so they slipped through.

E0599: Expr::get_boolean not found (bun_parsers, from #35002)

error[E0599]: no associated function or constant named `get_boolean` found for struct `bun_ast::Expr`
  --> src/parsers/json.rs:1852:46

Expr::get_boolean was removed by the workspace-wide dead-code sweep in #35002. Its only caller was inside a #[cfg(test)] block in src/parsers/json.rs, which the reachability analysis (rooted at the two shipped artifacts) does not see. Rather than re-add the dead function, the test now uses root.get(b"private").and_then(|e| e.as_bool()), which is the live API and exercises the same EBoolean | EBranchBoolean match arm.

E0599: File::stderr not found (bun_sys, from #35002)

error[E0599]: no associated function or constant named `stderr` found for struct `file::File`
  --> src/sys/file.rs:495

Same mechanism: File::stderr() was removed as dead, its only caller is in #[cfg(test)] fn dropping_stdio_is_safe. Replaced with File::from_fd(Fd::stderr()) so the Drop-guard's stderr arm stays covered (it is a separate is_stdio() disjunct on Windows), and reworded the module doc that still named the removed constructor.

I swept cargo check -p <crate> --tests across every test-bearing crate #35002 touched; these two were the only regressions it introduced. (bun_router --tests is also broken, but was already broken before #35002 and is out of scope here.)

Link error: undefined highway_memmem (bun_parsers test binary, from #34820)

ld.lld: error: undefined symbol: highway_memmem
>>> referenced by lib.rs:144 (src/highway/lib.rs:144)

#34820 made bun_highway::memmem call highway_memmem directly on all platforms. That symbol is defined in src/jsc/bindings/highway_strings.cpp, which the standalone test/bench build cannot compile (it includes root.h). Added a pure-Rust #[no_mangle] shim in src/parsers/native_test_shims.rs next to the existing highway_index_of_char / highway_index_of_any_char shims. The only Rust caller (bun_highway::memmem) already guards needle.is_empty() and haystack.len() < needle.len() before dispatching, so the shim does not need to.

Guard test (test/internal/rust-tests-compile.test.ts)

Spawns cargo check -p bun_parsers -p bun_sys --tests --keep-going and asserts exit 0. bun bd, rust:check, and rust:clippy all build with the default cfg only, so nothing else in CI would catch a #[cfg(test)] break in these crates. Check-only (no link/run), ~3s on a warm build tree; skips if cargo is not on PATH or the codegen dir is not populated.

How did you verify your code works?

$ cargo check -p bun_parsers --tests        # E0599 before, clean after
$ cargo check -p bun_sys --tests            # E0599 before, clean after
$ scripts/bench-json-rust.sh --test
test result: ok. 33 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
$ bun bd test test/internal/rust-tests-compile.test.ts
(pass) cargo check --tests compiles: bun_parsers, bun_sys

Only #[cfg(test)] blocks, the test-shim module (itself gated #[cfg(test)] / bench-only), and a module doc comment are touched; nothing in the shipped binary changes.


[review] gate passed · iteration 2 · 4 files touched

fails on main (without fix)
ASAN without fix: BUILD FAILED (no junit output)
$ BUN_DEBUG_QUIET_LOGS=1 bun scripts/build.ts --profile=debug --quiet test "--reporter=junit" "--reporter-outfile=/tmp/mechgate.xml" test/internal/rust-tests-compile.test.ts
ninja: Entering directory `/workspace/bun/build/debug'
[1/167] gen cpp.rs (cppbind)
[2/167] gen generated_host_exports.rs
generated_host_exports.rs: 91 exports (host=3, lazy=10, generic=78, rust=0); 237 extern-C blocks audited
[3/167] gen JS modules (bundle-modules)
Preprocess modules (10742ms)
Bundle modules (47ms)
Postprocesss modules (150ms)
Bundle Functions (746ms)
Generate Code (12ms)

[11.71s] Bundled "src/js" for development
  2210 kb
  165 internal modules
  13 native modules
  90 internal functions across 19 files
[3/167] cargo bun_bin → libbun_rust.a (--target x86_64-unknown-linux-gnu)

  nightly-2026-07-20-x86_64-unknown-linux-gnu unchanged - rustc 1.99.0-nightly (9f36de775 2026-07-19)

[164/167] cxx obj/codegen/ZigGeneratedClasses.cpp.o
[165/167] link bun-debug
FAILED: bun-debug 
/workspace/bun/build/release/bun /workspace/bun/scripts/build/stream.ts link --console /usr/lib/llvm-21/bin/clang++ @bun-debug.rsp -fsanitize=address -fsanitize=null -Wl,--wrap=exp -Wl,--wrap=exp2 -Wl,--wr
... (truncated)

release without fix: 1 FAILED
bun test v1.4.0-canary.1 (930c7fd26)

test/internal/rust-tests-compile.test.ts:
41 |     const [stderr, exitCode] = await Promise.all([proc.stderr.text(), proc.exited]);
42 |     const errors = stderr
43 |       .split("\n")
44 |       .filter(l => /^error(\[|:)|: error[[:]/.test(l))
45 |       .join("\n");
46 |     expect(errors).toBe("");
                        ^
error: expect(received).toBe(expected)

- ""
+ "src/sys/file.rs:495:27: error[E0599]: no associated function or constant named `stderr` found for struct `file::File` in the current scope: associated function or constant not found in `file::File`
+ error: could not compile `bun_sys` (lib test) due to 1 previous error
+ src/parsers/json.rs:1852:46: error[E0599]: no associated function or constant named `get_boolean` found for struct `bun_ast::Expr` in the current scope: associated function or constant not found in `bun_ast::Expr`
+ error: could not compile `bun_parsers` (lib test) due to 1 previous error"

- Expected  - 1
+ Received  + 4

      at <anonymous> (/workspace/bun/test/internal/rust-tests-compile.test.ts:46:20)
(fail) cargo check --tests compiles: bun_parsers, bun_sys [2658.30ms]

 0 pass
 1 fai
... (truncated)
passes on PR (with fix)
ASAN with fix: all passed
$ BUN_DEBUG_QUIET_LOGS=1 bun scripts/build.ts --profile=debug --quiet test "--reporter=junit" "--reporter-outfile=/tmp/mechgate.xml" test/internal/rust-tests-compile.test.ts
bun test v1.4.0 (58e25b421)

test/internal/rust-tests-compile.test.ts:
(pass) cargo check --tests compiles: bun_parsers, bun_sys [2434.76ms]

 1 pass
 0 fail
 2 expect() calls
Ran 1 test across 1 file. [4.91s]
__F:0:S:0

release with fix: all passed
$ bun scripts/build.ts --profile=release
[configured] bun-profile → bun (stripped) in 700ms (unchanged)
ninja: Entering directory `/workspace/bun/build/release'
[1/126] gen cpp.rs (cppbind)
[2/126] gen generated_host_exports.rs
generated_host_exports.rs: 91 exports (host=3, lazy=10, generic=78, rust=0); 237 extern-C blocks audited
[3/126] gen JS modules (bundle-modules)
Preprocess modules (7617ms)
Bundle modules (38ms)
Postprocesss modules (211ms)
Bundle Functions (825ms)
Generate Code (112ms)

[8.82s] Bundled "src/js" for production
  2040 kb
  165 internal modules
  13 native modules
  90 internal functions across 19 files
[3/126] cargo bun_bin → libbun_rust.a (--target x86_64-unknown-linux-gnu)

  nightly-2026-07-20-x86_64-unknown-linux-gnu unchanged - rustc 1.99.0-nightly (9f36de775 2026-07-19)

�[1m�[92m    Blocking�[0m waiting for file lock on build directory
�[1m�[92m   Compiling�[0m bun_sys v0.0.0 (/workspace/bun/src/sys)
�[1m�[92m   Compiling�[0m bun_uws_sys v0.0.0 (/workspace/bun/src/uws_sys)
�[1m�[92m   Compiling�[0m bun_perf v0.0.0 (/workspace/bun/src/perf)
�[1m�[92m   Compiling�[0m bun_analytics v0.0.0 (/workspace/bun/src/analytics)
�[1m�[92m   Comp
... (truncated)
diff hotspot
src/parsers/json.rs                      |  7 ++++-
 src/parsers/native_test_shims.rs         | 21 ++++++++++++++
 src/sys/file.rs                          | 17 ++++++-----
 test/internal/rust-tests-compile.test.ts | 50 ++++++++++++++++++++++++++++++++
 4 files changed, 86 insertions(+), 9 deletions(-)

gate history · 3 passed · 1 rejected · iteration 2

evidence per changed file
file                                      reads  edits  tests
src/parsers/json.rs                           2      1      0
src/parsers/native_test_shims.rs              2      3      0
src/sys/file.rs                               5      5      0
test/internal/rust-tests-compile.test.ts      1      3      0

Expr::get_boolean was removed as dead code in #35002 but had a
cfg(test) caller in src/parsers/json.rs that the reachability analysis
could not see. Rewrite the test to use the live get() + as_bool() API,
which covers the same match arm.

Separately, #34820 routed bun_highway::memmem through highway_memmem on
all platforms, but that symbol lives in highway_strings.cpp which the
standalone bench/test build cannot compile (it pulls in root.h). Add a
libc memmem shim alongside the existing simdutf shim so the test binary
links again.
@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

Updated Rust test helpers and native test shims, added conditional compilation coverage for selected Rust crates, and clarified bun.sys.File drop behavior while adjusting stdio safety testing.

Changes

Rust test updates

Layer / File(s) Summary
Rust test compilation support
src/parsers/native_test_shims.rs, src/parsers/json.rs, test/internal/rust-tests-compile.test.ts
Added the highway_memmem test shim, updated boolean extraction in the parser probe helper, and added conditional cargo check --tests coverage for bun_parsers and bun_sys.
File drop behavior validation
src/sys/file.rs
Clarified File drop documentation and changed the stderr safety test to wrap Fd::stderr() directly.

Possibly related PRs

  • oven-sh/bun#34820: Adds the FFI binding and wrapper that consume the highway_memmem symbol introduced here.

Suggested reviewers: jarred-sumner

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
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.
Title check ✅ Passed The title clearly states the Rust fix and identifies the affected crates and regressions.
Description check ✅ Passed The description includes both required sections and provides detailed implementation and verification notes.

Comment @coderabbitai help to get the list of available commands.

@robobun

robobun commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator Author
Updated 4:42 AM PT - Jul 22nd, 2026

@robobun, your commit 58e25b42184b6f41910f8d3cd14d636e6c40b5be passed in Build #77639! 🎉


🧪   To try this PR locally:

bunx bun-pr 35068

That installs a local version of the PR into your bun-35068 executable, so you can run:

bun-35068 --bun

@robobun

robobun commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator Author

Status: diff is green; ready for a maintainer.

Reproduced on main:

  • cargo check -p bun_parsers --tests → E0599 Expr::get_boolean
  • cargo check -p bun_sys --tests → E0599 File::stderr
  • scripts/bench-json-rust.sh --test → undefined highway_memmem

With this patch, both --tests checks are clean and all 33 bun_parsers unit tests pass. test/internal/rust-tests-compile.test.ts guards against recurrence and passed on every lane in both CI runs.

All remaining CI reds on builds 77534 and 77639 are known-flaky tests in unrelated areas (install/migration, http/tls leak checks, repl, fetch-leak, es-module-lexer, no-orphans). This PR changes only #[cfg(test)] code, a test-only shim module, and a doc comment; the shipped binary is byte-identical to main, so none of those failures can be caused by this diff.

@claude claude Bot 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.

LGTM — mechanical fixes to test-only/bench-only code, nothing in the shipped binary changes.

What was reviewed:

  • as_bool() replacement: verified Expr::as_bool at src/ast/expr.rs:323 returns Option<bool> over the same EBoolean | EBranchBoolean arms; the existing bool=Some(true) assertion still holds.
  • highway_memmem shim signature checked against both the Rust extern (src/highway/lib.rs:7-12) and the real impl (src/jsc/bindings/highway_strings.cpp:2023) — matches exactly.
  • Bench script wiring: new .o is picked up by the existing ar rcs ... "$SUP"/*.o glob; follows the sibling simdutf_shim pattern.
Extended reasoning...

Overview

Three files touched, none of which ship in the binary:

  • src/parsers/json.rs — a single expression inside #[cfg(test)] mod tests swaps the removed Expr::get_boolean(&root, b"private") for root.get(b"private").and_then(|e| e.as_bool()).
  • src/parsers/benches/support/highway_shim.cpp — new 13-line bench-only shim providing extern "C" highway_memmem via libc memmem.
  • scripts/bench-json-rust.sh — one added build line to compile the shim into the existing libbun_bench_cdeps.a.

Both breakages are well-explained and traceable: #35002's dead-code sweep removed Expr::get_boolean (only caller was cfg(test)-gated and invisible to the reachability analysis), and #34820 made bun_highway::memmem unconditionally reference the highway_memmem C symbol that the standalone bench build can't compile from highway_strings.cpp (which pulls in root.h).

Security risks

None. No runtime code paths, no user-facing surface, no untrusted input handling. The shim is dev-tooling-only and just forwards to libc memmem.

Level of scrutiny

Low. This is build-breakage repair confined to test/bench infrastructure. I verified the two substantive claims against source:

  • Expr::as_bool() exists (src/ast/expr.rs:323) and matches Data::EBoolean(b) | Data::EBranchBoolean(b) => Some(b.value), so root.get(...).and_then(|e| e.as_bool()) is semantically equivalent to the removed helper. The downstream assertion full.contains("bool=Some(true)\n") is unchanged and still satisfied by {:?} on Option<bool>.
  • The shim's signature void* highway_memmem(const uint8_t*, size_t, const uint8_t*, size_t) is byte-identical to the production definition at highway_strings.cpp:2023 and matches the Rust extern at src/highway/lib.rs:7-12 (*const u8, usize, *const u8, usize -> *const u8).

Other factors

  • The new shim exactly mirrors the existing simdutf_shim.cpp pattern in the same directory, and the bench script wires it in the same way (compiled to $SUP/*.o, archived by the existing glob).
  • The bench script only targets Linux/Darwin (per the CXXLIB branch), where libc memmem is available.
  • Author verified cargo check -p bun_parsers --tests and scripts/bench-json-rust.sh --test (33/33 pass).
  • No prior reviewer comments to address; no CODEOWNERS concerns for bench scripts or cfg(test) blocks.

… bun_sys --tests

Put highway_memmem next to the existing highway_index_of_char/any_char
Rust shims in native_test_shims.rs instead of introducing a new C++ TU
and bash build step; the symbol needs no C++ dependency.

Also fix cargo check -p bun_sys --tests, broken by the same #35002
mechanism: File::stderr() was removed but had a cfg(test) caller in
dropping_stdio_is_safe. Drop the stderr line since stdin/stdout already
cover the Drop invariant being tested.

Swept every test-bearing crate #35002 touched; bun_parsers and bun_sys
were the only #35002-caused --tests regressions.
@robobun robobun changed the title parsers: fix cargo test -p bun_parsers after #34820 and #35002 rust: fix cargo check --tests for bun_parsers and bun_sys after #34820/#35002 Jul 22, 2026
No other CI lane builds the test cfg, so refactors that remove a symbol
whose only caller is behind #[cfg(test)] are otherwise invisible. This
check is cargo-check only (no link/run) and runs in a few seconds on a
warm tree.
Comment thread src/sys/file.rs Outdated
…(Fd::stderr())

File::stderr() is gone, but Fd::stderr() is not, and callers can still
wrap it with File::from_fd. On Windows is_stdio() checks stderr as a
separate disjunct, so the Drop guard's stderr arm is a distinct code
path worth keeping covered. Also drop the stale File::stderr() mention
from the module doc.
Comment thread test/internal/rust-tests-compile.test.ts Outdated
Comment thread test/internal/rust-tests-compile.test.ts Outdated
…lter

The neighboring linear-fifo.test.ts already checks vendor/lolhtml/Cargo.toml
for the same reason (test-only lanes lack it and cargo cannot resolve the
workspace without it). Also switch the unread stdout pipe to 'ignore', and
widen the error filter to catch cargo's own 'error: ...' lines so a
workspace-resolution failure shows up in the assertion rather than as a bare
exit-code mismatch.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/parsers/native_test_shims.rs`:
- Around line 42-61: Update highway_memmem to handle needle_len == 0 before
constructing slices or calling windows, returning haystack directly to match
bun_highway::memmem’s empty-needle behavior. Preserve the existing search and
null-result behavior for non-empty needles.

In `@src/sys/file.rs`:
- Around line 489-495: Extend the stdio wrapper Drop test around
File::from_fd(Fd::stderr()) to assert stderr remains open after the wrappers are
dropped. Add the stderr-specific fstat check alongside the existing stdout
assertion, using Fd::stderr() and preserving the current repeated-loop coverage.

In `@test/internal/rust-tests-compile.test.ts`:
- Around line 31-50: Extend the rust compilation test near the existing cargo
check flow to add a link-time regression test for the native highway_memmem
shim, using the supported scripts/bench-json-rust.sh --test path or an
equivalent prepared cargo test --no-run target. Assert the link command succeeds
and retain the existing cargo-check coverage.
- Around line 1-11: Replace the narrative comments above the Rust regression
test with only the full issue URL for `#35002`. Apply the same reduction to all
referenced comment blocks, preserving the test implementation unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 7525f308-6c45-4ff1-8a7d-53d65e5fabd7

📥 Commits

Reviewing files that changed from the base of the PR and between 410abd3 and 5ce0a97.

📒 Files selected for processing (4)
  • src/parsers/json.rs
  • src/parsers/native_test_shims.rs
  • src/sys/file.rs
  • test/internal/rust-tests-compile.test.ts

Comment thread src/parsers/native_test_shims.rs
Comment thread src/sys/file.rs
Comment thread test/internal/rust-tests-compile.test.ts
Comment thread test/internal/rust-tests-compile.test.ts

@claude claude Bot 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.

LGTM — all earlier feedback addressed; nothing in the shipped binary changes.

What was reviewed:

  • highway_memmem shim: confirmed bun_highway::memmem guards empty needle and short haystack before dispatch, matching the sibling shims' caller-precondition pattern.
  • dropping_stdio_is_safe: stderr arm restored via File::from_fd(Fd::stderr()) and now asserted with fstat(Fd::stderr()); module doc no longer names the removed constructor.
  • Guard test: workspaceReady now matches linear-fifo.test.ts's two-part check, stdout: "ignore", and the widened error filter also catches cargo's un-prefixed error: lines.
Extended reasoning...

Overview

Four files: a one-line rewrite in a #[cfg(test)] block of src/parsers/json.rs (removed Expr::get_boolean → live .get().and_then(|e| e.as_bool())), a new pure-Rust highway_memmem shim in the test-only src/parsers/native_test_shims.rs, a #[cfg(test)] fix + doc-comment reword in src/sys/file.rs, and a new test/internal/rust-tests-compile.test.ts guard that runs cargo check -p bun_parsers -p bun_sys --tests. Every Rust hunk is behind #[cfg(test)] or in a module that is only compiled for the crate's own test/bench binaries; the shipped bun binary is byte-identical.

Security risks

None. No user-facing surface, no parsing of untrusted input, no auth/crypto/permissions. The shim is unsafe extern "C" but is test-only, its sole caller (bun_highway::memmem, verified at src/highway/lib.rs:135-150) enforces both preconditions the SAFETY comment documents, and it never links into the product.

Level of scrutiny

Low. This is build-hygiene: restoring cargo check --tests after a dead-code sweep removed symbols whose only callers were cfg-gated. The replacements are mechanical (as_bool() matches the same EBoolean | EBranchBoolean arm at src/ast/expr.rs:323-326; File::from_fd(Fd::stderr()) constructs the same wrapper the removed File::stderr() did). The new guard test follows the sibling test/internal/linear-fifo.test.ts pattern exactly (same two-part workspaceReady skip, same repo-root resolution).

Other factors

Two prior review rounds from me and one from CodeRabbit were all addressed or reasonably declined: stderr coverage restored (bc406ca), lolhtml skip guard + stdout: "ignore" + widened error filter (5ce0a97), stderr fstat assertion (930c7fd). CodeRabbit's empty-needle concern was withdrawn after verifying the caller guard; the "add a link-time test" suggestion was declined because bench-json-rust.sh fetches from github.com and is out of the test-time budget — that reasoning holds. The PR body's mechgate evidence shows the guard test failing on main and passing on the branch under both ASAN-debug and release.

robobun added a commit that referenced this pull request Jul 22, 2026
Same guard file as #35068; whichever lands first, the other appends its
crate to CRATES.

@claude claude Bot 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.

LGTM — restores cargo check --tests for the two crates broken by the #35002 dead-code sweep and #34820, with a guard test to catch the class going forward.

What was reviewed

  • Verified the highway_memmem shim signature matches the extern "C" declaration in src/highway/lib.rs:7-12 and that the sole caller (bun_highway::memmem) guards empty needle / short haystack before dispatch, so windows(0) is unreachable.
  • Confirmed Expr::as_bool (src/ast/expr.rs:323) covers the same EBoolean | EBranchBoolean arms the removed get_boolean did.
  • Checked native_test_shims is #[cfg(test)]-gated in src/parsers/lib.rs:11-12 (bench-only otherwise), so nothing ships.
  • The new guard test now mirrors test/internal/linear-fifo.test.ts's two-part workspaceReady check and uses stdout: "ignore"; all earlier inline feedback and CodeRabbit findings are addressed or withdrawn.
Extended reasoning...

Overview

Four files touched, all confined to test-only surfaces:

  • src/parsers/json.rs — one call site inside #[cfg(test)] mod tests swaps the removed Expr::get_boolean(&root, b"private") for the live root.get(b"private").and_then(|e| e.as_bool()).
  • src/parsers/native_test_shims.rs — adds a pure-Rust #[no_mangle] highway_memmem shim next to the existing highway_index_of_char / highway_index_of_any_char shims; the module is included only under #[cfg(test)] (lib.rs:11-12) and by the bench target.
  • src/sys/file.rs — module-level doc comment reworded to stop referencing the removed File::stderr(); #[cfg(test)] fn dropping_stdio_is_safe now wraps stderr via File::from_fd(Fd::stderr()) and asserts fstat(Fd::stderr()).is_ok() alongside stdout.
  • test/internal/rust-tests-compile.test.ts — new guard test spawning cargo check -p bun_parsers -p bun_sys --tests --keep-going, skipped if cargo or the workspace prerequisites (codegen dir, vendor/lolhtml) are absent.

Security risks

None. No shipped-binary code changes: every Rust hunk is either a doc comment or behind #[cfg(test)], and the shim module is gated the same way. The new TS test spawns cargo locally with no network access and no untrusted input.

Level of scrutiny

Low. This is developer-tooling / test-infra maintenance recovering from a mechanical dead-code sweep. The robobun evidence in the PR body demonstrates the test fails on unpatched main (E0599 for both crates) and passes with the fix, on both ASAN-debug and release. The shim signature matches the extern declaration byte-for-byte, and the replacement APIs (as_bool, File::from_fd(Fd::stderr())) exist and preserve the original coverage.

Other factors

Three rounds of prior feedback are all resolved: my earlier inline comments (stderr coverage, lolhtml skip guard, undrained stdout pipe) were each addressed in bc406ca / 5ce0a97; CodeRabbit's four findings were either applied (stderr fstat assertion, 930c7fd) or withdrawn after the author's rebuttal (empty-needle guard, comment verbosity, link-time guard). The new test follows the sibling linear-fifo.test.ts pattern for skip-guarding cargo-workspace tests. No CODEOWNERS-sensitive paths, no design decisions, no outstanding threads.

@robobun

robobun commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator Author

Closing: all three breakages this PR fixes are gone on main. #36184 updated the #[cfg(test)] code in src/parsers/json.rs and src/sys/file.rs (neither references Expr::get_boolean or File::stderr() any more), and #37052 added the highway_memmem shim (plus the rest of the highway shims) to src/parsers/native_test_shims.rs. This PR's test/internal/rust-tests-compile.test.ts (cargo check -p bun_parsers -p bun_sys --tests) passes unmodified against current main (04148c8), twice in a row. The guard test itself is not on main.

@robobun robobun closed this Aug 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant