Skip to content

Remove dead code from bun_semver and bun_semver_jsc - #35293

Merged
Jarred-Sumner merged 3 commits into
mainfrom
claude/farm/41bf3e90/dead-code-semver
Jul 23, 2026
Merged

Jarred-Sumner merged 3 commits into
mainfrom
claude/farm/41bf3e90/dead-code-semver

Conversation

@robobun

@robobun robobun commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

Dead-code sweep of the bun_semver / bun_semver_jsc crates. Net change: +1 / -53 lines.

Removed

  • src/semver_jsc/SemverString_jsc.rs (whole file): the SemverStringJsc extension trait is never imported. The only dependent of bun_semver_jsc is bun_runtime, whose sole reference is bun_semver_jsc::SemverObject::create. The one place that wants a bun_semver::String → JS conversion (src/install_jsc/dependency_jsc.rs) doesn't depend on bun_semver_jsc and has its own inline helper.
  • pub use bun_jsc::JsResult and pub use SemverString_jsc::SemverStringJsc from src/semver_jsc/lib.rs: no external references (rg 'bun_semver_jsc::JsResult|bun_semver_jsc::SemverStringJsc' src/ → 0 hits).
  • Unused Cargo dependencies in both src/semver/Cargo.toml and src/semver_jsc/Cargo.toml: strum, scopeguard, const_format, enum-map, enumset, libc, bitflags (7 each). None of these crate names, nor their macros/derives (bitflags!, defer!, formatcp, EnumSetType, EnumMap, c_int, etc.), appear in any .rs file under either crate.
  • Trimmed the stale doc comment in src/install_jsc/dependency_jsc.rs that referenced the deleted trait (and made a claim about stubbed JSC types that is no longer accurate).

Verification

  • rg across src/ and build/debug/codegen/ for every removed symbol and dep name: only definition-site hits.
  • cargo check -p bun_semver passes.
  • bun bd builds.
  • bun run rust:check-all passes on all 10 target triples.
  • bun bd test test/cli/install/semver.test.ts passes (28/28, covers Bun.semver which routes through bun_semver_jsc::SemverObject).

- Delete src/semver_jsc/SemverString_jsc.rs: the SemverStringJsc trait is
  never imported or used. The only would-be caller (install_jsc/dependency_jsc.rs)
  has its own inline helper.
- Drop the JsResult and SemverStringJsc re-exports from semver_jsc/lib.rs;
  nothing outside the crate references them.
- Remove 7 unused Cargo dependencies from each of bun_semver and
  bun_semver_jsc (strum, scopeguard, const_format, enum-map, enumset,
  libc, bitflags). None are referenced in any .rs file in either crate.
- Trim the stale doc comment in dependency_jsc.rs that referenced the
  deleted trait.
@coderabbitai

coderabbitai Bot commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: ef773782-6a22-4b03-8945-ac963bad98cf

📥 Commits

Reviewing files that changed from the base of the PR and between 892b1da and e1e412e.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (6)
  • src/install_jsc/dependency_jsc.rs
  • src/semver/Cargo.toml
  • src/semver/lib.rs
  • src/semver_jsc/Cargo.toml
  • src/semver_jsc/SemverString_jsc.rs
  • src/semver_jsc/lib.rs
💤 Files with no reviewable changes (5)
  • src/semver/Cargo.toml
  • src/semver_jsc/Cargo.toml
  • src/semver_jsc/SemverString_jsc.rs
  • src/semver_jsc/lib.rs
  • src/semver/lib.rs

Walkthrough

Changes

Semver JSC cleanup

Layer / File(s) Summary
Remove semver-string JSC bridge
src/semver_jsc/SemverString_jsc.rs, src/semver_jsc/lib.rs, src/semver/lib.rs
The SemverStringJsc bridge, its exports, the JsResult re-export, and related comments are removed.
Align dependencies and helper comments
src/semver/Cargo.toml, src/semver_jsc/Cargo.toml, src/install_jsc/dependency_jsc.rs
Workspace dependency entries are reduced to bstr, and the local helper comment is shortened.

