Skip to content

Comments

feat: updates the default contenthash length in filenames from 8 to 10#7154

Merged
chenjiahan merged 6 commits intomainfrom
default_filename_hash_0205
Feb 6, 2026
Merged

feat: updates the default contenthash length in filenames from 8 to 10#7154
chenjiahan merged 6 commits intomainfrom
default_filename_hash_0205

Conversation

@chenjiahan
Copy link
Member

@chenjiahan chenjiahan commented Feb 5, 2026

Summary

This PR updates the default contenthash length in filenames from 8 to 10.

Why:

  • Provides a better balance between short filenames and hash reliability.
  • Significantly lowers collision risk compared with 8 characters, with only a small increase in filename length.
  • Keeps output concise for most projects while being safer for larger builds and long-term caching.

Related issues

Checklist

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

Copilot AI review requested due to automatic review settings February 5, 2026 14:17
@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Feb 5, 2026

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @chenjiahan, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request increases the default contenthash length in filenames from 8 to 10 characters. This change improves the reliability of content hashing by significantly lowering the collision risk, while only slightly increasing filename length. The changes include updates to configuration files, tests, and documentation to reflect the new default value.

Highlights

  • Content Hash Length Update: The default contenthash length in filenames has been updated from 8 to 10 characters. This change aims to provide a better balance between filename length and hash reliability, reducing the risk of collisions.
  • Configuration Changes: The configuration files have been updated to reflect the new default contenthash length. This includes changes to the default values in the configuration files and updates to the documentation.
  • Test Updates: The tests have been updated to reflect the new default contenthash length. This includes changes to the expected output in the tests and updates to the test cases.
  • Documentation Updates: The documentation has been updated to reflect the new default contenthash length. This includes changes to the default values in the documentation and updates to the examples.
Changelog
  • e2e/cases/css/resolve-alias/index.test.ts
    • Updated CSS alias test to match the new contenthash length.
  • e2e/cases/print-file-size/basic/rsbuild.config.ts
    • Configured filenameHash to contenthash:8 for testing purposes.
  • e2e/cases/print-file-size/diff/rsbuild.config.ts
    • Configured filenameHash to contenthash:8 for testing purposes.
  • e2e/cases/print-file-size/helper.ts
    • Updated regular expression to match contenthash lengths between 8 and 10 characters.
  • e2e/cases/security/sri-algotithm-multiple/index.test.ts
    • Updated SRI algorithm test to match the new contenthash length.
  • e2e/cases/security/sri-algotithm/index.test.ts
    • Updated SRI algorithm test to match the new contenthash length.
  • e2e/cases/security/sri-basic/index.test.ts
    • Updated SRI basic test to match the new contenthash length.
  • e2e/cases/security/sri-native-html-plugin/index.test.ts
    • Updated SRI native HTML plugin test to match the new contenthash length.
  • e2e/cases/security/sri-preload/index.test.ts
    • Updated SRI preload test to match the new contenthash length.
  • packages/core/src/helpers/index.ts
    • Changed default contenthash length to 10.
  • packages/core/src/types/config.ts
    • Updated default filename configurations to use contenthash:10.
  • packages/core/tests/snapshots/asset.test.ts.snap
    • Updated asset plugin tests to match the new contenthash length.
  • packages/core/tests/snapshots/builder.test.ts.snap
    • Updated builder tests to match the new contenthash length.
  • packages/core/tests/snapshots/default.test.ts.snap
    • Updated default plugin tests to match the new contenthash length.
  • packages/core/tests/snapshots/environments.test.ts.snap
    • Updated environment config tests to match the new contenthash length.
  • packages/core/tests/snapshots/wasm.test.ts.snap
    • Updated wasm plugin tests to match the new contenthash length.
  • packages/plugin-svgr/tests/snapshots/index.test.ts.snap
    • Updated svgr plugin tests to match the new contenthash length.
  • website/docs/en/config/output/filename-hash.mdx
    • Updated documentation to reflect the new default contenthash length of 10.
    • Added version history to document the change.
  • website/docs/en/config/output/filename.mdx
    • Updated documentation to reflect the new default contenthash length of 10.
  • website/docs/en/config/tools/html-plugin.mdx
    • Updated documentation example to remove contenthash.
  • website/docs/en/guide/basic/html-template.mdx
    • Updated documentation to reflect the new default contenthash length of 10.
  • website/docs/en/guide/basic/wasm-assets.mdx
    • Updated documentation to reflect the new default contenthash length of 10.
  • website/docs/en/guide/faq/hmr.mdx
    • Updated documentation to reflect the new default contenthash length of 10.
  • website/docs/zh/config/dev/client.mdx
    • Fixed typo in documentation.
  • website/docs/zh/config/output/filename-hash.mdx
    • Updated documentation to reflect the new default contenthash length of 10.
    • Added version history to document the change.
  • website/docs/zh/config/output/filename.mdx
    • Updated documentation to reflect the new default contenthash length of 10.
  • website/docs/zh/config/tools/html-plugin.mdx
    • Updated documentation example to remove contenthash.
  • website/docs/zh/guide/basic/html-template.mdx
    • Updated documentation to reflect the new default contenthash length of 10.
  • website/docs/zh/guide/basic/wasm-assets.mdx
    • Updated documentation to reflect the new default contenthash length of 10.
  • website/docs/zh/guide/faq/hmr.mdx
    • Updated documentation to reflect the new default contenthash length of 10.
