ci: enforce the non-blocking font load in CI (finding b8f6046e942a) - #23
Conversation
There was a problem hiding this comment.
nish3451 has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.
📝 WalkthroughWalkthroughAdded a Chromium-based regression check for render-blocking fonts across six public pages. The check runs under the production CSP, validates paint and resource timing, and runs in CI with static wiring and documentation checks. ChangesRender-blocking font enforcement
Estimated code review effort: 3 (Moderate) | ~30 minutes Sequence Diagram(s)sequenceDiagram
participant CI
participant check-render-blocking.mjs
participant LocalServer
participant Chromium
participant GoogleFonts
CI->>check-render-blocking.mjs: run browser regression check
check-render-blocking.mjs->>LocalServer: serve public pages with production CSP
check-render-blocking.mjs->>Chromium: open six pages
Chromium->>GoogleFonts: request css2 stylesheet
check-render-blocking.mjs->>GoogleFonts: delay and stub response
Chromium-->>check-render-blocking.mjs: return paint and resource timing
check-render-blocking.mjs-->>CI: report results and exit status
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/evidence/render-blocking-fonts-2026-08-08.md`:
- Line 101: Correct the date in the “CI enforcement” heading by replacing the
future August 9, 2026 date with August 8, 2026 or the actual merge date, while
preserving the heading text and formatting.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 9cb9c266-6a0c-474b-94d6-522bd23b3d66
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (5)
.github/workflows/ci.ymldocs/evidence/render-blocking-fonts-2026-08-08.mdpackage.jsonscripts/check-render-blocking.mjsscripts/check-site.mjs
| This is local static-server proof, not CI proof and not a hosted/live claim. The repo's CI (`npm test`) has no browser dependency, so it runs only the source-string guards in `scripts/check-site.mjs` plus the worker/UI contract tests; a render-blocking regression can therefore still ship if the served HTML drifts and CI stays green. The live tinystudio.io deployment was not measured here; a deployed page could differ (CDN cache, different asset versions). To be CI-proof this measurement would need a browser step added to CI (not done — out of scope). | ||
| This is local static-server proof, not CI proof and not a hosted/live claim. The repo's CI (`npm test`) has no browser dependency, so it runs only the source-string guards in `scripts/check-site.mjs` plus the worker/UI contract tests; a render-blocking regression can therefore still ship if the served HTML drifts and CI stays green. The live tinystudio.io deployment was not measured here; a deployed page could differ (CDN cache, different asset versions). | ||
|
|
||
| ### CI enforcement (added 2026-08-09) |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Correct the future date.
Line 101 states added 2026-08-09, but August 9, 2026 is in the future. Use August 8, 2026, or the actual merge date.
Proposed fix
-### CI enforcement (added 2026-08-09)
+### CI enforcement (added 2026-08-08)📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| ### CI enforcement (added 2026-08-09) | |
| ### CI enforcement (added 2026-08-08) |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@docs/evidence/render-blocking-fonts-2026-08-08.md` at line 101, Correct the
date in the “CI enforcement” heading by replacing the future August 9, 2026 date
with August 8, 2026 or the actual merge date, while preserving the heading text
and formatting.
…6e942a (#24) The render-blocking receipt documented a limitation: the live deployment was never measured. This closes that gap by recording a real-Chromium measurement of the six deployed tinystudio.io pages (2026-08-09): the Google Fonts css2 stylesheet is non-blocking everywhere, first paint does not wait for it, the only render-blocking resources are the site's own same-origin stylesheets, and fonts still load and apply. Dogfood finding b8f6046e942a (render-blocking resources on home) is verified resolved on the deployed site; the code fix and CI enforcement were merged as PRs #20 and #23.
…6e942a (#25) The render-blocking receipt documented a limitation: the live deployment was never measured. This closes that gap by recording a real-Chromium measurement of the six deployed tinystudio.io pages (2026-08-09): the Google Fonts css2 stylesheet is non-blocking everywhere, first paint does not wait for it, the only render-blocking resources are the site's own same-origin stylesheets, and fonts still load and apply. Dogfood finding b8f6046e942a (render-blocking resources on home) is verified resolved on the deployed site; the code fix and CI enforcement were merged as PRs #20 and #23.
…t current main and live (#35) The code-side fix (PR #20) and CI enforcement (PR #23) for dogfood finding b8f6046e942a ("Render-blocking resources on home") are already merged in origin/main. This lane re-verified the guarantee still holds after the subsequent page edits (heading hierarchy, apple-touch icon, schema.org, meta descriptions, canonical URLs, internal-link cleanup, App Store citation): - npm run check:render-blocking passes on all six pages (real Chromium, production CSP, css2 delayed 2500ms): css2 non-blocking, first paint never waits for it, no render-blocking resources other than the site's own same-origin stylesheets. - Fresh live measurement of the deployed pages confirms the same: css2 non-blocking on all six pages, only same-origin stylesheets render-block, fonts still load and apply under the production CSP. Nothing further to change; the receipt now records the closeout on the current head so the finding cannot be re-opened by tracker drift.
…t current main and live (#69) The code-side fix (PR #20) and CI enforcement (PR #23) for dogfood finding b8f6046e942a ("Render-blocking resources on home") are merged in origin/main; this lane re-verified the guarantee on the current head (536b3c9, 2026-08-10) after the commits that landed since the 2026-08-09 closeout (sitemap, preferred source pages, Agent Desk de-index, tap targets, CI runners): - npm run check:render-blocking passes on all six pages (real Chromium, production CSP, css2 delayed 2500ms): css2 non-blocking, first paint never waits for it, no render-blocking resources other than the site's own same-origin stylesheets, promoted sheet applied. - Fresh live measurement of the deployed pages confirms the same: css2 non-blocking on all six pages, only same-origin stylesheets render-block, fonts still load and apply under the production CSP. - Full npm test (82 tests) passes on this head. The receipt now records the re-verification on the current head so the tracker item can close.
What this is
Dogfood finding b8f6046e942a ("Render-blocking resources on home", run
20260808T074205Z) was fixed by PR #20 (same-origin
public/fonts.jspromotionof the Google Fonts css2 stylesheet, merged into main). That fix shipped static
source guards, but its own evidence receipt (
docs/evidence/render-blocking-fonts-2026-08-08.md)recorded the remaining gap: CI had no browser step, so a render-blocking
regression could still ship while CI stayed green. This PR closes that gap by
making the guarantee browser-proof in CI.
What changed
scripts/check-render-blocking.mjs(new) —npm run check:render-blocking.Serves the six public pages (index, audit, agents, pricing, specimen,
brief-requested) statically under the exact production CSP the worker emits,
intercepts the css2 request and delays it 2500ms (stubbed response — no
external network dependency), then asserts in real Chromium that:
renderBlockingStatus),stylesheets,
production CSP (
link.sheetset; the inline-onloadshape the CSPforbids leaves it null).
.github/workflows/ci.yml— runsnpx playwright install --with-deps chromium+npm run check:render-blockingas a CI step afternpm test.scripts/check-site.mjs— drift guards so the wiring cannot silentlydisappear: the check script must exist, package.json must expose
check:render-blocking, CI must run it, and the check's CSP string mustmirror
src/worker.jsexactly.package.json/package-lock.json—playwrightdevDependency(
^1.62.1, the version the original receipt was measured with).docs/evidence/render-blocking-fonts-2026-08-08.md— limitation sectionupdated to record the CI enforcement (the receipt's measurement itself is
untouched).
Negative test (the guard is real)
With a blocking
<link rel="stylesheet">to the font css2 temporarilyreintroduced on the homepage, the check fails with exit code 1: first paint is
held to the delayed css2 response (fcp 2780ms vs css2 end 2566ms) and the
external blocking resource is named. With the fixed pages, all six pages pass
(css2 non-blocking, fcp 130-300ms, no other blocking resources, sheet applied).
Deliberately unchanged
public/head markup,fonts.js, workerallow-list — already on main, not re-touched here.
npm teststays browser-free; the browser step is CI-only so local testruns do not require a browser install.
Verification (all passed locally)
npm run check— TinyStudio.io checks passed (incl. the new drift guards)npm run check:render-blocking— all six pages PASS; exit 1 verified with areintroduced blocking link
npm test— worker 15/15 + UI 15/15, 0 failuresgit diff --check— cleansgscan— exit 1, warnings only in pre-existing baseline files(
ci.yml:12-13mutable action tags,public/*.htmlcsrf/integrity,src/worker.jsnon-literal regexp,study/*.pyurllib); none in changed filesintended-outcome: the no-render-blocking-fonts guarantee holds even if the
served HTML drifts, because CI now proves it in a real browser under the
production CSP.
verify:
npm run check;npm run check:render-blocking;npm test;git diff --check;sgscan(baseline warnings only).Summary by CodeRabbit