feat(docs): prod-faithful dev loop, mermaid cache, favicon, doc fixes#277
Conversation
…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>
# Conflicts: # CHANGELOG.md
|
Need the big picture first? Review this PR in Change Stack to see what changed before going file by file. Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThis 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. ChangesTheme-Adaptive Favicon and Production-Faithful Docs Dev Loop
🎯 3 (Moderate) | ⏱️ ~25 minutes Note 🎁 Summarized by CodeRabbit FreeYour 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 |
|
📚 Docs preview is live: https://0a4f7e85-wavehouse-docs.wave-rf.workers.dev Updated for commit 12a734c |
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>
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>
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>
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>
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 devskips everything the Cloudflare Worker adds in production —cloudflare-md-routercontent negotiation (.mdtwins), the pagefind search index,starlight-llm-toolsoutputs — so the de-facto workflow had become manually cyclingmake build-docs && make preview-docs. The dev loop now rebuilds on save (debounced; mid-build saves coalesce) into a.dev-dist/staging dir, syncs intodist/only on green builds (plain node fs — no rsync or other external tools), and serves throughwrangler dev --live-reloadon :4321 (DOCS_PORToverrides): the browser refreshes itself per build, and a failed build keeps serving the last good site (red banner + terminal bell).starlight-links-validatoris skipped in watch builds so mid-edit dangling links don't block previewing (DOCS_WATCH_STRICT=1keeps it on; CI andmake build-docsenforce links unchanged). The raw HMR server stays available aspnpm 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.mjsnow usesastro-themed-mermaidv0.2.0'srehypeMermaidexport (released as part of this work) —rehype-mermaidbehind 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-placehrefmutation is honored only transiently; and Chromium's scorer commits an exact-size.icoover asizes="any"SVG (verified against the profileFaviconsSQLite, contradicting the standard blog advice). Fixed via the restored icon-link pair, statically-coloredfavicon-{light,dark}.svgbrand-kit variants, and aHead.astrolive-swap script (fresh link node per repaint,.icoremoved from live candidates). No-JS and Safari ≤18 keep working fallbacks.4. CI/review-automation docs refresh (commit 0b54c50):
development.md§CI & review automation andCONTRIBUTING.mdstill describedpr-title.yml/Validate,Check/Buildchecks,project-orchestrator.yml, andlabel.yml— all replaced byhousekeeping.yml/ the singleCIjob / 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-validatorneeds no browser; onlyrehype-mermaiddoes).Test plan
Accept: text/markdowntwin negotiation,/llms.txt, pagefind, failed builds keep serving the previous dist, file↔directory type-flip recovery in the sync,DOCS_WATCH_STRICT=1fails loudly on a planted broken link, SIGINT/SIGTERM/pkillteardown leaves no orphansastro:build:donetheme patch counts unchanged; v0.2.0 ships 12 unit tests covering hit/miss/harvest/re-id/corruption pathsFaviconsDB ground truth, Playwright DOM swap checks both directions + across view transitions, manual Brave/Firefox/Safarigh api),housekeeping.yml,ci.yml, andadmin-approval.ymlby the pre-push review gatemake cigreen for every pushed tree (tree-keyed markers); both pre-push reviewers (code + docs) at ship_it for HEADRelated issues
🤖 Generated with Claude Code