Skip to content

test: normalize compressed IPv6 addresses in dev server output - #4878

Merged
alexander-akait merged 2 commits into
webpack:mainfrom
bercedev:fix/test-utils-ipv6-ula
Oct 21, 2026
Merged

alexander-akait merged 2 commits into
webpack:mainfrom
bercedev:fix/test-utils-ipv6-ula

Conversation

@bercedev

@bercedev bercedev commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #4877

normalizeStderr replaced IPv6 addresses with a pattern that only matched the full eight-group form. A unique local address like fdb2:2c26:f4e4::1 is compressed, so it reached the serve snapshots as-is. A full address would have come out as http://[[x:x:x:x:x:x:x:x]]:…, since the replacement adds brackets around a match that was already inside brackets. The pattern now matches the bracketed host in any form and replaces it, brackets included. The [::1] loopback that the snapshots keep is left alone. The synthetic IPv6 line for runners without IPv6 is unchanged.

Testing: test/serve/basic in a Node 24 container on three podman networks.

network before after
internal, IPv6 with a ULA on eth0 (fd22:5ef7:fe09:7596::/64) 30 failed, 29 snapshots differ on On Your Network (IPv6): http://[fd22:…::6]:<port>/ 35 passed, all 31 snapshots pass
internal, IPv4 only (like CI) — 35 passed, all 31 snapshots pass

In every run, should not start dev server when supplied false #1 hits its 180 s timeout, and it does that without this change too. It looks environmental (a watch run that never ends in my container), not related to the output normalization.

Note: I used Claude Code while working on this.

Summary by CodeRabbit

  • Bug Fixes
    • Improved IPv6 host normalization for bracketed full and compressed addresses.
    • Valid non-loopback IPv6 addresses are consistently normalized while preserving their bracketed format.
    • Preserved the IPv6 loopback address [::1] and unchanged bracketed text that is not an IPv6 address.

The IPv6 pattern only matched the full eight-group form, so a unique local address such as [fdb2:2c26:f4e4::1] reached the serve snapshots unchanged, and a full address would have kept its brackets twice. Match the bracketed host in any form, except the [::1] loopback, and replace it with its brackets.
@changeset-bot

changeset-bot Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: a82d38b

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@linux-foundation-easycla

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

Copy link
Copy Markdown

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

@coderabbitai

coderabbitai Bot commented Oct 20, 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: ed308000-9302-429a-bcfc-cea910d961fb
📥 Commits

Reviewing files that changed from the base of the PR and between 3cca311 and a82d38b.

📒 Files selected for processing: 2
  • test/api/normalize-stderr.test.js
  • test/utils/test-utils.js
🚧 Files skipped from review as they are similar to previous changes: 1
  • test/utils/test-utils.js

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

Walkthrough

The test utility now validates bracketed full or compressed IPv6 hosts, including optional zone identifiers, before normalizing stderr output. Valid non-loopback IPv6 hosts become [x:x:x:x:x:x:x:x]. The utility preserves [::1] and non-IPv6 bracketed text. Tests cover these cases.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to a82d3

The change is mergeable after normal checks; no actionable risk remains in the supplied evidence.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly describes the main change: normalizing compressed IPv6 addresses in dev server output. It is concise and directly related to the changeset.
Linked Issues check Passed Issue #4877 requires test-output normalization for ULA IPv6 addresses. test/utils/test-utils.js now matches bracketed compressed and full IPv6 hosts, validates the address with isIPv6, preserves `…
Out of Scope Changes check Passed The changes remain within issue #4877. The implementation updates test stderr normalization, and the added tests verify that behavior. No dev-server networking behavior or unrelated product code chang…
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
Full details: Linked Issues check

Explanation

Issue #4877 requires test-output normalization for ULA IPv6 addresses. test/utils/test-utils.js now matches bracketed compressed and full IPv6 hosts, validates the address with isIPv6, preserves [::1], and replaces valid non-loopback hosts with [x:x:x:x:x:x:x:x]. test/api/normalize-stderr.test.js covers the reported compressed ULA, full IPv6, loopback, and non-IPv6 bracket cases.

Full details: Out of Scope Changes check

Explanation

The changes remain within issue #4877. The implementation updates test stderr normalization, and the added tests verify that behavior. No dev-server networking behavior or unrelated product code changes are shown.

Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2 files.

✨ 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

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0bc5b63e-f617-4966-a177-7344c4640650
📥 Commits

Reviewing files that changed from the base of the PR and between 6f597bf and 3cca311.

📒 Files selected for processing: 1
  • test/utils/test-utils.js

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

Comment thread test/utils/test-utils.js Outdated
The pattern also matched tokens such as [1:2] or [dead:beef]. Check the bracket contents with net.isIPv6 before replacing them, and cover normalizeStderr's IPv6 handling with unit tests.
@codecov

codecov Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.85%. Comparing base (6f597bf) to head (a82d38b).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #4878   +/-   ##
=======================================
  Coverage   94.85%   94.85%           
=======================================
  Files          14       14           
  Lines        5637     5637           
  Branches      846      846           
=======================================
  Hits         5347     5347           
  Misses        289      289           
  Partials        1        1           

Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6f597bf...a82d38b. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@alexander-akait
alexander-akait merged commit eefa89c into webpack:main Oct 21, 2026
34 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

This PR is packaged and the instant preview is available (eefa89c).

Install it locally:

  • npm
npm i -D create-webpack-app@https://pkg.pr.new/create-webpack-app@eefa89c webpack-cli@https://pkg.pr.new/webpack-cli@eefa89c
  • yarn
yarn add -D create-webpack-app@https://pkg.pr.new/create-webpack-app@eefa89c webpack-cli@https://pkg.pr.new/webpack-cli@eefa89c
  • pnpm
pnpm add -D create-webpack-app@https://pkg.pr.new/create-webpack-app@eefa89c webpack-cli@https://pkg.pr.new/webpack-cli@eefa89c

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.

Having IPV6 address set to ULA on local network device makes a couple of test cases fail

2 participants