Skip to content

feat(lint): font loading + invalid capture path composition rules#1004

Merged
miguel-heygen merged 1 commit into
mainfrom
feat/lint-rules-v2
May 21, 2026
Merged

feat(lint): font loading + invalid capture path composition rules#1004
miguel-heygen merged 1 commit into
mainfrom
feat/lint-rules-v2

Conversation

@ukimsanov
Copy link
Copy Markdown
Collaborator

Re-stacked version of #989 (silently lost in yesterday's Graphite stack-merge).

Content identical to what was approved on #989. Stacked on #1003 (capture pipeline).

What's in this PR

Three new composition lint rules:

  • google_fonts_import — flags @import of Google Fonts URLs (use captured fonts instead)
  • font_family_without_font_face — flags font-family: 'X' when there's no matching @font-face declaration
  • invalid_capture_path — flags ../capture/ paths in src/href attributes and inline scripts

All fix-hints use root-relative capture/assets/fonts/...woff2 paths.

Original review history

Layer 2 of 4. Once #1003 merges, GitHub will auto-update this PR's base to main.

Two new composition lint rules catching failure modes that recurred
across the 11-round website-to-video eval. Both ship with vitest
coverage; total lint suite goes from 148 to 151 tests.

**`fonts.ts` (new) — two warnings**

- `google_fonts_import`: composition loads fonts from
  `fonts.googleapis.com` via `<link>` or `@import url(...)`. External
  font requests fail in sandboxed/offline renders and add latency.
  Fix hint points to root-relative `capture/assets/fonts/...woff2`
  with a local `@font-face` declaration.
- `font_family_without_font_face`: CSS uses a font-family that
  isn't declared with `@font-face` and isn't in the auto-bundled
  font set (Inter, JetBrains Mono, etc.). Text would silently fall
  back to system-ui — the visual fidelity loss the eval kept hitting.
  Fix hint points to the captured woff2 files.

**`composition.ts` invalid_capture_path (new) — one error**

Sub-compositions live in `compositions/` but get served with the
project root as their base URL. `<img src="../capture/...">` works
on disk but 404s in Studio and renders. Errors with a fix hint
saying replace `../capture/` with root-relative `capture/`.
Three vitest cases: `<img>` triggers, multi-occurrence url()s are
counted, root-relative paths stay clean. Registry source files and
installed blocks are exempted.

**Wiring**

`hyperframeLinter.ts` runs the new fonts rules alongside the existing
rule set; the composition rule was added inline so it picks up
automatically.
miguel-heygen
miguel-heygen previously approved these changes May 21, 2026
Copy link
Copy Markdown
Collaborator

@miguel-heygen miguel-heygen left a comment

Choose a reason for hiding this comment

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

Content matches previously approved #989 (exact same diff stats +339/-0). Re-approved.

jrusso1020
jrusso1020 previously approved these changes May 21, 2026
Copy link
Copy Markdown
Collaborator

@jrusso1020 jrusso1020 left a comment

Choose a reason for hiding this comment

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

Re-approving the v2 re-cut.

Content equivalence verified — pulled the patch payloads via API for both #989 and #1004 (composition.ts, composition.test.ts, fonts.ts, fonts.test.ts, hyperframeLinter.ts) and the patches are character-identical: same +/- per file, same hunks, same lines. The PR is byte-equivalent to what was already approved on #989.

Merge via GitHub UI individually per Ular's commitment.

— Rames Jusso

Base automatically changed from feat/capture-pipeline-improvements-v2 to main May 21, 2026 18:28
@ukimsanov ukimsanov dismissed stale reviews from jrusso1020 and miguel-heygen May 21, 2026 18:28

The base branch was changed.

Copy link
Copy Markdown
Collaborator

@miguel-heygen miguel-heygen left a comment

Choose a reason for hiding this comment

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

Re-approved after rebase onto main (now includes #1003). Same single commit, content unchanged.

Copy link
Copy Markdown
Collaborator

@jrusso1020 jrusso1020 left a comment

Choose a reason for hiding this comment

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

Re-approving post-rebase onto main.

Content unchanged from prior approval: head SHA is still 2c9544f6d4... — same as my earlier approval. GitHub updated the base pointer to main (now at eb3c9d7e7f... after #1003 merged) without producing a rebase commit, because #1003's file set (packages/cli/src/capture/) is disjoint from #1004's (packages/core/src/lint/rules/). No content drift, no rebase conflict.

One CI artifact worth flagging before merge

regression-shards (shard-7, sub-composition-video style-18-prod raf-ball-render-compat font-varia...) is showing failure, but the run was at 18:20:08 UTC — before #1003 merged. The umbrella regression job re-ran at 18:48:13 UTC (post-rebase) and collected the stale pre-rebase shard result, surfacing as a top-line failure.

Sanity check: main's regression workflow at 18:28:56 UTC (right after #1003 merged) succeeded — so #1003's changes are passing on main. And this PR's content (new lint rules in packages/core/src/lint/rules/) doesn't touch any render path that regression tests would exercise.

Suggested action: trigger a re-run of regression-shards (shard-7) before merging. Very likely a stale-pre-rebase artifact or a flake (sub-composition-video has had Chrome frame-timing drift recently — 3a23542a regenerated that baseline yesterday). If the re-run passes, merge is safe.

Per Ular's commitment + James's global rule: still merge via GitHub UI individually, no Graphite stack-merge.

— Rames Jusso

@ukimsanov
Copy link
Copy Markdown
Collaborator Author

@miguel-heygen My AI is saying that those test are not passing and your #1001 has a fix for it...should I wait?

Copy link
Copy Markdown
Collaborator

@miguel-heygen My AI is saying that those test are not passing and your #1001 has a fix for it...should I wait?

​I'll admin-merge this btw

@miguel-heygen miguel-heygen merged commit 4c2a90a into main May 21, 2026
48 of 52 checks passed
@miguel-heygen miguel-heygen deleted the feat/lint-rules-v2 branch May 21, 2026 19:33
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.

3 participants