Skip to content

fix(delivery): stop delivered HTML from requesting Google Fonts - #249

Open
shahidbeig-a11y wants to merge 4 commits into
tt-a1i:mainfrom
shahidbeig-a11y:cursor/no-google-fonts-delivered-html-85e8
Open

fix(delivery): stop delivered HTML from requesting Google Fonts#249
shahidbeig-a11y wants to merge 4 commits into
tt-a1i:mainfrom
shahidbeig-a11y:cursor/no-google-fonts-delivered-html-85e8

Conversation

@shahidbeig-a11y

@shahidbeig-a11y shahidbeig-a11y commented Aug 31, 2026

Copy link
Copy Markdown

Problem and value

Fixes #242

Delivered diagram HTML linked fonts.googleapis.com and fonts.gstatic.com, so air-gapped or offline viewers silently fell back to different typography with no diagnostic. The SVG export path already used offline-first local() faces; this applies the same contract to delivered HTML.

Scope

  • What changed:
    • Removed the async Google Fonts <link> tags from archify/assets/template.html.
    • Added offline-first @font-face rules that prefer locally installed JetBrains Mono and fall through to the existing system monospace stack.
    • Added archify/test/offline-typography.test.mjs to assert the template and deliver output request no Google Font hosts.
    • Regenerated the five golden HTML examples (archify/examples/ + examples/), examples/web-app.html (template freshness), and archify.zip so golden.mjs and zip-freshness CI pass.
  • What deliberately did not change:
  • No unrelated changes: confirmed.

Stability impact

  • Compatibility and migration risk: low. Typography now prefers local JetBrains Mono when installed and otherwise uses the same fallback stack that already applied when Google Fonts were unreachable.
  • Renderer, validator, package, or generated-artifact risk: template-owned HTML bytes change in golden examples and the distributable zip; topology, validation, and viewer behavior are unchanged.
  • Failure behavior and rollback path: revert these commits to restore the previous remote-font behavior.

Tests run

  • node --test test/offline-typography.test.mjs — 2 passed, 0 failed.
  • node test/golden.mjs — all checks passed (10 golden renders, 9 schema enforcement, 2 template freshness, 7 version sync).
  • scripts/build-zip.sh /tmp/archify-built.zip then cmp -s /tmp/archify-built.zip archify.zip — match.
  • node bin/archify.mjs deliver architecture examples/web-app.architecture.json /tmp/issue-242-after.html --json then rg -c "fonts\.googleapis|fonts\.gstatic" /tmp/issue-242-after.html0 matches.

Visual evidence

Not applicable. Font-loading contract only; diagram geometry and viewer behavior are unchanged.

Before (template on main): 3 Google Font host references (fonts.googleapis.com, fonts.gstatic.com).

After (deliver output): 0 external font host references; offline-first @font-face with local() sources.

Generated artifacts

  • archify/examples/*.html (5 golden examples)
  • examples/*.html (5 golden examples + web-app.html)
  • archify.zip

Checklist

  • I used a minimal focused change and preserved existing typed JSON behavior unless the issue requires a contract change.
  • I ran the relevant targeted tests and npm test in archify/.
  • I added or updated a regression test for behavioral changes.
  • I checked generated artifacts and package freshness when their sources changed.
  • I removed secrets, private repository content, and customer data from fixtures and screenshots.

@cursor
cursor Bot force-pushed the cursor/no-google-fonts-delivered-html-85e8 branch from 76b7d1e to bc5323d Compare August 31, 2026 19:59
@shahidbeig-a11y
shahidbeig-a11y marked this pull request as ready for review August 31, 2026 20:01
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 31, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-08-31T20:16:06.336091Z 2c2d50b Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bc5323d7cb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

/* Offline-first typography: prefer a locally installed JetBrains Mono and
fall through to the system monospace stack. Delivered HTML must not
request third-party font hosts. */
@font-face { font-family: 'JetBrains Mono'; font-weight: 400; src: local('JetBrains Mono'), local('JetBrainsMono-Regular'); }

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Rebuild the distributed artifacts after changing the template

