Skip to content

feat(docs): prod-faithful dev loop, mermaid cache, favicon, doc fixes#277

Merged
EricAndrechek merged 17 commits into
mainfrom
docs-spotfixes
Jun 5, 2026
Merged

feat(docs): prod-faithful dev loop, mermaid cache, favicon, doc fixes#277
EricAndrechek merged 17 commits into
mainfrom
docs-spotfixes

Conversation

@EricAndrechek

@EricAndrechek EricAndrechek commented Jun 5, 2026

Copy link
Copy Markdown
Member

Summary

Four change sets, one theme: the docs workflow now behaves like production, fast.

1. Production-faithful make dev-docs (docs/scripts/dev.mjs, new): astro dev skips everything the Cloudflare Worker adds in production — cloudflare-md-router content negotiation (.md twins), the pagefind search index, starlight-llm-tools outputs — so the de-facto workflow had become manually cycling make build-docs && make preview-docs. The dev loop now rebuilds on save (debounced; mid-build saves coalesce) into a .dev-dist/ staging dir, syncs into dist/ only on green builds (plain node fs — no rsync or other external tools), and serves through wrangler dev --live-reload on :4321 (DOCS_PORT overrides): the browser refreshes itself per build, and a failed build keeps serving the last good site (red banner + terminal bell). starlight-links-validator is skipped in watch builds so mid-edit dangling links don't block previewing (DOCS_WATCH_STRICT=1 keeps it on; CI and make build-docs enforce links unchanged). The raw HMR server stays available as pnpm run start.

2. Per-diagram Mermaid render cache: every build re-rendered all 17 diagrams through headless Chromium, diagrams changed or not. docs/astro.config.mjs now uses astro-themed-mermaid v0.2.0's rehypeMermaid export (released as part of this work) — rehype-mermaid behind a content-addressed per-diagram disk cache. Warm rebuilds drop 6–7s → ~3.7s, a single-diagram edit re-renders only its page, and output is byte-identical modulo SVG ids. Save → refreshed browser is ~4s end to end.

3. Theme-adaptive favicon that actually displays (commit 19e7a10): four stacked causes peeled — #193 dropped the sizes="any" SVG link (Chromium then picks the .ico); Chromium rasterizes an SVG favicon once and never re-renders on theme flip (crbug.com/1208277); in-place href mutation is honored only transiently; and Chromium's scorer commits an exact-size .ico over a sizes="any" SVG (verified against the profile Favicons SQLite, contradicting the standard blog advice). Fixed via the restored icon-link pair, statically-colored favicon-{light,dark}.svg brand-kit variants, and a Head.astro live-swap script (fresh link node per repaint, .ico removed from live candidates). No-JS and Safari ≤18 keep working fallbacks.

