Skip to content

fix: 25 bugs found while dogfooding the docs site (crashes, .md export, search, config)#43

Merged
mhenrixon merged 2 commits into
mainfrom
feature/dogfood-docs-and-bugfixes
Jul 3, 2026
Merged

fix: 25 bugs found while dogfooding the docs site (crashes, .md export, search, config)#43
mhenrixon merged 2 commits into
mainfrom
feature/dogfood-docs-and-bugfixes

Conversation

@mhenrixon

Copy link
Copy Markdown
Owner

What & why

While dogfooding docs-kit's own docs site, I ran a capability + render audit of the whole gem and it surfaced 25 confirmed bugs — each reproduced end-to-end before fixing. This PR lands all 25 fixes (TDD, RED-first spec per bug). The docs rewrite that motivated the audit follows in a separate PR.

Refs #8.

The bugs, by impact

Broken features (crash / abort)

Bug Fix
A typo'd/unloaded Rouge theme name (c.code_theme = "…Doesnotexist") raised NameError on every page with a code block code_theme_class/code_theme_dark_class degrade to the default theme / nil
DocsUI::RequestExample aborted with JSON::ParserError on a non-JSON String body compact_json only compacts valid JSON, else passes the body verbatim
Registry#nav_items could NoMethodError on a hash-entries registry guards view_class + honors group_by_attribute (mirrors #grouped)
The install generator's stimulus fallback double-registered when a site lazy-loads fallback respects an existing eager-or-lazy registration

Wrong output

  • DocsUI::Section emitted duplicate DOM ids for same-slug titles → broke in-page anchors, the auto-TOC, and scroll-spy. Now page-scoped id de-dup via Phlex's shared render context.
  • .md twin export: mis-exported callout titles, corrupted inline code containing a backtick, and produced ragged GFM tables; a filename: leaked as a stray paragraph above the fence. All fixed in markdown_export/{blocks,inline,table} + code.
  • Search index treated a ## line inside a code fence as a real heading → phantom search entries. Now fence-aware.
  • RequestExample emitted a malformed -H "Token: " when the auth header had no colon; ErrorTable showed an empty <code>/spurious Param column for a blank param; Shortcut rendered Ctrl Ctrl for a mod+ctrl chord.
  • c.version_badge = "v1.2" (a String) silently rendered nothing; c.nav = -> { {} } (an explicit empty nav) was ignored because of an equal?(DEFAULT_NAV) object-identity check.

Papercuts / cosmetics

  • Sidebar brand link now honors config.brand_href (matched Shell#topbar).
  • Malformed typed table cells now raise instead of leaking the literal Ruby array; a field with no :description degrades to the em-dash placeholder; a malformed empty PropTable row no longer emits an empty <code>.
  • DocsUI::Page#on_page now returns configuration.on_page_default (matches its doc); config comments fixed (Docs::DocsUI::); DocsUI::Code's comment separates the code_lexer_aliases (highlighting) vs code_language_labels (tab labels) knobs; the page generator no longer emits redundant slug:/view: keywords; an example_spec comment corrected.

How it was found

A multi-agent audit mapped all 12 capability areas from source, rendered every page + the .md twin + /llms.txt + search end-to-end, flagged suspected bugs, and verified each by reproduction (39 agents, 0 errors). The 25 that reproduced are here; the fixes were applied one-file-per-agent (disjoint), each with its own spec.

Verification

  • bundle exec rspec538 examples, 0 failures (was 505; ~33 new regression examples).
  • bundle exec rubocop — clean (105 files).
  • End-to-end: every dogfood page, the .md twin, and search render 200 after the fixes.

https://claude.ai/code/session_01FPQb6z3YwcKRMbvoJhdxnX

mhenrixon added 2 commits July 3, 2026 15:32
… explicit empty nav

Found while dogfooding the docs site. Five Configuration bugs:
- code_theme_class/code_theme_dark_class const_get raised NameError on a
  typo'd/unloaded Rouge theme, crashing every page with a code block; now
  degrades to the default theme (base) / nil (dark).
- version_badge_text dropped a plain String value (respond_to?(:call) guard);
  now coerces a non-callable to its string form so c.version_badge = "v1.2" works.
- nav_groups used @nav.equal?(DEFAULT_NAV) object identity, so any assigned
  lambda — even -> { {} } — skipped registry derivation; now tracks explicit
  assignment via a flag so an explicit empty nav wins and an untouched nav
  still derives from nav_registries.
- Comments referenced a nonexistent Docs:: namespace; corrected to DocsUI::.

TDD: RED specs added for each (theme degrade, String badge, explicit empty nav).

Refs #8

Claude-Session: https://claude.ai/code/session_01FPQb6z3YwcKRMbvoJhdxnX
…s site

A capability+render audit of the dogfood docs site surfaced 25 confirmed bugs
(5 config ones fixed in the previous commit). This commit fixes the remaining
20, each with a RED-first spec:

Broken features
- api_templates: RequestExample no longer aborts with JSON::ParserError on a
  non-JSON String body (compact_json only compacts valid JSON, else verbatim).
- registry: Registry#nav_items now guards view_class + honors
  group_by_attribute, so a hash-entries registry no longer NoMethodErrors.
- install_generator: the stimulus-registration fallback no longer writes an
  eager line when the site lazy-loads (double-registration).

Wrong output
- section: page-scoped anchor-id de-dup (shared Phlex render context) so two
  same-slug sections no longer emit duplicate ids that break the TOC/scroll-spy.
- request_example: drop a colon-less auth header instead of emitting `-H "X: "`.
- markdown_export/{blocks,inline,table}: correct callout title export, fence
  backtick-containing inline code, and size GFM tables to the widest row.
- code: stamp the filename title bar with the md-skip marker so it no longer
  leaks above the fence in the .md twin.
- error_table: treat a blank :param string as absent (no empty <code>, no
  spurious Param column).
- search_index: fence-aware section split — a `## ` inside a code fence is no
  longer indexed as a phantom heading.
- shortcut: de-dup a chord that sets both :mod and :ctrl ("Ctrl Ctrl" → "Ctrl").

Papercuts / cosmetics
- sidebar: brand link honors config.brand_href (matched Shell#topbar).
- table: malformed typed cells raise instead of leaking the literal array.
- field_table: a field with no :description degrades to the em-dash placeholder.
- prop_table: a malformed empty row no longer emits an empty <code>.
- page: on_page defaults to DocsKit.configuration.on_page_default (matches doc).
- code: comment separates code_lexer_aliases (highlighting) from
  code_language_labels (Example tab labels).
- page_generator: no redundant slug:/view: keywords when they match the derived
  defaults.
- example_spec: comment corrected — :curl resolves to Rouge's console lexer.

538 examples, 0 failures; rubocop clean.

Refs #8

Claude-Session: https://claude.ai/code/session_01FPQb6z3YwcKRMbvoJhdxnX
@mhenrixon mhenrixon self-assigned this Jul 3, 2026
@mhenrixon mhenrixon added the bug Something isn't working label Jul 3, 2026
@mhenrixon mhenrixon merged commit e95e628 into main Jul 3, 2026
4 checks passed
@mhenrixon mhenrixon deleted the feature/dogfood-docs-and-bugfixes branch July 4, 2026 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant