Skip to content

Remove dead peechy schema scaffolding, bun-wasm, and write-only option types - #37068

Merged
Jarred-Sumner merged 1 commit into
mainfrom
claude/peechy-schema-cleanup-ad2088
Aug 6, 2026
Merged

Jarred-Sumner merged 1 commit into
mainfrom
claude/peechy-schema-cleanup-ad2088

Conversation

@dylan-conway

Copy link
Copy Markdown
Member

What does this PR do?

Deletes legacy code left over from the old peechy-schema / bun-wasm effort that never shipped. Nothing generates code from the .peechy files anymore — the Rust structs and the checked-in JS decoder have both diverged from them — and packages/bun-wasm has had no build path since the Makefile was removed, so all of it was dead weight that made the option types look like a wire format they no longer are.

  • Removes packages/bun-wasm/, src/api/schema.peechy, src/analytics/schema.peechy, and the src/api npm scaffolding.
  • Inlines the three small analytics enums into bun_analytics and reuses bun_core::Environment::ARCH instead of a duplicate Architecture enum.
  • Drops option plumbing that was only ever written, never read: ResolveMode, CssInJsBehavior, LoadedEnvConfig/Env::to_api, the never-populated Env.defaults list and the framework-defaults half of copy_env_for_define, NpmRegistry::dupe, the SourceMap/Packages aliases, and bun_core::schema.
  • Removes comments promising a future peechy codegen pass.

No behavior change intended. Follow-ups (separate PRs): switch the dev-mode error page payload from the peechy binary encoding to JSON (which also lets src/api/schema.js and the peechy npm dep go), and collapse the schema::api mirror enums (Loader/Target/SourceMapMode/…) onto their real counterparts.

How did you verify your code works?

Debug build + cargo clippy --workspace; cross-checked bun_analytics/bun_crash_handler for linux-gnu, linux-musl, windows, freebsd and android targets. Drove bun-debug through each touched surface and confirmed identical output to before: bun build --env=inline|PUBLIC_*|disable, --define, --sourcemap, --packages, multi-entry --splitting, bun exec, bun run (shell), .npmrc scoped registry (request hit the scoped URL with its token), /bun:info, the development: true error page, and the crash-report platform line. test/bundler/bundler_env.test.ts passes.

…n types

The `.peechy` schema files and the `packages/bun-wasm` package are leftovers
from an unshipped project: nothing generates code from the schemas anymore
(the Rust and JS sides have both diverged from them), and bun-wasm has had no
build path since the Makefile went away.

- Delete `packages/bun-wasm/`, `src/api/schema.peechy`,
  `src/analytics/schema.peechy`, and the `src/api` npm scaffolding.
- Inline the three tiny analytics enums into `bun_analytics` (dropping the
  never-constructed `None` variants) and reuse `bun_core::Environment::ARCH`
  instead of a duplicate `Architecture` enum.
- Drop option types that were only ever written, never read: `ResolveMode`
  / `TransformOptions.resolve`, `CssInJsBehavior` / the printer's
  `css_import_behavior`, `LoadedEnvConfig` / `Env::to_api`, the never-populated
  `Env.defaults` list and the framework-defaults allowlist plumbing in
  `copy_env_for_define`, `NpmRegistry::dupe`, the `SourceMap`/`Packages` type
  aliases, and the empty `bun_core::schema` module.
- Remove comments promising a future peechy codegen pass.

No behavior change: `bun build --env`, `--define`, `--sourcemap`, `--packages`,
`.npmrc` scoped registries, `/bun:info`, the dev-mode error page and the crash
report platform line all produce the same output as before.
@coderabbitai

coderabbitai Bot commented Aug 6, 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: e8976784-7995-4873-9806-aa4c9183e592

📥 Commits

Reviewing files that changed from the base of the PR and between d18ddfc and 159cd1f.

⛔ Files ignored due to path filters (2)
  • packages/bun-wasm/bun.lock is excluded by !**/*.lock
  • src/api/bun.lock is excluded by !**/*.lock
📒 Files selected for processing (30)
  • .aikido
  • .gitignore
  • packages/bun-wasm/index.ts
  • packages/bun-wasm/package.json
  • packages/bun-wasm/test/node.mjs
  • packages/bun-wasm/tsconfig.json
  • src/analytics/lib.rs
  • src/analytics/schema.peechy
  • src/analytics/schema.rs
  • src/api/.gitignore
  • src/api/lib.rs
  • src/api/package.json
  • src/api/schema.peechy
  • src/bun_core/lib.rs
  • src/bundler/defines.rs
  • src/bundler/lib.rs
  • src/bundler/options.rs
  • src/bundler/transpiler.rs
  • src/crash_handler/lib.rs
  • src/dotenv/env_loader.rs
  • src/ini/lib.rs
  • src/js_printer/lib.rs
  • src/options_types/schema.rs
  • src/runtime/bake/bake_body.rs
  • src/runtime/cli/Arguments.rs
  • src/runtime/cli/exec_command.rs
  • src/runtime/cli/run_command.rs
  • src/runtime/jsc_hooks.rs
  • src/runtime/server/server_body.rs
  • src/sys/copy_file.rs
💤 Files with no reviewable changes (19)
  • src/api/.gitignore
  • src/runtime/cli/exec_command.rs
  • packages/bun-wasm/test/node.mjs
  • src/api/package.json
  • packages/bun-wasm/tsconfig.json
  • .gitignore
  • src/analytics/schema.peechy
  • src/analytics/schema.rs
  • src/runtime/bake/bake_body.rs
  • src/runtime/cli/run_command.rs
  • src/bun_core/lib.rs
  • src/js_printer/lib.rs
  • .aikido
  • packages/bun-wasm/package.json
  • src/runtime/jsc_hooks.rs
  • packages/bun-wasm/index.ts
  • src/bundler/transpiler.rs
  • src/api/schema.peechy
  • src/bundler/lib.rs

Walkthrough

The PR removes the Bun WASM package and legacy schema files. It adds local analytics platform types, simplifies environment define handling, removes CSS printer configuration, and updates runtime consumers for renamed options and platform data.

Changes

Schema and runtime cleanup

Layer / File(s) Summary
Local platform types and consumers
src/analytics/lib.rs, src/crash_handler/lib.rs, src/runtime/server/server_body.rs
Analytics now owns OperatingSystem and Platform types without architecture data. Crash handling and server metadata use the updated types and architecture source.
Environment define model
src/bundler/defines.rs, src/bundler/options.rs
Environment configuration no longer stores framework defaults. Define copying filters environment entries and writes them directly to UserDefinesArray.
API schema and runtime option updates
src/api/*, src/bun_core/lib.rs, src/options_types/schema.rs, src/runtime/cli/*, src/runtime/jsc_hooks.rs, src/runtime/bake/bake_body.rs, src/dotenv/env_loader.rs, src/ini/lib.rs, src/sys/copy_file.rs
Legacy API schema surfaces are removed. CLI parsing uses renamed package and sourcemap enums. Runtime paths no longer force lazy resolve mode.
CSS printer option removal
src/js_printer/lib.rs, src/bundler/options.rs, src/bundler/transpiler.rs
css_import_behavior and its printer configuration plumbing are removed.
Removed generated package surfaces
.aikido, .gitignore, packages/bun-wasm/*, src/api/package.json, src/analytics/schema.*
Bun WASM integration, package metadata, generated artifacts, and legacy analytics/API schemas are deleted or no longer ignored.

Possibly related PRs

  • oven-sh/bun#35954: Refactors environment define handling in the same bundler environment logic.
  • oven-sh/bun#35978: Removes obsolete printer options across overlapping printer and transpiler code.

Suggested reviewers: robobun

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description check ✅ Passed The description includes both required sections and clearly explains the changes and verification performed.
Title check ✅ Passed The title clearly and concisely summarizes the removal of legacy schema scaffolding, bun-wasm, and unused option types.
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.

I didn't find any bugs, but this is a 32-file dead-code removal touching bundler options, CLI arg parsing, analytics, and the crash handler, so it's worth a human look.

What was reviewed:

  • Traced the copy_env_for_define rewrite: Env.defaults was never populated (only EnvList::default()), so the removed framework-defaults path and any_prefix_match gate were dead; the simplified loop is behavior-equivalent for both Prefix and LoadAll modes.
  • Verified /bun:info arch output is unchanged on shipped targets: bun_core::Environment::ARCH maps x64→"x64" and aarch64→"arm", matching the old PLATFORM_ARCH values.
  • Confirmed no remaining readers of ResolveMode, CssInJsBehavior, css_import_behavior, api::SourceMap/api::Packages aliases, bun_core::schema, or NpmRegistry::dupe (the ini caller now uses .clone(), which dupe already delegated to).
  • Checked for_os() still covers every supported target after the fallback arm was dropped; unsupported targets now fail at compile time instead of returning OperatingSystem::None.
Extended reasoning...

Overview

Dead-code removal across 32 files: deletes packages/bun-wasm/ (no build path since the Makefile was removed), the two .peechy schema files and their npm scaffolding, and prunes write-only option-type plumbing (ResolveMode, CssInJsBehavior, LoadedEnvConfig/Env::to_api, Env.defaults, NpmRegistry::dupe, the SourceMap/Packages type aliases, bun_core::schema). The analytics OperatingSystem/Platform types are inlined into bun_analytics and Platform.arch is dropped in favor of the compile-time bun_core::Environment::ARCH const.

Security risks

None. This is deletion of unused types, unbuildable packages, and comment cleanup. No parsing of untrusted input is added or changed; no auth/crypto/TLS paths are touched.

Level of scrutiny

Medium-high. Most of the diff is pure deletion (peechy files, bun-wasm, type aliases, comments), but two pieces need reasoning:

  1. The copy_env_for_define rewrite in src/bundler/defines.rs collapses ~60 lines to ~20 by removing the framework-defaults branch. I traced that Env.defaults was only ever EnvList::default() (never written to), so framework_defaults_keys/values were always empty at the sole call site, making every removed branch dead. The any_prefix_match pre-scan gate is also gone, but with empty defaults its only effect was skipping an already-no-op loop.
  2. The analytics Platform refactor drops the arch field and the None OS variant. /bun:info now reads bun_core::Environment::ARCH (compile-time const) instead of the runtime-populated platform.arch — output strings are identical on x64/aarch64. for_os() loses its catch-all arm, so an unsupported target now fails to compile rather than reporting _none.

Other factors

The PR description documents thorough manual verification (bun build --env=*, --define, --sourcemap, --packages, bun exec, bun run, .npmrc scoped registries, /bun:info, the dev error page, crash-report platform line) plus cross-target clippy for linux-gnu/musl/windows/freebsd/android. The bug hunting system found nothing. I'm deferring rather than approving because 32 files across bundler/CLI/analytics/crash-handler is enough surface area that a maintainer should confirm the "never populated" claims (particularly Env.defaults) match their understanding of the codebase history.

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