Suggested reviewers: jarred-sumner

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: removing dead code from the bun_semver and bun_semver_jsc crates.
Description check ✅ Passed The description covers the change and verification, though it uses custom headings instead of the template's exact section titles.
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.

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

@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 — pure dead-code removal, verified the removed symbols and deps have no remaining references. The inline nit about the stale src/semver/lib.rs:544 comment is non-blocking.

What was reviewed:

  • Grepped src/ for SemverStringJsc, SemverString_jsc, bun_semver_jsc::JsResult — zero hits post-change; only consumer of bun_semver_jsc is BunObject.rs calling SemverObject::create.
  • Confirmed none of the 7 dropped Cargo deps (nor their macros/derives) appear in any .rs file under src/semver/ or src/semver_jsc/; all retained deps (bstr, bun_core, bun_jsc, bun_semver) are still referenced in SemverObject.rs.
  • Cargo.lock diff matches the two Cargo.toml edits exactly (no unrelated churn).
Extended reasoning...

Overview

Dead-code sweep of two small crates: deletes the unused SemverStringJsc extension trait file, removes two unused re-exports from src/semver_jsc/lib.rs, drops 7 unused workspace deps from each of src/semver/Cargo.toml and src/semver_jsc/Cargo.toml, trims a stale doc comment in src/install_jsc/dependency_jsc.rs, and regenerates Cargo.lock. Net +1/-53.

Security risks

None. This is subtractive only — no new code paths, no logic changes, no data handling. The one modified .rs file (dependency_jsc.rs) only shortens a doc comment.

Level of scrutiny

Low. Rust's compiler is the authoritative check here: if any removed symbol or dep were live, bun bd and rust:check-all (which the PR reports passing on all 10 targets) would fail. I independently confirmed via grep that SemverStringJsc / SemverString_jsc / bun_semver_jsc::JsResult have zero references in src/, that the only external use of bun_semver_jsc is SemverObject::create in BunObject.rs, and that none of the dropped crate names or their macros appear in either crate's source. The Cargo.lock hunk contains exactly the expected removals for bun_semver and bun_semver_jsc and nothing else.

Other factors

The bug hunter's one finding is a nit: a leftover migration breadcrumb comment at src/semver/lib.rs:544 now points at deleted code. It's the same class of cleanup this PR already did in dependency_jsc.rs, but it's comment-only, has no runtime effect, and lives in a file outside the diff — not worth blocking on. The PR description documents thorough verification (cargo check, bun bd, rust:check-all, semver.test.ts), and the change is small and mechanical enough that human review would add little.

Comment thread src/semver_jsc/lib.rs
The comment pointed readers at bun_semver_jsc for the String to_js bridge,
which the previous commit removed.

@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. Pure dead-code removal — the inline nit about the leftover breadcrumb at src/semver/lib.rs:11-12 is comment-only and non-blocking.

Extended reasoning...

Overview

Deletion-only sweep of bun_semver / bun_semver_jsc: removes the unused SemverStringJsc extension trait and its module, drops two dead re-exports from src/semver_jsc/lib.rs, prunes 7 unused Cargo deps from each crate (with matching Cargo.lock shrinkage), trims a stale doc comment in src/install_jsc/dependency_jsc.rs, and — after the prior review round — removes the stale toJS breadcrumb at src/semver/lib.rs:544. Net +1/-53.

Security risks

None. No executable logic is added or changed; every hunk is a deletion of an unused symbol, an unused dep entry, or a comment.

Level of scrutiny

Low. I re-verified the PR's dead-code claims: rg for SemverStringJsc|SemverString_jsc|bun_semver_jsc::JsResult across src/ → 0 hits; the sole external reference to bun_semver_jsc is bun_runtime's SemverObject::create call in BunObject.rs, which is untouched; and none of the removed dep names/macros appear in any .rs under either crate. The Cargo.lock diff exactly mirrors the two Cargo.toml edits. rust:check-all and bun bd passing per the description confirm no cfg-gated code depended on the removed items.

Other factors

The prior review comment (stale breadcrumb at line 544) was addressed in e03ffa6 and the thread is resolved. This run flagged one more sibling of the same class at src/semver/lib.rs:11-12 — a two-line comment-only nit that doesn't affect correctness and can be folded in before merge or left for a follow-up.