Activity
  • The pull request author, chenjiahan, has updated tests and documentation to reflect the change in contenthash length.
  • The pull request author, chenjiahan, has provided a detailed explanation of the reasoning behind the change in the pull request description.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the default contenthash length in output filenames from 8 to 10 characters to improve collision resistance while maintaining reasonable filename lengths.

Changes:

  • Updated the default contenthash length constant in core code from [contenthash:8] to [contenthash:10]
  • Updated all documentation examples (English and Chinese) to reflect the new default hash length
  • Updated test snapshots and E2E test patterns to match the new 10-character hash format
  • Added version history sections documenting this change as part of v2.0.0

Reviewed changes

Copilot reviewed 30 out of 30 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/core/src/helpers/index.ts Updated default hash constant from contenthash:8 to contenthash:10
packages/core/src/types/config.ts Updated TypeScript documentation comments to reflect new default values
website/docs/*/guide/faq/hmr.mdx Updated examples in FAQ documentation
website/docs/*/guide/basic/wasm-assets.mdx Updated WASM asset examples
website/docs/*/guide/basic/html-template.mdx Updated HTML template examples
website/docs/*/config/tools/html-plugin.mdx Updated HTML plugin configuration examples (with issues)
website/docs/*/config/output/filename.mdx Updated filename configuration documentation and all examples
website/docs/*/config/output/filename-hash.mdx Updated hash format documentation and added version history
website/docs/zh/config/dev/client.mdx Minor consistency update to version history table header
packages//tests/snapshots/.snap Updated all test snapshots to reflect new hash length
e2e/cases/security/sri-*/index.test.ts Updated E2E test regex patterns for 10-character hashes
e2e/cases/print-file-size/helper.ts Updated regex to match both 8 and 10 character hashes
e2e/cases/print-file-size/*/rsbuild.config.ts Explicitly set filenameHash to contenthash:8 for these tests
e2e/cases/css/resolve-alias/index.test.ts Updated test regex pattern for 10-character hashes

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request correctly updates the default contenthash length from 8 to 10 characters across the codebase, including core logic, tests, and documentation. This is a good improvement for reducing hash collision risk. I've found a couple of issues in the documentation that need to be addressed: an incorrect example in one file and some imprecise wording in another. Overall, the changes are solid.

Copilot AI review requested due to automatic review settings February 5, 2026 14:21
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 30 out of 30 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@chenjiahan chenjiahan merged commit 84c8568 into main Feb 6, 2026
6 checks passed
@chenjiahan chenjiahan deleted the default_filename_hash_0205 branch February 6, 2026 02:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant