Skip to content

fix(docs): resolve metadata paths with zero-width spaces#12044

Closed
danyalahmed1995 wants to merge 1 commit into
facebook:mainfrom
danyalahmed1995:fix/issue-12005-zero-width-path-metadata
Closed

fix(docs): resolve metadata paths with zero-width spaces#12044
danyalahmed1995 wants to merge 1 commit into
facebook:mainfrom
danyalahmed1995:fix/issue-12005-zero-width-path-metadata

Conversation

@danyalahmed1995
Copy link
Copy Markdown
Contributor

@danyalahmed1995 danyalahmed1995 commented May 21, 2026

Summary

Fixes #12005.

This PR resolves a docs metadata path mismatch for docs paths containing U+200B ZERO WIDTH SPACE, using the exact dogfood repro from #12052.

Changes

  • Adds the exact Repro: test docs with folders containing zero-width files #12052 dogfood repro pages for zero-width spaces at the start, middle, and end of a path segment.
  • Resolves docs metadata import paths back to the loaded docs source before hashing.
  • Adds a small shared metadata source resolver in @docusaurus/utils.
  • Applies the resolver only in the docs plugin for this PR.
  • Removes the previous helper-only test.

Validation

Ran:

yarn workspace @docusaurus/utils build
yarn workspace @docusaurus/plugin-content-docs build
yarn test packages/docusaurus-plugin-content-docs/src/__tests__/index.test.ts
yarn test packages/docusaurus-plugin-content-docs
yarn build:website:fast

Manual fail/pass check:

No rspackBundler, rspackPersistentCache, website config, package, or lockfile changes are included.

@meta-cla meta-cla Bot added the CLA Signed Signed Facebook CLA label May 21, 2026
@netlify
Copy link
Copy Markdown

netlify Bot commented May 21, 2026

[V2]

Built without sensitive environment variables

Name Link
🔨 Latest commit 044b0a5
🔍 Latest deploy log https://app.netlify.com/projects/docusaurus-2/deploys/6a17a0619db96700089b7ef3
😎 Deploy Preview https://deploy-preview-12044--docusaurus-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@danyalahmed1995 danyalahmed1995 force-pushed the fix/issue-12005-zero-width-path-metadata branch 3 times, most recently from 3eae039 to 452c4e4 Compare May 21, 2026 01:32
Copy link
Copy Markdown
Collaborator

@slorber slorber left a comment

Choose a reason for hiding this comment

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

Honestly, this looks like AI slop

Maybe it's a legit fix, but you are not testing the problem end-to-end, and only adding tests for the code you introduced, which doesn't prove anything in practice.

It remains to be proved that the problem is actually solved, and that your PR is not introducing useless code, despite it being "tested."


Before even thinking about implementing a solution, I want to see an end-to-end test case that actually fails on our CI.

Please add a dogfooding test case to our own website, for example, as I did here: #12052

  • If I remove your code, the CI must fail with the initial bug report error.
  • If I add back your code, the CI must pass, proving that your implementation solves the problem.

Also, this issue is likely to also affect other plugins, so we'd rather implement a generic solution.

@danyalahmed1995
Copy link
Copy Markdown
Contributor Author

Honestly yeah i got invested in proving my approach instead of looking at the original end to end failure , I will keep that in mind apologies for that 😅.

I am gonna do the testing you asked me to do and come back with a generic solution that doesn't affect other plugins.

Thank you for the feedback.

@danyalahmed1995
Copy link
Copy Markdown
Contributor Author

@slorber I reworked the PR around the dogfood repro path from #12052.

Locally, with the dogfood vulnerability-report<U+200B><U+200B>/index.mdx page added:

  • removing the implementation fix makes yarn build:website:fast fail with the missing generated metadata JSON import
  • restoring the fix makes the same command pass

I removed the helper-only test coverage because that was basically redundant and was mainly for proving the approach not the actual repro.

I havent made a commit for it because i am still looking for a generic approach as you asked so it doesnt effect other plugins.

@slorber
Copy link
Copy Markdown
Collaborator

slorber commented May 22, 2026

Please use the exact same dogfood test case that I added here: #12052

We have proof that it reproduces the problem with the other PR, and we'll merge it as part of the fix to prevent any possible regression in the future.

For the e2e test failures, it's an unrelated problem: just rebase your PR against main.

@slorber slorber marked this pull request as draft May 22, 2026 09:05
@danyalahmed1995
Copy link
Copy Markdown
Contributor Author

I tested the exact #12052 dogfood repro in a clean sibling worktree instead of my earlier custom repro.

With the default Rspack config, yarn build:website:fast fails with the missing metadata JSON imports for the zero-width-space docs paths.

After I changed only:

rspackBundler: false,
rspackPersistentCache: false,

cleaned website/.docusaurus, website/build, and cache dirs, and the same command passed.

So yeah, this looks Rspack-specific. I’ll rebase against main and update the PR around the exact #12052 dogfood test case, not the helper-only test.

@danyalahmed1995 danyalahmed1995 force-pushed the fix/issue-12005-zero-width-path-metadata branch from 452c4e4 to 044b0a5 Compare May 28, 2026 01:54
@danyalahmed1995
Copy link
Copy Markdown
Contributor Author

Updated the PR after rebasing against main.

The diff now uses the exact #12052 dogfood repro files, removes the helper-only test, and keeps the fix scoped to the docs plugin while using a small shared metadata source resolver.

Local validation confirms:

No Rspack config, website config, package, or lockfile changes are included.

@slorber
Copy link
Copy Markdown
Collaborator

slorber commented May 28, 2026

If this is a Rspack bug, then the fix must be reported with a minimal repro to the Rspack team

I don't want to implement a weird workaround for a bug in a dependency, to solve a fancy edge case (who uses zero-width spaces in filenames 🤷‍♂️ )

@slorber slorber closed this May 28, 2026
@danyalahmed1995
Copy link
Copy Markdown
Contributor Author

Well honestly this issue seemed weird to me from the start , i picked it because had a feeling that there is a lot more to this than something that's being reported but i am still happy with the findings we got it at least gives a ground to work on future if need . Not to mention it also got super complicated I should have talked to you to understand if the PR is needed. I will keep that in mind for future 😄

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

Labels

CLA Signed Signed Facebook CLA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Zero-width space in mdx file path => build fails due to hash mismatch

2 participants