Comment thread src/semver/lib.rs
The comment claimed *_jsc extension traits live in bun_semver_jsc, but
the only such trait (SemverStringJsc) was removed earlier in this PR.

@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 — both prior nits (stale breadcrumb comments in src/semver/lib.rs) were addressed in e03ffa6 and e1e412e.

What was reviewed:

  • Confirmed SemverStringJsc / SemverString_jsc / bun_semver_jsc::JsResult have zero references in src/; the only remaining consumer of bun_semver_jsc is BunObject.rs calling SemverObject::create.
  • Confirmed none of the seven dropped Cargo deps (nor their macros — bitflags!, defer!, formatcp, EnumSetType, etc.) appear in any .rs file under src/semver/ or src/semver_jsc/.
  • Cargo.lock changes are exactly the dep removals for these two crates; no version drift elsewhere.
Extended reasoning...

Overview

Pure dead-code sweep of bun_semver / bun_semver_jsc: deletes the never-imported SemverStringJsc extension trait file, drops two unused re-exports from src/semver_jsc/lib.rs, removes seven unused workspace deps from each crate's Cargo.toml (with the corresponding Cargo.lock entries), and trims four stale migration-breadcrumb comments (one in dependency_jsc.rs, three in src/semver/lib.rs — the latter two added in follow-up commits after earlier review). Net +1/-53.

Security risks

None. This is deletion-only with no behavioral change; no user-facing surface, parsing, auth, or FFI is touched. The only executable-code change is removing an unreferenced trait impl.

Level of scrutiny

Low. The Rust compiler is the load-bearing safety net here — a missing dep or a still-referenced symbol would fail cargo check / bun bd, and the PR reports bun run rust:check-all passing on all 10 target triples plus bun bd test test/cli/install/semver.test.ts (which exercises SemverObject::create, the one live path in bun_semver_jsc). I independently verified via grep that (a) no reference to SemverStringJsc, SemverString_jsc, or bun_semver_jsc::JsResult exists anywhere under src/, (b) the sole external reference to bun_semver_jsc is bun_runtime's SemverObject::create call, and (c) none of the seven removed deps or their derive/macro names appear in any .rs file under either crate.

Other factors

Both of my prior inline comments (stale toJS breadcrumb at lib.rs:544 and the SemverObject re-export breadcrumb at lib.rs:11-12) were addressed and resolved; the author also swept for remaining siblings and noted the one unrelated deinit/Drop breadcrumb in SemverQuery.rs is still accurate. The Cargo.lock hunk contains only the two bun_semver* package entries with the seven deps removed from each — no unrelated churn. No outstanding reviewer comments.

@robobun

robobun commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator Author

CI on build 78744: the 5 red tests (proxy-stress-protocol, bun-info, no-orphans, filter-workspace, bun-security-scanner-matrix-with-node-modules) are all tagged flaky-on-main by ci:errors and none touch semver. This diff is deletion-only (comments, unused Cargo deps, an unreferenced trait file) with no runtime behavior change; test/cli/install/semver.test.ts passes locally (28/28) and rust:check-all is green on all 10 targets.

@Jarred-Sumner
Jarred-Sumner merged commit f133f9d into main Jul 23, 2026
54 of 55 checks passed
@Jarred-Sumner
Jarred-Sumner deleted the claude/farm/41bf3e90/dead-code-semver branch July 23, 2026 21:31
robobun added a commit that referenced this pull request Jul 24, 2026
Brings in #35002 (remove ~39k lines of dead Rust) and its follow-ups
(#35019, #35052, #35152, #35225, #35293, #35326). The binary-size
check compares against current main; this branch was 137 commits
behind, so it still carried the dead code main dropped and registered
as +630KB..+1.7MB on x64 while aarch64 linux showed -513KB/-601KB
(different dead-code elimination outcomes per target). This stack's
own native contribution is 19 files / +392 -45 lines; src/js is
net -977 lines (domain.ts +692 vs fast-utf8-stream.ts -856 etc).

Also: drop the hoisted pbkdf2 .bind handlers back to closures (review
nit), and take main's expectations.txt since #34741 audited the stale
ASAN entries.
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.

2 participants