4. CI/review-automation docs refresh (commit 0b54c50): development.md §CI & review automation and CONTRIBUTING.md still described pr-title.yml/Validate, Check/Build checks, project-orchestrator.yml, and label.yml — all replaced by housekeeping.yml / the single CI job / native Projects v2 board workflows (May consolidation, #115). Rewritten against the live config, the 72-char title cap documented, and a Chromium misattribution corrected (starlight-links-validator needs no browser; only rehype-mermaid does).

Test plan

  • Dev loop verified end-to-end in-session: wrangler hot-pickup of modified and new assets, Accept: text/markdown twin negotiation, /llms.txt, pagefind, failed builds keep serving the previous dist, file↔directory type-flip recovery in the sync, DOCS_WATCH_STRICT=1 fails loudly on a planted broken link, SIGINT/SIGTERM/pkill teardown leaves no orphans
  • Mermaid cache profiled cold (5.8s, 17 entries harvested) and warm (~3.5s); cached output diffed byte-identical to uncached modulo ids; astro:build:done theme patch counts unchanged; v0.2.0 ships 12 unit tests covering hit/miss/harvest/re-id/corruption paths
  • Favicon: Chromium profile Favicons DB ground truth, Playwright DOM swap checks both directions + across view transitions, manual Brave/Firefox/Safari
  • Docs rewrite verified claim-by-claim against the live ruleset (gh api), housekeeping.yml, ci.yml, and admin-approval.yml by the pre-push review gate
  • make ci green for every pushed tree (tree-keyed markers); both pre-push reviewers (code + docs) at ship_it for HEAD

Related issues

🤖 Generated with Claude Code

EricAndrechek and others added 3 commits June 5, 2026 08:56
…tion

The favicon.svg has carried a prefers-color-scheme swap since the brand
kit landed, but no browser ever showed it: #193 dropped the sizes="any"
SVG icon link, so Chromium selected the static .ico, and Chromium only
rasterizes an SVG favicon once regardless (crbug.com/1208277).

- restore the explicit sizes="any" SVG icon link next to the
  numeric-sized .ico (the pair Chromium + Firefox both need)
- generate statically-colored favicon-{light,dark}.svg in the brand kit
- live-swap them from Head.astro on prefers-color-scheme changes,
  GitHub-style: replace the link node each time (in-place href mutation
  is only honored transiently) and remove the .ico from the live
  candidate list — Chromium's scorer otherwise commits the exact-size
  .ico over a sizes="any" SVG, verified via the profile Favicons DB
- keep the self-styling favicon.svg + .ico SSR markup for no-JS
  consumers; Safari ≤18 falls back to the root /favicon.ico auto-probe

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- CHANGELOG: Unreleased Fixed entry for the theme-adaptive favicon,
  superseding the favicon wiring described in the branding-pipeline entry
- generate.sh: lockup-*.svg are outlined to paths in place — the comment
  claimed they still hold <text>
- Makefile: branding-docs help text pointed at the wrong mark.svg path

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 5, 2026

Copy link
Copy Markdown

Need the big picture first? Review this PR in Change Stack to see what changed before going file by file.

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This PR adds theme-adaptive favicon support (static light/dark SVGs + runtime swap), implements a production-faithful rebuild-on-save docs dev loop (new Node script + Wrangler serving), and updates config, tooling, docs, and changelog entries to reflect these changes.

Changes

Theme-Adaptive Favicon and Production-Faithful Docs Dev Loop

Layer / File(s) Summary
Branding favicon asset generation
docs/scripts/branding/generate.sh
Extended branding generation to emit static favicon-light.svg and favicon-dark.svg SVG files alongside the existing theme-swapping favicon; updated comments and output reporting.
Astro head and config favicon setup
docs/astro.config.mjs
Removed direct rehype-mermaid import, updated Mermaid rehype plugin wiring to use mermaid.rehypeMermaid directly, added SVG favicon link to Starlight head with type="image/svg+xml" and sizes="any", and updated favicon option comment.
Runtime favicon theme swapping
docs/src/components/Head.astro, CHANGELOG.md
Added inline script in Head.astro to listen for OS color-scheme changes and Astro page-swap events, dynamically updating the favicon link between light and dark SVG variants; recorded favicon fix in changelog.
Dev rebuild loop orchestration
docs/scripts/dev.mjs
Introduced production-faithful development loop: watches src/, public/, and config files; debounces and manages concurrent rebuilds; syncs .dev-dist/ to served dist/ via prune/copy; spawns wrangler dev with live reload; implements coordinated shutdown via signals and exception handlers.
Configuration and tooling wiring
docs/package.json, docs/astro.config.mjs, Makefile, .gitignore, .vscode/launch.json
Updated pnpm dev to invoke docs/scripts/dev.mjs; bumped astro-themed-mermaid to v0.2.0; made starlightLinksValidator conditional on watch mode; updated Makefile dev-docs, build-docs, branding-docs help text and clean targets to remove .dev-dist/; added .dev-dist/ to ignore rules; added VSCode launch configs for dev loop and HMR server.
Contributor documentation and script updates
docs/src/content/docs/development.md, AGENTS.md, docs/scripts/screenshot.mjs, .github/workflows/admin-approval.yml
Updated contributor dev guide for make tools/Playwright/validator timing, expanded Conventional Commits breaking-change notation, documented admin-approval workflow rule, updated screenshot script to reference correct docs endpoint (:4321), and added docs targets to make help listing.
Changelog and homepage UI updates
CHANGELOG.md, docs/src/components/Hero.astro, docs/src/content/docs/index.mdx
Added Unreleased changelog bullets covering contributor-doc consolidation, favicon theme adaptation, SDK ordering behavior, dev loop production-faithful rebuild, and mermaid render-cache optimization; updated Hero.astro comments and license label casing; reformatted homepage card grid indentation.

🎯 3 (Moderate) | ⏱️ ~25 minutes


Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login.

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added documentation Improvements or additions to documentation area/docs Documentation, site/, README area/infra CI, build, deploy, Docker, release labels Jun 5, 2026
@github-actions

github-actions Bot commented Jun 5, 2026

Copy link
Copy Markdown

📚 Docs preview is live: https://0a4f7e85-wavehouse-docs.wave-rf.workers.dev

Updated for commit 12a734c

EricAndrechek and others added 2 commits June 5, 2026 13:56
make dev-docs no longer runs `astro dev`, whose dev server skips
everything the Cloudflare Worker adds in production (cloudflare-md-router
.md twins, pagefind search, starlight-llm-tools outputs) — the de-facto
workflow had become a manual build-docs + preview-docs cycle, restarted
by hand per change. docs/scripts/dev.mjs (new) now drives the loop: a
debounced full `astro build` per save into a .dev-dist/ staging dir,
synced in place into dist/ only on success (plain node fs — no rsync or
any other external tool), served through `wrangler dev --live-reload` on
:4321 (DOCS_PORT overrides) so the browser refreshes itself per green
build and a failed build keeps serving the last good site (red banner +
terminal bell). Watch set: src/, public/, astro.config.mjs,
tsconfig.json, package.json, .env*; wrangler watches worker/index.ts and
wrangler.jsonc itself. starlight-links-validator is skipped under
WAVEHOUSE_DOCS_WATCH=1 so mid-edit dangling links don't block previewing
every save — DOCS_WATCH_STRICT=1 keeps it on; CI and make build-docs
enforce links unchanged. The raw HMR server remains as `pnpm run start`,
and the VS Code launch config gains an entry for each.

Mermaid SSR re-rendered all 17 diagrams through headless Chromium on
every build, diagrams changed or not. astro.config.mjs now uses
astro-themed-mermaid v0.2.0's `rehypeMermaid` export — rehype-mermaid
behind a content-addressed per-diagram disk cache (keyed on diagram
source + render options + package versions, entries re-id'd to
content-derived ids). Measured: no-diagram-change rebuilds 6-7s → ~3.7s,
single-diagram edits re-render only their page, output byte-identical
modulo SVG ids; save → refreshed browser is ~4s end to end.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The contributor docs (development.md §CI & review automation,
CONTRIBUTING.md) still described the pre-consolidation pipeline:
pr-title.yml and a `Validate` check, `Check`/`Build` required contexts,
project-orchestrator.yml card movement, and label.yml — all replaced by
housekeeping.yml / the single `CI` job / native Projects v2 board
workflows (May 2026 consolidation, #115). Rewritten against the live
config: required checks are CI, PR housekeeping (Conventional Commits
title + 72-char cap, labeler step, reviewer assignment on open/ready),
and Admin approval; the inverted "Lint/Test not required (#57)" note is
dropped.

Also fixes a Chromium misattribution carried in prose and two Makefile
comments — starlight-links-validator needs no browser; only
rehype-mermaid does — and adds docs/.dev-dist/ to make clean's help text
and the development.md targets table.

Found by the docs-reviewer pre-push gate (5 MUST / 1 SHOULD / 1 MAY, all
addressed).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@EricAndrechek EricAndrechek changed the title fix(docs): theme-adaptive favicon that actually displays feat(docs): prod-faithful dev loop, mermaid cache, favicon, doc fixes Jun 5, 2026
EricAndrechek and others added 2 commits June 5, 2026 14:25
Round-2 reviewer findings: "nothing else uses a browser" overclaimed —
the manual scripts/screenshot.mjs QA helper launches the same Playwright
Chromium (scoped the claim to the docs *build* in development.md and the
install-playwright-docs Makefile comment), and development.md still
quoted AGENTS.md §"Review Response (MANDATORY)", renamed to §"Review
Response" in #129.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Both round-3 reviewers flagged the same single remainder: the bare
`scripts/screenshot.mjs` form added in 06d0a4b reads as repo-root
`scripts/` (which has no such file) in the root Makefile comment,
development.md's repo-root path convention, and the CHANGELOG entry.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added the dependencies Pull requests that update a dependency file label Jun 5, 2026
Two reviewer-flagged follow-ups from the docs-accuracy sweep:
admin-approval.yml's header claimed the ruleset's
required_approving_review_count is 0 — the live ruleset says 1 (any
collaborator); the status check is what makes one of those approvals
specifically an admin's. And AGENTS.md's `make clean` one-liner omitted
the docs build outputs (docs/dist/ predating this branch,
docs/.dev-dist/ added by it) that the Makefile help text lists.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added the github_actions Pull requests that update GitHub Actions code label Jun 5, 2026
@EricAndrechek EricAndrechek moved this from Backlog to In progress in WaveHouse Task Board Jun 5, 2026
EricAndrechek and others added 2 commits June 5, 2026 18:34
Post-wizard hardening of the PostHog integration:

- route analytics through the managed reverse proxy t.wave-rf.com and set
  ui_host so toolbar/app links still point at us.posthog.com
- commit public token/host fallbacks in posthog.astro: CI builds docs with
  no PUBLIC_POSTHOG_* env and docs/.env is gitignored, so the wizard's
  .env-only wiring shipped a dead snippet in production
- extract the index.mdx inline tracking script into
  HomepageCtaTracking.astro — MDX parses `{` as JSX expressions, so a raw
  <script is:inline> body fails `astro build` (acorn parse error)
- move the wizard's agent skill to repo-root .claude/skills/ (the only
  location discovered when sessions launch from the repo root) and fix the
  six markdownlint errors in its reference files

Verified: prod-faithful build without .env renders the relay host on every
page; headless-browser run confirms hero/footer/homepage click listeners
fire posthog.capture with the documented payloads and the ClientRouter
soft-nav $pageview (pushState) captures; relay accepts ingest POSTs (200).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- CHANGELOG: add the [Unreleased] entry for the analytics rework
- api.md: drop the stray 400 unknown-table row (handler returns 404)
- claude-code.md: inventory the vendored integration-astro-view-transitions
  skill in both .claude/ tables
- docs-prose.sh (+ AGENTS.md / docs-review.md lockstep lists): denylist the
  frozen wizard report as an internal artifact; correct its drifted file
  attributions (index.mdx → HomepageCtaTracking.astro)
- deployment.md: make clean comment now lists docs/.dev-dist/
- rename posthog.astro → PostHog.astro to match component naming

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@EricAndrechek EricAndrechek marked this pull request as ready for review June 5, 2026 23:07
@github-actions github-actions Bot requested a review from taitelee June 5, 2026 23:07
@EricAndrechek EricAndrechek merged commit 70c15b0 into main Jun 5, 2026
7 of 9 checks passed
@EricAndrechek EricAndrechek deleted the docs-spotfixes branch June 5, 2026 23:11
@github-project-automation github-project-automation Bot moved this from In progress to Done in WaveHouse Task Board Jun 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/docs Documentation, site/, README area/infra CI, build, deploy, Docker, release dependencies Pull requests that update a dependency file documentation Improvements or additions to documentation github_actions Pull requests that update GitHub Actions code

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants