Skip to content

chore: remove stale 'cfg-gated'/'un-gate'/'blocked_on' port-era comments - #32519

Merged
Jarred-Sumner merged 13 commits into
mainfrom
farm/698576e0/stale-cfg-gated-cleanup
Jun 20, 2026
Merged

chore: remove stale 'cfg-gated'/'un-gate'/'blocked_on' port-era comments#32519
Jarred-Sumner merged 13 commits into
mainfrom
farm/698576e0/stale-cfg-gated-cleanup

Conversation

@robobun

@robobun robobun commented Jun 20, 2026

Copy link
Copy Markdown
Collaborator

What

Cleans up comments left behind from the incremental Zig→Rust port that claim code is "cfg-gated", "blocked_on X", or "will un-gate when Y lands", where X/Y have since landed and the claim is no longer true. Also collapses a handful of local shims whose only justification was one of those stale comments.

Before: 158 such markers across 87 files.
After: 8 remaining, all of which accurately describe real platform/feature #[cfg(...)] gating (macOS/Windows image clipboard, POSIX/Windows stdio alias, WASM timer selection, Win32 x64 callconv extern blocks, debug-assertions context, the #[cfg(any())] Win32Error table handled by #31995).

Shims collapsed into canonical impls

  • src/runtime/cli/repl.rs: removed global_clear_exception, global_to_js_value, vm_set_execution_forbidden, vm_mut (48 lines). Comment claimed "the canonical impls live in cfg-gated JSGlobalObject.rs / VM.rs (see src/jsc/lib.rs `_gated`)"; no _gated module exists and JSGlobalObject::clear_exception / ::to_js_value, VM::set_execution_forbidden, VirtualMachine::as_mut are all public and un-gated. 25 call sites rewired.
  • src/standalone_graph/StandaloneModuleGraph.rs: replaced hand-inlined open+mkdir+retry with bun_sys::File::make_open. Comment claimed "src/sys/File.rs is still cfg-gated upstream"; make_open is public at src/sys/file.rs:112 and already used from build_command.rs.
  • src/js_parser/visit/mod.rs: removed local stmts_to_single_stmt_ (duplicate of P::stmts_to_single_stmt). Comment claimed it was "``-gated (P.rs:6267, blocked on S::Block Default)".
  • src/js_parser/lower/lower_esm_exports_hmr.rs: removed local generate_temp_ref (duplicate of P::generate_temp_ref). Comment claimed "P::generate_temp_ref is ``-gated in P.rs (round-6 re-gate)".
  • src/js_parser/visit/mod.rs: removed dead let _ = &mut j; keep-alive whose comment said "keep 'outer label live until #[cfg] un-gates".
  • src/css/selectors/selector.rs: removed two dead let _ = arguments; lines after real arguments.to_css_raw(dest)? calls.

Comments rewritten or deleted

The rest are comment-only changes removing port-progress narrative ("cycle-5", "round-D/E/G/H", "phase-c/d", "tier-0", "reconciler-6 re-gate", "`` gates carry blocked_on notes") and stale blocker lists that name dependencies which now exist. Where a comment carried useful non-port information (aliasing rationale, init-order invariants, layering notes), that part is kept; only the stale gating claim is removed.

