betterwithage commited on
Commit
e59bd42
·
verified ·
1 Parent(s): 78d0e50

docs(audit): add warroom RESULT_FONTS_FIX.md (G7 0-CDN remediation report). Mirrors GitHub main 7b01be4.

Browse files
team/AUDIT/warroom/RESULT_FONTS_FIX.md ADDED
@@ -0,0 +1,181 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # RESULT — Runtime-CDN Doctrine Fix (G7: 0 runtime CDN)
2
+
3
+ **Owner:** Senior front-end engineer, SZL Holdings
4
+ **Date:** 2026-06-14
5
+ **Scope:** Repos `szl-holdings/a11oy` + `szl-holdings/killinchu`; Spaces `SZLHOLDINGS/a11oy` + `SZLHOLDINGS/killinchu`
6
+ **Defect class:** G7 violation — surfaces loading third-party assets (Google Fonts, esm.sh modules) from external runtime CDNs via hard-coded `<link>`/import tags instead of self-hosted, same-origin assets.
7
+
8
+ ---
9
+
10
+ ## 1. Summary
11
+
12
+ QA Team A's full-tab walk found a runtime-CDN doctrine violation: `a11oy /nemo` and
13
+ `a11oy /estate-hologram` loaded **Space Grotesk / JetBrains Mono** from
14
+ `fonts.googleapis.com` + `fonts.gstatic.com` via `<link>` tags. A full 0-CDN sweep of
15
+ the **served** a11oy HTML surfaced additional runtime-CDN loads (esm.sh three.js on the
16
+ 3D surfaces, including the `/chaski` reception page) and several bare font-family
17
+ declarations missing fallbacks. All were remediated to **0 external runtime URLs** using
18
+ the existing self-hosted patterns already shipped on the clean pages. The same quick
19
+ grep + fix was applied to `killinchu`. The doctrine guard was additively extended to
20
+ cover the QA-flagged surfaces so CI catches any regression. Every fix is
21
+ **ADDITIVE / surgical** — no existing gate weakened, no behavior changed.
22
+
23
+ **Live result: ZERO external runtime URLs on every served surface (verified with Playwright).**
24
+
25
+ ---
26
+
27
+ ## 2. What replaced the CDN assets
28
+
29
+ ### 2a. Fonts (the named G7 defect)
30
+ - Removed every external Google Fonts `<link>` (`preconnect` + `css2` stylesheet) tag.
31
+ - Replaced with the **existing self-hosted `@font-face` bundle** that the clean pages
32
+ (e.g. `pages/console.html`) already use:
33
+ - `@font-face { font-family:'Space Grotesk'; src:url('/vendor/fonts/SpaceGrotesk.woff2') format('woff2'); ... }`
34
+ - `@font-face { font-family:'JetBrains Mono'; src:url('/vendor/fonts/JetBrainsMono.woff2') ... }`
35
+ - These `.woff2` blobs are the vendored assets in `_vendor_blobs.py`, served same-origin
36
+ by the `/vendor/fonts/{fname}` route on the global FastAPI app — reachable from every surface.
37
+ - Added geometric **system fallback stacks** to every font declaration so the surface still
38
+ renders correctly even before/without the web font:
39
+ - sans: `system-ui, -apple-system, "Segoe UI", Roboto, sans-serif`
40
+ - mono: `ui-monospace, "SF Mono", Menlo, monospace`
41
+ - Bare `'Inter'` declarations (Inter is **not** vendored) were given a system fallback
42
+ rather than introducing a new CDN load.
43
+
44
+ ### 2b. esm.sh three.js (additional runtime-CDN loads found in the sweep)
45
+ - Replaced `https://esm.sh/three@…` script imports with **bare specifiers resolved by an
46
+ importmap** to the same-origin vendored three.js **r170**:
47
+ - `"three"` → `/static/3d/vendor/three/three.module.min.js`
48
+ - `"three/webgpu"` → `/static/3d/vendor/three/three.webgpu.min.js`
49
+ - `"three/addons/"` → `/static/3d/vendor/three/addons/`
50
+ - vendored bundle served by `szl3d_holographic.py` at `/static/3d/vendor/*`
51
+ (same pattern already shipped on `throne-room`).
52
+ - `OrbitControls` now imports from `three/addons/controls/OrbitControls.js` (vendored).
53
+
54
+ No new font/asset file was added (all vendored blobs already exist and are already
55
+ served/baked), so **no `Dockerfile` COPY change and no `hf-sync.yml` list change were required.**
56
+
57
+ ---
58
+
59
+ ## 3. Files fixed
60
+
61
+ ### a11oy — font CDN removed (`<link>` → self-hosted `@font-face` + system fallback)
62
+ - `web/nemo.html` — **PRIMARY defect** (Space Grotesk + JetBrains Mono via `<link>`)
63
+ - `web/estate-hologram.html` — same defect (GitHub/HF source; box redeploy handled by Forge)
64
+ - `web/agentic-gpu.html`, `web/fleet-c2.html`, `web/living-anatomy.html`,
65
+ `web/v4_fleet_panel.html`, `web/elite_console.html`, `web/console_index.html`
66
+ - `pages/landing.html`, `pages/observability.html`, `pages/superpowers.html`,
67
+ `pages/warhacker.html`, `pages/wires.html`
68
+ - `console/index.html`, `index.html` (root)
69
+
70
+ ### a11oy — esm.sh three.js removed (esm.sh import → vendored importmap)
71
+ - `pages/throne-room.html` + `pages/throne-room.js`
72
+ - `console/throne-room.html` + `console/throne-room.js`
73
+ - `pages/wasi-rikuq.html`
74
+ - `pages/chaski.html` — **follow-up:** `/chaski` is a routed served surface (FileResponse)
75
+ that loaded three.js + OrbitControls from esm.sh at runtime. The runtime module renders
76
+ the R3F recipe with three.js **core only**, so the dead `@react-three/fiber|drei`,
77
+ `react`, `react-dom` importmap entries were dropped and the map collapsed to the vendored
78
+ three.js + addons specifiers. Now 0 external requests.
79
+
80
+ ### a11oy — doctrine guard hardened (additive)
81
+ - `tests/test_zero_cdn_guard.py` — extended `SERVED_GLOBS` to add the QA-flagged routed
82
+ surfaces (`web/nemo.html`, `web/estate-hologram.html`, `pages/chaski.html`) so CI now
83
+ fails the build on any future regression to an external font/module CDN on exactly the
84
+ surfaces QA had to find by hand. Named individually (NOT `web/*.html`) so unrouted build
85
+ artifacts are deliberately excluded.
86
+
87
+ ### killinchu — font CDN removed
88
+ - `static/landing.html` — replaced Google Fonts `<link>` with the existing self-hosted
89
+ `/vendor/fonts/fonts.css` pattern. The three served python pages
90
+ (`killinchu_elite_console.py`, `killinchu_maritime_view.py`, `killinchu_mesh_view.py`)
91
+ were already clean.
92
+
93
+ ---
94
+
95
+ ## 4. Deliberately NOT changed (documented, out of scope / no runtime impact)
96
+ - **`a11oy web/console.html`, `web/operator.html`** — contain CDN refs (cdnjs three r128,
97
+ esm.sh) but are **unused build artifacts**: NOT routed by `_ptg_serve` and have no
98
+ FileResponse route, so they are never served at runtime. Left untouched; excluded from
99
+ the guard glob on purpose.
100
+ - **a11oy root `index.html` rosie-widget** — references `szlholdings-readme.static.hf.space`,
101
+ which is an **own-origin `*.hf.space`** asset, not an external CDN. Left untouched.
102
+ - **killinchu non-routed / build-artifact CDN hits** (`web/console.html`, `web/operator.html`,
103
+ `web/v4_fleet_panel.html`, `static/drone-3d.html`, `static/3d/killinchu_airspace/index.html`,
104
+ `live_wires.html`, `static/assets/index-*.css`, `static/vendor/deck.min.js`) — not routed at
105
+ runtime; no runtime-CDN exposure. Left untouched.
106
+
107
+ ---
108
+
109
+ ## 5. Commit SHAs
110
+
111
+ ### a11oy — GitHub (`szl-holdings/a11oy`, branch `main`)
112
+ | Commit | Content |
113
+ |---|---|
114
+ | `0ce331f82cd734323570231516c60a3f7c91e9c1` | Initial 0-CDN fix — 19 files (fonts + esm.sh three.js) |
115
+ | `c495132eecb630e1b7d28bfe4d1b56053ef8bfd6` | Follow-up — `pages/chaski.html` self-host three.js |
116
+ | `feac1a8e640a846a74ea76c22d8ca64861dd3e99` | Additive guard extension — `tests/test_zero_cdn_guard.py` |
117
+
118
+ ### a11oy — HF Space (`SZLHOLDINGS/a11oy`, branch `main`, NDJSON commits)
119
+ | Commit | Content |
120
+ |---|---|
121
+ | `7153e35ba07ecc253d1b91380356f34d31858299` | Initial 0-CDN fix mirror — 19 files |
122
+ | `1c4bdd783025bb908ecdbb2ba766aa42cdc966e0` | `pages/chaski.html` mirror |
123
+ | `aa3154de427e169af12b2f591e9e0a02d4ad0fd9` | Guard extension mirror |
124
+
125
+ Factory restart (`POST /restart?factory=true`) issued to bake the `web/*.html`
126
+ (`image_only_assets`) changes; Space rebuilt and is **RUNNING**.
127
+
128
+ ### killinchu — GitHub (`szl-holdings/killinchu`, branch `main`)
129
+ - `9d489ea77b4ae06d3795956a4855d530ff7075bf` — `static/landing.html`
130
+
131
+ ### killinchu — HF Space (`SZLHOLDINGS/killinchu`)
132
+ - `87758dfb37146338b51ab80623ba7d4f8c70d04c` — `static/landing.html` mirror; factory restart issued; Space **RUNNING**.
133
+
134
+ > Note: Forge was committing concurrently. Every push fetched a **fresh HEAD** before
135
+ > writing the tree/commit and used 409/000 retry; all pushes were **additive/surgical**
136
+ > over the live tip (observed HEADs advanced between pushes — e.g. `e993047` → `c495132`).
137
+
138
+ ---
139
+
140
+ ## 6. Live 0-CDN verification (Playwright, per surface)
141
+
142
+ Verifier: `/tmp/verify_cdn.mjs` (chromium, `networkidle`, 000-retry). It fails on any
143
+ banned host substring **and** any external (non-`*.hf.space`) network request, and reports
144
+ the computed body font + rendered text length.
145
+
146
+ ### a11oy — `https://szlholdings-a11oy.hf.space`
147
+ | Surface | HTTP | External runtime URLs | Computed font | Renders |
148
+ |---|---|---|---|---|
149
+ | `/nemo` | 200 | **0** | `"Space Grotesk", system-ui, …` | yes (17,540 chars) |
150
+ | `/estate-hologram` | 200 | **0** | `ui-monospace, SFMono-Regular, Menlo, …` | yes (2,367 chars) |
151
+ | `/chaski` | 200 | **0** | `-apple-system, BlinkMacSystemFont, …` | yes (1,394 chars) |
152
+ | `/throne-room` | 200 | **0** | `Inter, ui-sans-serif, system-ui, …` | yes |
153
+ | `/wasi-rikuq` | 200 | **0** | `-apple-system, …` | yes |
154
+ | `/agentic-gpu` | 200 | **0** | `"Space Grotesk", Georgia, serif` | yes |
155
+ | `/fleet-c2` | 200 | **0** | `"Space Grotesk", Georgia, serif` | yes |
156
+ | `/living-anatomy` | 200 | **0** | `"Space Grotesk", Georgia, serif` | yes |
157
+ | `/superpowers` | 200 | **0** | — | yes |
158
+ | `/warhacker` | 200 | **0** | — | yes |
159
+ | `/wires` | 200 | **0** | — | yes |
160
+ | `/observability` | 200 | **0** | — | yes |
161
+ | `/landing` | 200 | **0** | — | yes |
162
+
163
+ ### killinchu — `https://szlholdings-killinchu.hf.space`
164
+ | Surface | HTTP | External runtime URLs | Computed font | Renders |
165
+ |---|---|---|---|---|
166
+ | `/landing` | 200 | **0** | `"Space Grotesk", system-ui, …` | yes (5,601 chars) |
167
+
168
+ **Across all surfaces tested: `bannedHits = []`, `externalCount = 0`, `linkTags = []`,
169
+ `scriptTags = []`.** No regression — every page returns 200 and renders content with the
170
+ correct self-hosted / system font applied.
171
+
172
+ ---
173
+
174
+ ## 7. Doctrine guards — GREEN
175
+ - `tests/test_zero_cdn_guard.py` — **3 passed** (now covering /nemo, /estate-hologram, /chaski + console + static-vendor).
176
+ - `test_szl3d_holographic.py` + `test_energy_ops_dashboard.py` — **25 passed** combined.
177
+ - All embedded JS validated with `node --check`; all Python with `ast.parse` before push.
178
+
179
+ ---
180
+
181
+ *ADDITIVE / surgical throughout. No keys committed. No existing gate weakened.*