Fix dead search-index links in single HTML layout#16
Open
Reefact wants to merge 1 commit into
Open
Conversation
BuildSearchIndex hard-coded every href as errors/{FileName}, but in the
single layout no per-error page is emitted — errors are #err-… anchors
inside index.html. The search-index.json (meant for external tooling)
therefore pointed at pages that do not exist.
Pass the layout down and emit index.html#err-{Anchor} in single,
keeping errors/{FileName} in split. Adds tests covering the href for
both layouts and asserting the single anchors actually exist in the page.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VM8CCnaRUkkzeRQum4Bgfe
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.
Problem
HtmlErrorDocumentationRenderer.Renderemitsassets/search-index.jsonfor both layouts, butBuildSearchIndexhard-coded every entry's href aserrors/{FileName}.In the single layout, no per-error page is produced —
RenderSingleemits a singleindex.html, and errors live there as#err-…anchors (<article id="err-…">). The search index, documented as being for external tooling, therefore pointed aterrors/*.htmlpages that don't exist → dead links.Fix
BuildSearchIndex.index.html#err-{Anchor}in single, keeperrors/{FileName}in split.The anchor stem is code-derived (
SafeStem→ only[A-Za-z0-9._-]), so it needs no percent- or HTML-encoding; it goes throughJsonStringlike the other fields for consistency.Tests
Added to
HtmlErrorDocumentationRendererTests:errors/*.htmlpage.index.html#err-…anchor, contains noerrors/href, and the referenced anchors actually exist in the rendered page.Note
I couldn't run the test suite in this sandbox — the .NET 10 SDK isn't installed and the network policy blocks Microsoft's download hosts (
builds.dotnet.microsoft.com→ 403). The existing CI workflow (analyzers.yml) only builds/tests the Analyzers project, so it won't exercise these GenDoc tests either. The change is small and was reviewed manually; please rundotnet test FirstClassErrors.GenDoc.UnitTeststo confirm.🤖 Generated with Claude Code
Generated by Claude Code