Skip to content

fix: preserve version-named leaf pages during discovery - #136

Merged
dacharyc merged 2 commits into
mainfrom
fix/135-preserve-version-leaf-pages
Sep 27, 2026
Merged

dacharyc merged 2 commits into
mainfrom
fix/135-preserve-version-leaf-pages

Conversation

@dacharyc

Copy link
Copy Markdown
Member

Summary

Fixes #135.

Only consider non-terminal path segments as version prefixes in deduplicateVersionedUrls(). A terminal version-like segment remains part of the page's grouping key, preserving release notes, changelog entries, and version roots.

Independent Assessment

The reported collision is reproducible: /docs/v1.0/ groups with /docs/, and the unversioned parent wins. Sibling release pages also collapse to one even without a section index, so giving version leaves a separate shared namespace would not solve the data loss.

Restricting prefix detection to segments with a following page path is the smallest conservative fix. Ordinary versioned child pages still deduplicate, including explicit preferred-version selection. extractVersionFromUrl() is intentionally unchanged because a base URL ending in /v1/ must still select v1 child pages.

Tradeoff: version roots such as /docs/v1/ and /docs/v2/ remain separate discovery candidates, even with an explicit version preference. URL structure alone cannot reliably distinguish these roots from distinct version-named release documents. This can increase the discovery pool; normal sampling limits still apply.

This change addresses version deduplication only; the separate file-type filtering issue in #134 is outside its scope.

Regression Coverage

  • Terminal version pages alongside their section index, with and without trailing slashes.
  • Sibling release pages, with and without a section index.
  • Mixed version roots and child pages, with default and explicit version selection.
  • Version leaves discovered through both llms.txt and sitemap paths.

Before the fix, all four initial regression cases failed while the 13 existing deduplication tests passed. After the fix, all 161 page-discovery tests pass, including eight new regression cases.

Validation

  • npm test -- --reporter=dot: 1,741 tests passed across 67 files.
  • npm run lint: passed.
  • npm run build: passed.
  • npm run version:check: passed.
  • npm run format:check: passed.

After applying Prettier to the changed test file, reran all 161 page-discovery tests and the repository formatting check successfully.

Only consider non-terminal path segments as version prefixes during deduplication. Preserve release notes, changelog entries, and version roots without changing child-page version selection.

Add regression coverage for trailing slashes, sibling leaves, preferred versions, and both llms.txt and sitemap discovery.

Fixes #135.
Document the rationale for preserving version-named leaf pages, the separate base-URL version semantics, sampling and request-budget tradeoffs, and the existing deduplication threshold interaction.
@dacharyc
dacharyc merged commit 51297c3 into main Sep 27, 2026
2 checks passed
@dacharyc
dacharyc deleted the fix/135-preserve-version-leaf-pages branch September 27, 2026 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

deduplicateVersionedUrls drops pages whose URL ends in a version segment

1 participant