Repository navigation
fix(docs): match internal link aliases to sidebar routes - #401
Conversation
Parse category and nested folder ancestry when validating docs links. Remove the obsolete Hive intro and redirect its URL to the synced introduction. Hive-Run: hivecommons#400 Hive-Plan: issue-400-route-parity Hive-Spec: issue-400#expected Signed-off-by: Karibhou <157208370+Karibhou@users.noreply.github.com>
👷 Deploy request for hivecommons-docs pending review.Visit the deploys page to approve it
|
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Read the new parser against src/app/docs/page-map.ts at this head rather than the diff alone. Looks correct to me.
What I verified
scripts/check-internal-links-helpers.ts:140-227now walksNAV_STRUCTURE_*with the TypeScript AST and emits exactly one route per leaf: category slug → nested folder slugs → leaf slug. That is the same rulebuildPageMapapplies atsrc/app/docs/page-map.ts:339-376and:396-404(category slug,newParentSlugfor arrays,slugify'd title for project leaves).slugify(helpers.ts:23-28) is character-for-character the same regex pair page-map uses.- General-section handling matches too:
contributing|community|newsleaves use the file basename andbase: "docs"(helpers.ts:181-186↔page-map.ts:345-350). docs/content/hive/overview/intro.mdwas not referenced by any nav block, and thenetlify.toml:53-56301 covers its old URL; the redirects consistency test was updated to pin it.- Ran locally at
d5a618e:vitest runonscripts/+ the two touchedsrc/__tests__files → 336/336 pass;npm run check-links→Checked 271 internal links … against 140 routes. ✅ No broken internal links.So dropping the invented cross-section/bare aliases did not surface any real link that had been relying on them.
Per #400 this is the requested change (one sidebar route per entry, nested folders accepted, aliases rejected). typescript is already a devDependency (package.json:62), so the new import adds no dependency.
One non-blocking note: isGeneral is recomputed from the file prefix per leaf, whereas page-map.ts:364-371 also promotes a folder to /docs when any child is a general file. There is no such nested general folder in any current nav, so behaviour is identical today; just worth knowing if one is ever added.
— hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
Read the new parser against the site's route builder; this looks correct to me.
Verified:
scripts/check-internal-links-helpers.ts:146-230(newparseNavStructures) walksNAV_STRUCTURE_*with the TS AST and emits one route per leaf: category slug + nested folder slugs + leaf slug, with general-section leaves (contributing/|community/|news/) using the file basename and basedocs. That is exactly whatbuildPageMapdoes atsrc/app/docs/page-map.ts:339-350(leaf slug/base),:353-355(folder slug chaining) and:394-396(category slug).slugify(helpers.ts:22-27) matches the inline regex in page-map.navEntryRoute(helpers.ts:239-241) now always includessectionSlug, so the bare and cross-section aliases #400 describes are gone; the nested ADR route is produced.check-internal-links.ts:83drops the kubestellaraltlookup — nothing inPROJECT_FOR_NAVneeds it, and forGENERALentriesbase.replace(/^docs\/?/, "")resolves todocs/content/<section>/...as before.docs/content/hive/overview/intro.mdis not referenced byNAV_STRUCTURE_HIVEor byscripts/sync-hive-docs.ts, so the sync will not recreate it; the 301 innetlify.toml:53-56covers the old URL.- Ran on head
d5a618e: the four touched Vitest files (113 tests) pass andnpm run check-linksreports 271 links / 140 routes, no breaks.
One low-priority style note (not blocking): src/__tests__/netlify-redirects.consistency.test.ts:97-99 hard-codes /docs/hive/overview/intro as an exception in the "no redirect for a project that no longer exists" test. The next page-level redirect will need another literal. Restricting that check to project-root sources (e.g. from with no segment after /docs/<project>) would keep the intent without a per-page allowlist. Fine to leave for a follow-up.
— hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
Hive filed review findings that do not block this PR as backlog items:
Cap: 10 backlog item(s) per PR per day. |
There was a problem hiding this comment.
Intent alignment (vs #400) — the checker change satisfies the issue's "Expected": parseNavStructures now walks each category/folder structurally and emits one route per leaf (scripts/check-internal-links-helpers.ts:150-196), navEntryRoute is /${base}/${sectionSlug}/${slug} with no bare form (:240), and scripts/check-internal-links.main.test.ts:271-292 locks in the two example URLs the issue names. General-section handling mirrors page-map.ts:345-351.
Unrelated scope (advisory, non-blocking): deleting docs/content/hive/overview/intro.md, the new 301 in netlify.toml:53-56, and the hard-coded exception in src/__tests__/netlify-redirects.consistency.test.ts:98 are not part of #400 (the issue does not mention intro.md, and nothing in the repo links to it). It is a harmless orphan cleanup, but it belongs in its own PR/changelog line rather than riding on a link-checker fix — and the test exception special-cases one path in a test whose purpose is "project that no longer exists".
— hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
📌 Fixes
Fixes #400
📝 Summary of Changes
Checklist
Security Considerations
No security-sensitive files changed.
Reviewer Notes
The local production build was interrupted after it stopped producing output during optimization; CI will run the production build.
— hive: backend=codex