fix(core): log message include json file path in auto-nav-sidebar errors#3273
Merged
SoonIter merged 1 commit intoweb-infra-dev:mainfrom Apr 2, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Improves @rspress/core auto-nav-sidebar error reporting by including the exact _nav.json / _meta.json file path when JSON parsing fails, and adds a regression test to ensure this context remains present.
Changes:
- Centralized JSON parse error wrapping inside
auto-nav-sidebar/readJson()to include the source file path in failures. - Simplified nav scanning by relying on the centralized
readJson()error behavior. - Added a regression test for invalid
_meta.jsonparsing and a patch changeset for@rspress/core.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/core/src/node/auto-nav-sidebar/walk.ts | Removes local JSON-parse error wrapping in favor of centralized readJson() behavior. |
| packages/core/src/node/auto-nav-sidebar/utils.ts | Enhances readJson() to throw a contextual error containing the JSON file path on parse failure. |
| packages/core/src/node/auto-nav-sidebar/walk.test.ts | Adds regression coverage asserting the thrown error includes the invalid JSON file path. |
| .changeset/fair-pets-grab.md | Publishes the improvement as a patch for @rspress/core. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Timeless0911
approved these changes
Apr 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
_nav.jsonor_meta.jsonpath in auto-nav-sidebar JSON parse errorsreadJson()so both nav and sidebar paths are covered_meta.jsonparsing and a patch changeset for@rspress/coreRelated Issue
Checklist
Verification
pnpm exec biome check packages/core/src/node/auto-nav-sidebar/utils.ts packages/core/src/node/auto-nav-sidebar/walk.ts packages/core/src/node/auto-nav-sidebar/walk.test.tspnpm --filter @rspress/shared buildpnpm exec rstest run packages/core/src/node/auto-nav-sidebar/walk.test.ts