Skip to content

fix(core): log message include json file path in auto-nav-sidebar errors#3273

Merged
SoonIter merged 1 commit intoweb-infra-dev:mainfrom
SoonIter:codex/json-parse-error
Apr 2, 2026
Merged

fix(core): log message include json file path in auto-nav-sidebar errors#3273
SoonIter merged 1 commit intoweb-infra-dev:mainfrom
SoonIter:codex/json-parse-error

Conversation

@SoonIter
Copy link
Copy Markdown
Member

@SoonIter SoonIter commented Apr 2, 2026

Summary

  • include the offending _nav.json or _meta.json path in auto-nav-sidebar JSON parse errors
  • centralize the error message in readJson() so both nav and sidebar paths are covered
  • add a regression test for invalid _meta.json parsing and a patch changeset for @rspress/core

Related Issue

Checklist

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

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.ts
  • pnpm --filter @rspress/shared build
  • pnpm exec rstest run packages/core/src/node/auto-nav-sidebar/walk.test.ts

Copilot AI review requested due to automatic review settings April 2, 2026 09:06
Copy link
Copy Markdown
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

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.json parsing 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.

@SoonIter SoonIter changed the title fix(core): include json file path in auto-nav-sidebar errors fix(core): log message include json file path in auto-nav-sidebar errors Apr 2, 2026
@SoonIter SoonIter requested a review from Timeless0911 April 2, 2026 12:06
@SoonIter SoonIter enabled auto-merge (squash) April 2, 2026 12:06
@SoonIter SoonIter merged commit 70ac277 into web-infra-dev:main Apr 2, 2026
11 checks passed
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.

3 participants