Skip to content

refactor(lexer): group coalesce pipeline stage code into directory - #26305

Draft
overlookmotel wants to merge 1 commit into
om/09-03-refactor_lexer_split_carve_pipeline_stage_into_multiple_filesfrom
om/09-03-refactor_lexer_group_coalesce_pipeline_stage_code_into_directory
Draft

refactor(lexer): group coalesce pipeline stage code into directory#26305
overlookmotel wants to merge 1 commit into
om/09-03-refactor_lexer_split_carve_pipeline_stage_into_multiple_filesfrom
om/09-03-refactor_lexer_group_coalesce_pipeline_stage_code_into_directory

Conversation

@overlookmotel

@overlookmotel overlookmotel commented Sep 3, 2026

Copy link
Copy Markdown
Member

Pure refactor. No code changes, just moving code around.

Move all code for coalesce pipeline stage into a directory together.

coalesce/mod.rs contains same code as coalesce.rs did previously. keyword.rs moves into the same directory, since kw_verify_batch is only used in coalesce stage.

Additionally, apply the same kinds of stylistic changes as #26303.

Copy link
Copy Markdown
Member Author

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent changes, fast-track this PR to the front of the merge queue

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions github-actions Bot added the A-lexer Area - Lexer label Sep 3, 2026
@overlookmotel
overlookmotel marked this pull request as ready for review September 3, 2026 20:03
Copilot AI lite review requested due to automatic review settings September 3, 2026 20:03
@overlookmotel overlookmotel self-assigned this Sep 3, 2026
@overlookmotel
overlookmotel marked this pull request as draft September 3, 2026 20:05

Copilot AI 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.

🔵 Needs a closer look

The refactor widens internal symbol visibility (pub) in the coalesce stage in ways that don’t match existing pipeline conventions and could unintentionally expand the reachable API surface later.

Pull request overview

This PR refactors the lexer pipeline by regrouping the coalesce stage implementation into a dedicated coalesce/ module directory, mirroring the earlier classify stage refactor approach and applying similar “house style” organization changes.

Changes:

  • Move coalesce stage code into pipeline/coalesce/ with a new mod.rs entry point.
  • Relocate kw_verify_batch / KWB keyword verification code into pipeline/coalesce/keywords.rs and update imports accordingly.
  • Apply minor structural/style re-ordering in the moved code (imports grouped, helpers moved lower, etc.).
File summaries
File Description
crates/oxc_lexer/src/pipeline/mod.rs Updates stage wiring/imports to pull KWB from the coalesce module instead of the old keywords module.
crates/oxc_lexer/src/pipeline/coalesce/mod.rs New coalesce stage module entry point; hosts the stage logic and pulls keyword verification from a local submodule.
crates/oxc_lexer/src/pipeline/coalesce/keywords.rs Keyword verification implementation moved under coalesce/; adjusts paths and visibility for the new module structure.
Review details

Suppressed comments (3)

crates/oxc_lexer/src/pipeline/coalesce/keywords.rs:15

  • kw_verify_batch is only called from the parent coalesce module; making it pub is broader than necessary. Use pub(super) so the function remains accessible to coalesce/mod.rs without expanding visibility further.
    crates/oxc_lexer/src/pipeline/coalesce/mod.rs:18
  • coalesce stage symbols are declared pub, which widens visibility beyond the parent pipeline module. Other pipeline stage entry points/helpers consistently use pub(super) (e.g. compress.rs:128, find.rs:680, regex_div.rs:1512), which keeps the surface area minimal and avoids accidental API exposure if module visibility changes later.
    crates/oxc_lexer/src/pipeline/coalesce/keywords.rs:5
  • KWB is only used by the coalesce stage / parent pipeline; it doesn’t need to be fully pub. Narrowing it to pub(super) keeps the internal API surface consistent with other pipeline helpers.

This issue also appears on line 15 of the same file.

  • Files reviewed: 3/3 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

@overlookmotel

Copy link
Copy Markdown
Member Author

The refactor widens internal symbol visibility (pub) in the coalesce stage in ways that don’t match existing pipeline conventions and could unintentionally expand the reachable API surface later.

Untrue. Nothing is exported outside of the relevant modules.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-lexer Area - Lexer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants