fix: generate favicon set (was 5 dead refs → 404 on every site) - #3
Merged
Conversation
index.html referenced favicon.ico, favicon-16/32.png, apple-touch-icon.png, safari-pinned- tab.svg — none existed in public/ (caught by validate-assets, PR #1). Every cloned site shipped 404'd favicons (violates checklist #23). scripts/generate-favicons.mjs generates the full set brand-colored from _brand.json (brandHue → HSL→RGB) with ZERO external deps — pure node:zlib for valid RGBA PNGs (rounded square), a BMP/PNG-in-ICO writer, and SVG (rich, brand bg + business initial) + safari mask. Wired into prebuild so it regenerates per brand and vite copies public/ → dist/. Also added an SVG-favicon <link> (modern browsers). Committed brand-default placeholders so the repo is clean even before a per-brand rebuild. Verified on a clean build: all 6 favicons land in dist/, 0 dead refs, valid PNG/ICO magic bytes. validate-assets (PR #1) now passes the favicon gate. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
ProfessorManhattan
added a commit
that referenced
this pull request
Aug 23, 2026
…n't blank the page
Add <SafeSection>, a section-scoped error boundary, and wrap every top-level
section of Home in it. Root-cause fix for the iteration-1 failure that scored a
generated site 3.2/10: a render-crashing TypeError ("Cannot read properties of
undefined (reading 'primary')") blanked the ENTIRE page below the hero.
Why the existing top-level ErrorBoundary wasn't enough: it wraps the whole app,
so a throw in ANY section unwinds the entire tree and swaps in the error card —
header, footer, hero, NAP, every sibling section, and every SEO landmark vanish
with it. SafeSection contains the blast radius to one section: the crash is
caught locally, that section fails soft (renders null in prod, a compact notice
in dev), and every sibling section + the header/footer landmarks + the
pre-rendered SEO head keep painting. This turns a whole-page blank into a single
missing section — the difference between a 3/10 and a shippable page.
Directly addresses all three iter-1 weaknesses:
- #1 render-crash blanking everything below the hero — isolated per section.
- #2 SEO head + header/main/footer landmarks depended on the same crashing
render — they now survive any section throw.
- #3 services / NAP / booking / CTA never rendered — a crash in one no longer
takes down the others.
- src/components/SafeSection.tsx — the fail-soft primitive (telemetry to
gtag/posthog, dev-only inline notice, optional custom fallback).
- src/pages/Home.tsx — each section wrapped; flag-gating preserved.
- src/pages/AGENTS.md — hard rule so future generations keep the wrappers.
- tests/unit/SafeSection.test.tsx — 4 tests (createRoot + act, no new deps):
healthy passthrough, sibling-survives isolation, custom fallback, telemetry.
Gate: npm install --legacy-peer-deps && npm run build → exit 0, dist/ produced;
vitest 96 passed (92 baseline + 4 new). Additive, zero new deps.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug (caught by validate-assets in #1)
index.htmlreferenced 5 favicons (favicon.ico,favicon-16/32.png,apple-touch-icon.png,safari-pinned-tab.svg) that don't exist inpublic/→ every cloned site shipped 404'd favicons (checklist #23 violation).Fix (zero deps, verified)
scripts/generate-favicons.mjsgenerates the full set, brand-colored from_brand.json(brandHue→ HSL→RGB), using onlynode:zlib— real RGBA PNGs (rounded square) + a PNG-in-ICO + SVG (brand bg + business initial) + safari mask. Wired intoprebuild(regenerates per brand; vite copiespublic/→dist/). Added an SVG-favicon<link>for modern browsers.Verified on a clean build: all 6 favicons land in
dist/, 0 dead refs, valid PNG/ICO magic bytes.validate-assets(#1) now passes the favicon gate. Brand-default placeholders committed so the repo is clean even pre-rebuild.🤖 Generated with Claude Code