Changing the authoritative template without regenerating the checked-in examples and archify.zip leaves this commit unable to pass its repository gates: archify/test/golden.mjs rejects all five stale example renders, while the CI zip-freshness job rebuilds and byte-compares the archive. The archive in this commit also still embeds the removed Google Fonts links, so users installing the documented ZIP distribution do not receive the fix; regenerate the golden examples and then rebuild archify.zip.

Useful? React with 👍 / 👎.

@shahidbeig-a11y
shahidbeig-a11y marked this pull request as draft August 31, 2026 20:12
@shahidbeig-a11y
shahidbeig-a11y marked this pull request as ready for review August 31, 2026 20:13
@cursor
cursor Bot force-pushed the cursor/no-google-fonts-delivered-html-85e8 branch from 2c2d50b to f3646a0 Compare September 1, 2026 17:23
cursoragent and others added 2 commits September 2, 2026 17:06
Replace async Google Fonts links in the viewer template with offline-first
local() @font-face declarations and the existing system monospace fallback
stack. Add a regression test that asserts the template and deliver output
request no Google Font hosts.

Fixes tt-a1i#242

Co-authored-by: shahidbeig-a11y <shahidbeig-a11y@users.noreply.github.com>
Refresh the five golden HTML examples in archify/examples and examples,
plus examples/web-app.html for template freshness, and rebuild archify.zip
so golden.mjs and zip-freshness CI pass with the offline-first font stack.

Co-authored-by: shahidbeig-a11y <shahidbeig-a11y@users.noreply.github.com>
@cursor
cursor Bot force-pushed the cursor/no-google-fonts-delivered-html-85e8 branch from f3646a0 to f28069d Compare September 2, 2026 17:07
@JINITAIMEI121

Copy link
Copy Markdown

Hi! I verified both open fixes for #242 locally (this PR and #256) to help move the decision along. Environment: macOS arm64, Node v24.19.0, checked out at head f28069d (base 06dd052).

What works

npm test currently fails at head (2 of 1028 tests)

✖ generated proof gallery matches its sources, receipts, and checked-in artifacts   (archify/test/gallery.test.mjs)
✖ checked-in Checkout compare artifact is reproducible from its authoritative inputs (archify/test/architecture-delta.test.mjs)

I saw the PR body notes that gallery artifacts, README proof media, and the checkout delta are deliberately not regenerated here. The catch is that test/gallery.test.mjs and test/architecture-delta.test.mjs assert exactly those checked-in artifacts against the new template, so the suite is red as-is (baseline main@06dd052 is 995 pass / 0 fail). The required test (18/20/22/24) checks are still "waiting for status", so this may not have surfaced yet — either those artifacts need regenerating in this PR, or the tests need a scope note, before it can merge green.

One design question

The replacement @font-face blocks are local()-only. The viewer measures real font metrics rather than assuming them, so delivered geometry would depend on whether each reader happens to have JetBrains Mono installed locally (and which version). #256's description measures a 960px vs 987px reader column with/without the face — I haven't independently re-measured that, but the mechanism looks real, and producer/receiver reproducibility is part of what these artifacts promise. Worth a deliberate decision: embed the subset, or accept and document the variance.

Happy to re-run anything.

cursoragent and others added 2 commits September 2, 2026 17:57
Refresh checked-in gallery artifacts, checkout compare artifact/receipt,
and README proof media so gallery.test.mjs and architecture-delta.test.mjs
pass against the offline-first font template.

Co-authored-by: shahidbeig-a11y <shahidbeig-a11y@users.noreply.github.com>
Drop hosted font links from scripts/gallery-template.html in favor of
offline-first local() JetBrains Mono and system display/body stacks, then
regenerate docs/gallery.html.

Co-authored-by: shahidbeig-a11y <shahidbeig-a11y@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Delivered HTML fetches Google Fonts, so an offline or air-gapped viewer silently loses the typography

3 participants