Skip to content

feat: Add support for assigning numbers in beforeModuleIds hook#13222

Open
hamlim wants to merge 4 commits intoweb-infra-dev:mainfrom
hamlim:hamlim/before-module-ids-hook
Open

feat: Add support for assigning numbers in beforeModuleIds hook#13222
hamlim wants to merge 4 commits intoweb-infra-dev:mainfrom
hamlim:hamlim/before-module-ids-hook

Conversation

@hamlim
Copy link
Contributor

@hamlim hamlim commented Mar 5, 2026

Summary

This is a follow on change from this previous PR: #12809 which added support for assigning string values in the beforeModuleIds hook, this PR extends that to support assigning numbers as well.

This was highlighted in this PR comment here: #12809 (comment) as an enhancement to the existing logic.

Related links

Previous PR: #12809

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

@hamlim hamlim requested a review from hardfist as a code owner March 5, 2026 16:26
@hamlim hamlim changed the title feat: Add support for assigning numbers in beforeModuleIds hook feat: Add support for assigning numbers in beforeModuleIds hook Mar 5, 2026
@hamlim hamlim mentioned this pull request Mar 5, 2026
2 tasks
@hardfist
Copy link
Contributor

hardfist commented Mar 6, 2026

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1dbab8476c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

#[napi(object)]
pub struct JsBeforeModuleIdsResult {
pub assignments: HashMap<String, String>,
pub assignments: HashMap<String, Either<String, u32>>,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid truncating numeric module IDs to uint32

beforeModuleIds now accepts number from JS, but this binding narrows every numeric assignment to u32. That means values outside the unsigned 32-bit integer domain (for example negative IDs, fractional IDs, or IDs larger than 2^32 - 1) cannot round-trip and will be rewritten by the conversion layer instead of preserving the value the plugin set. This changes behavior from the previous string-based path and can silently produce incorrect module IDs in stats/output for those plugins.

Useful? React with 👍 / 👎.

@codspeed-hq
Copy link

codspeed-hq bot commented Mar 6, 2026

Merging this PR will not alter performance

✅ 16 untouched benchmarks
⏩ 3 skipped benchmarks1


Comparing hamlim:hamlim/before-module-ids-hook (1dbab84) with main (35b8296)

Open in CodSpeed

Footnotes

  1. 3 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

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