Skip to content

feat(docs): nest PR gatekeeper under Automations in the docs sidebar - #176

Merged
sre-helmcode merged 2 commits into
mainfrom
feat/docs-nav-nest
Oct 12, 2026
Merged

sre-helmcode merged 2 commits into
mainfrom
feat/docs-nav-nest

Conversation

@sre-helmcode

Copy link
Copy Markdown
Contributor

What

Owner feedback: the PR gatekeeper guide (#175) showed at the same level as Automations. It now sits below Automations as its sub-item, in EN and ES.

Generic mechanism: optional parent frontmatter field (the parent's entry id, same value in both languages).

  • Sidebar: a child renders as an indented nested <ul> right under its parent, inside the parent's group, never twice. Always visible (no toggle): one fewer click and focus stop; screen readers announce it as a level-2 list.
  • Active state: the open page keeps aria-current="page" + the filled highlight; its parent gets is-trail (accent text, no fill) and the sub-list guide line turns accent.
  • Breadcrumb: Docs / Automations / PR gatekeeper (URLs stay flat, /docs/pr-gatekeeper).
  • Prev/next follow the sidebar's visual order (flattenDocsNav), not the raw order.
  • pr-gatekeeper order 22 -> 21 and webhooks 21 -> 22 so the flat order (/api/docs manifest) matches the sidebar. Orders stay contiguous.
  • Mobile: the drawer is the same sidebar component, so it nests identically. DocsTopBar lists no pages, nothing to change there.
  • Robustness: unknown parent, self-parent and cycles fall back to top level (a typo costs the nesting, never the page); a child cannot open a group on its own.

Also fixes a pre-existing bug found by the render test: /es/docs (Introduccion) was marked active on every Spanish page because only /docs was excluded from prefix matching.

Files

  • src/lib/docsNav.ts: nesting in groupDocsNav, flattenDocsNav, isActiveDocTrail, docsNavAncestors, docsNavItemFromEntry/docSlug (shared by layout and tests), ES index fix
  • src/components/docs/DocsSidebarNav.astro, DocsNavList.astro (recursive via Astro.self)
  • src/layouts/Docs.astro, src/styles/docs-shell.css, src/content.config.ts
  • vitest.config.ts split into unit + render projects; vitest.render.config.ts compiles .astro for the Container API (configFile: false: the Cloudflare adapter's Vite plugin rejects vitest's SSR env)

Tests

  • Unit (docsNav.test.ts): nesting, ordering of siblings, no duplicates, parent's group wins, orphan/self/cycle, multi-level, visual order for prev/next, trail, ancestors, /es/docs not active everywhere
  • Render (docsNavNesting.render.test.ts, Astro Container API, real EN+ES frontmatter): PR gatekeeper in a docs-nav-sub list right under Automations, listed once, Webhooks back at top level after the block, aria-current only on the child + is-trail on Automations, no trail elsewhere
  • Frontmatter guards: parent exists, not self, same group, one level, children right after parent in flat order, EN/ES parity
  • npm test: 79 files / 2033 tests green; npx astro check: 0 errors; npm run build: OK

Visual check (agent-browser, local astro dev) at 1440x900 and 390x844 with the drawer open, EN and ES, plus keyboard Tab from Automations to the child (focus ring visible).

Deploy notes

No env vars, no migrations. No VERSION file in this repo; deploy on merge per the existing workflow.

🤖 Generated with Claude Code

barckcode and others added 2 commits October 12, 2026 19:02
…under Automations

Adds an optional `parent` frontmatter field (the parent's entry id). A page
with a parent is rendered as an indented sub-item right under it, in the
parent's group, never twice. The parent shows an active trail while the child
is open, the breadcrumb includes the parent, and prev/next follow the
sidebar's visual order.

- docsNav: groupDocsNav nests children (cycle/orphan safe), flattenDocsNav,
  isActiveDocTrail, docsNavAncestors, shared docsNavItemFromEntry
- DocsSidebarNav + recursive DocsNavList components, nested list markup
- pr-gatekeeper: parent automations, order 21 (webhooks 22), EN and ES
- fix: /es/docs no longer highlights as active on every Spanish page
- tests: unit nesting specs, Container API render test (EN/ES), frontmatter
  guards for `parent`; vitest split into unit and render projects

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…view notes

- docsNavPage.test.ts: full EN/ES pages from the dev server (breadcrumb
  Docs / Automations / PR gatekeeper, prev/next around the child, sidebar
  trail on the real page)
- DocsShell: pin prev/next to flattenDocsNav; drawer scrolls the current
  page into view when it opens (short phones)
- docsNavAncestors: first entry wins on a repeated slug, as in groupDocsNav;
  stronger cycle assertion and a duplicate-slug test
- ARCHITECTURE: one-level nesting policy and child order rule

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sre-helmcode
sre-helmcode merged commit b4c2cf5 into main Oct 12, 2026
1 check passed
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.

2 participants