A few blocked_on comments in src/css/ described genuinely incomplete code (e.g. Property::longhand's no-op lh() stub, the CSS-modules ref-arm in selector_has_composes_for_property); those were reworded to plain TODOs rather than deleted.

Verification

cargo check --workspace              # clean
bun run rust:check-all                # 10/10 targets ok
bun bd test test/js/bun/repl/repl.test.ts         # 117 pass
bun bd test test/js/bun/util/csrf.test.ts         # 24 pass
bun bd test test/bundler/esbuild/css.test.ts      # 53 pass
bun bd test test/bundler/css/css-modules.test.ts  # 4 pass
bun bd test test/bake/dev/bundle.test.ts          # 20 pass

80 files changed, +171/-796.

…nts and collapse their shims

These comments were left behind from the incremental Zig->Rust port,
claiming code was cfg-gated or blocked on dependencies that have since
landed. 150 of 158 such markers were verified stale and removed; the
remaining 8 accurately describe real platform/feature #[cfg(...)] gating.

Shims that existed only because their comment claimed the canonical
impl was gated are collapsed into the canonical:

  repl.rs: global_clear_exception/global_to_js_value/
    vm_set_execution_forbidden/vm_mut -> JSGlobalObject/VM/VirtualMachine
    inherent methods
  StandaloneModuleGraph.rs: inlined open+mkdir+retry -> bun_sys::File::make_open
  js_parser/visit/mod.rs: local stmts_to_single_stmt_ -> P::stmts_to_single_stmt
  js_parser/lower/lower_esm_exports_hmr.rs: local generate_temp_ref ->
    P::generate_temp_ref
  css/selectors/selector.rs: dead 'let _ = arguments;' after real to_css_raw
@robobun

robobun commented Jun 20, 2026

Copy link
Copy Markdown
Collaborator Author
Updated 10:42 PM PT - Jun 19th, 2026

@robobun, your commit 5f3539bf6bb62380d5160b1aabcddf1c8ff8add5 passed in Build #63565! 🎉


🧪   To try this PR locally:

bunx bun-pr 32519

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

bun-32519 --bun

@coderabbitai

coderabbitai Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

This PR removes hundreds of stale // blocked_on:, "(gated)", "un-gated", and related port-era comment markers across CSS, JS parser, bundler, JSC, and runtime modules. Alongside the comment cleanup, it inlines previously gated CSS leaf implementations (Url, CustomIdent, DashedIdentReference) into custom.rs, removes REPL FFI shims in favor of direct VM/JSGlobal method calls, flattens JS visitor wrapper blocks, adds public node::zlib re-exports, simplifies StandaloneModuleGraph file-open logic, and introduces a test suite to prevent port-era marker reintroduction.

Changes

Incremental un-gating cleanup with targeted functional completions

Layer / File(s) Summary
CSS: inline Url/CustomIdent/DashedIdentReference and CssColorParseResult
src/css/properties/custom.rs, src/css/lib.rs, src/css/declaration.rs, src/css/rules/mod.rs, src/css/selectors/selector.rs
Inlines previously external-gated Url::parse, Url::to_css, DashedIdentReference forwarders, and CustomIdent::to_css into a local mod ext in custom.rs. Adds CssColorParseResult type alias in lib.rs. Updates CSS Modules composes warning in declaration.rs to emit structured notes via warn_fmt_with_notes. Refactors custom_ident_to_css in rules/mod.rs to compute an enabled flag from dest.css_module and pass it to write_ident; restructures .style minify arm to call minify_style_arm directly. Updates is_selector_unused in selectors/selector.rs to directly resolve identifiers via as_original_string(symbols).
REPL: remove local FFI shims, call VM/JSGlobal APIs directly
src/runtime/cli/repl.rs
Removes locally defined shims (global_clear_exception, global_to_js_value, vm_set_execution_forbidden, vm_mut) and rewires all call sites in evaluate_and_print, eval_script, evaluate_raw, evaluate_and_copy, transform_for_repl, print_js_error_to, tab completion, and Unix SIGINT handling to use vm.as_mut().wait_for_promise(...), vm.as_mut().tick(), vm.as_mut().auto_tick_active(), vm.jsc_vm().set_execution_forbidden(...), global.to_js_value(), and global.clear_exception() directly.
JS parser: flatten visitor wrappers, remove stmts_to_single_stmt_ helper, delegate generate_temp_ref
src/js_parser/visit/mod.rs, src/js_parser/lower/lower_esm_exports_hmr.rs, src/js_parser/p.rs
Removes cfg-gated wrapper blocks around replace_decl_and_possibly_remove in visit_decls, calling the method directly via BackRef::get(). Deletes the local stmts_to_single_stmt_ helper and updates its two call sites to self.stmts_to_single_stmt. Replaces the file-local generate_temp_ref free function with p.generate_temp_ref at both HMR call sites. Adds an early use crate::renamer; import.
JSC: JSValue::call debug bookkeeping and VirtualMachine initialization
src/jsc/JSValue.rs, src/jsc/VirtualMachine.rs
Adds a #[cfg(debug_assertions)] block in JSValue::call to track VM debug state (js_call_count_outside_tick_queue, last_fn_name) before invoking host_fn::from_js_host_call. Simplifies initialization comments around Zig__GlobalObject__create re-entry constraints.
StandaloneModuleGraph file-open simplification and node::zlib re-exports
src/standalone_graph/StandaloneModuleGraph.rs, src/runtime/node.rs
Replaces manual Syscall::openat + mkdir-parent + retry with a single bun_sys::File::make_open call that logs a formatted error on failure and breaks the dump scope. Adds public re-exports for native_brotli, native_zlib, native_zstd, and bun_zlib::NodeMode in node::zlib.
Test suite: port-era marker detection and prevention
test/internal/port-era-markers.test.ts
Introduces a Bun test suite that scans all Rust source files under src/**/*.rs for reintroduced port-era comment jargon (blocked_on, un-gated, un-gate, gated, re-gated, ungated). Registers one test per banned pattern that fails if any occurrences are found, displaying sample locations (up to 20 examples per marker).
Stale comment and gating-scaffolding removal across CSS, bundler, parser, JSC, and runtime
src/css/..., src/bundler/..., src/js_parser/..., src/jsc/..., src/runtime/..., and others
Removes or rewrites stale // blocked_on:, "(gated)", "un-gated", and transitional scaffolding comments across ~60 files without changing executable logic, public API signatures, or control flow.

Suggested reviewers

  • dylan-conway
  • alii
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: removing stale port-era comments claiming code was 'cfg-gated', 'blocked_on', or 'un-gated'.
Description check ✅ Passed The description comprehensively documents what was changed, why it was necessary, which shims were collapsed, verification steps performed, and acknowledges relationship with other work.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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

@github-actions

Copy link
Copy Markdown
Contributor

This PR may be a duplicate of:

  1. Purge remaining port-batch markers missed by the phase cleanup #30885 - Also removes stale port-era batch/phase markers (cycle-5, reconciler-6, round-D/E/G/H, phase-c/d) from many of the same files

🤖 Generated with Claude Code

…gated comments

Adds test/internal/port-era-markers.test.ts which scans src/**/*.rs for
port-era comment jargon (blocked_on, un-gate, un-gates, un-gated, ungated,
re-gated, empty-backtick-gated) that this PR drove to zero, preventing
reintroduction.

Also fixes the last 7 occurrences the test flagged: five empty-backtick
'-gated' comments in timer/mod.rs, jsc_hooks.rs, RequestContext.rs,
css/rules/mod.rs, css_jsc/lib.rs, plus rewords util.rs spawn_ffi and
sys/windows Win32Error comments.
Comment thread src/jsc/JSValue.rs
Comment thread src/js_parser/visit/mod.rs Outdated
Comment thread src/js_parser/p.rs Outdated
@robobun

robobun commented Jun 20, 2026

Copy link
Copy Markdown
Collaborator Author

Re: duplicate flag for #30885: that PR targets a different set of port-batch markers (Round-[A-H], cycle-5, phase-c/d, reconciler-6, B-0/B-3). This one targets the gating-jargon markers (blocked_on, un-gate(s|d), re-gated, \`-gated) and additionally collapses the local shims those comments justified (repl.rs FFI wrappers, inlined make_open, duplicated stmts_to_single_stmt/generate_temp_ref). There is minor file-set overlap because both kinds of jargon live in the same files, but the patterns are complementary; whichever lands first, the other rebases cleanly over the comment hunks. Added test/internal/port-era-markers.test.ts` to keep this set at zero.

autofix-ci Bot and others added 2 commits June 20, 2026 02:30
…note, and CSS-modules ref-arm in is_selector_unused

Replaces the three TODO markers flagged by diff hygiene with real code:

- JSValue::call: debug-build event-loop bookkeeping
  (js_call_count_outside_tick_queue / last_fn_name), matching JSValue.zig
  and the existing JSPromise.rs resolve/reject pattern.
- css/declaration.rs: wire the secondary location note for
  ComposesState::DisallowNotSingleClass via warn_fmt_with_notes,
  matching declaration.zig.
- css/selectors/selector.rs: resolve CSS-modules symbol refs in
  is_selector_unused via IdentOrRef::as_original_string instead of
  skipping them.
Comment thread src/css/rules/mod.rs
Comment thread src/css/css_parser.rs Outdated
Comment thread src/css/rules/font_face.rs Outdated

@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: 1

🤖 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/jsc/JSValue.rs`:
- Around line 1644-1654: The debug block uses the `?` operator on
`self.get_name(global)` when setting `loop_.debug.last_fn_name`, which can cause
an early return from the `call()` method in debug builds while the same code
path does not exist in release builds. This creates inconsistent behavior
between debug and release builds where debug builds may fail while release
builds succeed. Remove the `?` operator from the `self.get_name(global)?` call
and instead handle the error by either ignoring it (letting the assignment be
skipped if it fails) or providing a sensible fallback value (such as a default
string). This ensures debug instrumentation does not alter the observable
control flow behavior of the function.
🪄 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: 495c1bb0-8b83-4adc-9894-6a9437cfb466

📥 Commits

Reviewing files that changed from the base of the PR and between 6778d95 and d9d11cb.

📒 Files selected for processing (3)
  • src/css/declaration.rs
  • src/css/selectors/selector.rs
  • src/jsc/JSValue.rs

Comment thread src/jsc/JSValue.rs
…s; swallow get_name error in debug bookkeeping

- De-nest four redundant '{ }' blocks left behind after removing
  blocked_on comments (FontFace/Keyframes arms, composes_state if-block,
  CustomFunction tail).
- Remove two orphaned bare '//' separator lines in font_face.rs that
  rustfmt does not strip.
- Trim custom_ident_to_css doc comment which still claimed write_ident
  was gated.
- JSValue::call debug bookkeeping: swallow get_name error via 'if let Ok'
  so debug instrumentation does not short-circuit ahead of the actual
  call; any pending exception from get_name is still surfaced by the
  subsequent from_js_host_call.
Comment thread src/jsc/JSValue.rs
Comment thread test/internal/port-era-markers.test.ts
Comment thread src/css/rules/import.rs
…ailing comment; make marker lint case-insensitive and sweep 9 capitalized instances

- JSValue::call: read debug flags and drop the &mut EventLoop borrow
  before calling get_name (which may re-enter JS), then re-borrow to
  assign last_fn_name, per the event_loop_mut() contract.
- css/rules/import.rs: delete orphaned 'silence unused-import warnings
  on the gated bodies' deps' trailer at EOF.
- test/internal/port-era-markers.test.ts: add /i flag to all patterns;
  show flags in test names.
- Sweep 9 capitalized Un-gate/Un-gated/Re-gated comments the
  case-sensitive grep missed (css_parser.rs, media_query.rs, webcore.rs,
  timer_object_internals.rs, node_fs.rs, AnyRequestContext.rs,
  spawn/process.rs, H2Client.rs, ini/lib.rs).

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
test/internal/port-era-markers.test.ts (1)

57-68: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Scope matching to comment text to avoid false-positive lint failures.

Line 63 applies banned regexes to every Rust line, but this test’s contract is “comment jargon.” That can fail on legitimate code/string content containing these tokens. Restrict matching to comment lines before running the banned patterns.

Suggested patch
 for (const abs of rustSources) {
   const rel = path.relative(root, abs);
   const content = await file(abs).text();
   const lines = content.split("\n");
   for (const { pattern } of banned) {
     for (let i = 0; i < lines.length; i++) {
-      if (pattern.test(lines[i])) {
+      const line = lines[i];
+      // Lint intent is stale marker jargon in comments.
+      if (!line.includes("//")) continue;
+      if (pattern.test(line)) {
         hits[pattern.source].push(`${rel}:${i + 1}`);
       }
     }
   }
 }
🤖 Prompt for 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.

In `@test/internal/port-era-markers.test.ts` around lines 57 - 68, The banned
pattern matching in the nested loop is applying regexes to every line of Rust
source code, causing false positives when pattern tokens appear in legitimate
code or strings. Modify the line-by-line iteration to first filter for comment
lines only (lines that contain Rust comments starting with //) before testing
against the banned patterns. Add a condition to check if the current line is a
comment before executing the pattern.test(lines[i]) call, so the banned patterns
are only matched against actual comment text.
🤖 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.

Outside diff comments:
In `@test/internal/port-era-markers.test.ts`:
- Around line 57-68: The banned pattern matching in the nested loop is applying
regexes to every line of Rust source code, causing false positives when pattern
tokens appear in legitimate code or strings. Modify the line-by-line iteration
to first filter for comment lines only (lines that contain Rust comments
starting with //) before testing against the banned patterns. Add a condition to
check if the current line is a comment before executing the
pattern.test(lines[i]) call, so the banned patterns are only matched against
actual comment text.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: a8e47871-b353-41da-9d45-3240639ed171

📥 Commits

Reviewing files that changed from the base of the PR and between 1e7f605 and 1c0b43b.

📒 Files selected for processing (12)
  • src/css/css_parser.rs
  • src/css/media_query.rs
  • src/css/rules/import.rs
  • src/http/H2Client.rs
  • src/ini/lib.rs
  • src/jsc/JSValue.rs
  • src/runtime/node/node_fs.rs
  • src/runtime/server/AnyRequestContext.rs
  • src/runtime/timer/timer_object_internals.rs
  • src/runtime/webcore.rs
  • src/spawn/process.rs
  • test/internal/port-era-markers.test.ts
💤 Files with no reviewable changes (7)
  • src/http/H2Client.rs
  • src/ini/lib.rs
  • src/spawn/process.rs
  • src/runtime/server/AnyRequestContext.rs
  • src/css/css_parser.rs
  • src/runtime/webcore.rs
  • src/css/rules/import.rs

Comment thread src/css/lib.rs
… doc, zlib NodeMode re-export, masking FillRule import)
Comment thread src/css/declaration.rs
…notes and two more stale 'gated' comments in timer/mod.rs
Comment thread src/css/lib.rs
Comment thread src/runtime/ffi/host_fns.rs
…se host_fns.rs get_own shim

- Collapse local JSC__JSValue__getOwn extern + get_own() wrapper in
  host_fns.rs into JSValue::get_own (the canonical, identical body).
- Drop or reword stale 'is/stays/still gated' / '(gated)' comments in
  css/rules/mod.rs (3 sites), resolver/lib.rs, bun_core/lib.rs,
  bundler/linker.rs, bundler/transpiler.rs, runtime/ffi/ffi_body.rs,
  runtime/jsc_hooks.rs.
- Remaining 'gated' occurrences in PR-edited files all describe real
  const-generic / #[cfg] / feature / runtime-conditional gating:
  http/lib.rs (SSL const-generic), install/lib.rs (shim_standalone
  feature), VirtualMachine.rs (0/1 transition), node_fs.rs (cfg(windows)
  and IS_U16 const-generic), Body.rs (require_array conditional).
@Jarred-Sumner
Jarred-Sumner merged commit 8841747 into main Jun 20, 2026
78 of 79 checks passed
@Jarred-Sumner
Jarred-Sumner deleted the farm/698576e0/stale-cfg-gated-cleanup branch June 20, 2026 06:22
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