Skip to content

fix: don't count modules inside found directories twice in search total - #743

Open
GM-Andy wants to merge 1 commit into
webpack:mainfrom
GM-Andy:fix/issue-251
Open

GM-Andy wants to merge 1 commit into
webpack:mainfrom
GM-Andy:fix/issue-251

Conversation

@GM-Andy

@GM-Andy GM-Andy commented Oct 16, 2026 •

Copy link
Copy Markdown

Fixes #251

foundModulesSize summed every match, so when a directory and modules inside it both matched (e.g. searching lodash), the modules were counted once in the directory's size and again on their own. It now walks the tree and stops at the first found node, as suggested in #251 (comment).

Added test/store.js covering directory, module and mixed matches (fails on main with 60 instead of 30). npm test and npm run lint pass.

Written with help from an AI coding assistant.

Summary by CodeRabbit

  • Bug Fixes
    • Corrected search-result size totals so matching a directory and its contents doesn’t count the same modules twice.
  • Tests
    • Added coverage for size totals across nested modules and search queries.

@changeset-bot

changeset-bot Bot commented Oct 16, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: cb1d322

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
webpack-bundle-analyzer Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@linux-foundation-easycla

linux-foundation-easycla Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: GM-Andy / name: GMxAndy (cb1d322)

@coderabbitai

coderabbitai Bot commented Oct 16, 2026

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b061811f-565a-4681-b7a2-bb5f670079b8
📥 Commits

Reviewing files that changed from the base of the PR and between 0ebe1e5 and cb1d322.

📒 Files selected for processing: 3
  • .changeset/fix-search-total-size.md
  • client/store.js
  • test/store.js

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Walkthrough

foundModulesSize now traverses module groups and avoids counting a matched directory and its descendants separately. Tests check totals for nested Lodash modules and several search queries. A patch changeset records the search-results total-size issue.

Priority: ⬇️ Low

Severity of issue fixed: Low

Merge Risk: ⚪ Minimal · up to cb1d3

Matched directories contribute their descendant-inclusive size once, while separately matched branches remain included. No actionable merge-blocking issue is identified.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files. (1 skipped: 1 … Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: preventing modules inside matched directories from being counted twice in search totals.
Linked Issues check Passed Issue #251 requires the search total to avoid adding a matched directory and its matched descendants twice. client/store.js now traverses each chunk tree and stops at the first found node. `test/sto…
Out of Scope Changes check Passed The changes stay within issue #251. The new store tests verify the counting behavior, and .changeset/fix-search-total-size.md documents the matching patch release. No unrelated product behavior is c…
Full details: Linked Issues check

Explanation

Issue #251 requires the search total to avoid adding a matched directory and its matched descendants twice. client/store.js now traverses each chunk tree and stops at the first found node. test/store.js covers directory, module, and mixed matches, including lodash|find with an expected size of 30.

Full details: Out of Scope Changes check

Explanation

The changes stay within issue #251. The new store tests verify the counting behavior, and .changeset/fix-search-total-size.md documents the matching patch release. No unrelated product behavior is changed.

Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files. (1 skipped: 1 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Some tools did not complete. Review the errors below.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install timed out. The project may have too many dependencies for the sandbox.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@evenstensberg

Copy link
Copy Markdown
Member

Could you sign the CLA?

@GM-Andy

GM-Andy commented Oct 16, 2026

Copy link
Copy Markdown
Author

Signed

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.

Incorrect total size in search result

2 participants