Skip to content

Fix project design system typography font loading - #6291

Open
iviaxpow3r wants to merge 1 commit into
nexu-io:mainfrom
iviaxpow3r:fix-design-kit-font-stack-normalization
Open

Fix project design system typography font loading#6291
iviaxpow3r wants to merge 1 commit into
nexu-io:mainfrom
iviaxpow3r:fix-design-kit-font-stack-normalization

Conversation

@iviaxpow3r

Copy link
Copy Markdown

Summary

  • normalize parsed typography family tokens before rendering CSS font stacks
  • preserve extracted brand.json font metadata when DESIGN.md repeats the same family with partial/punctuated values
  • serve project font assets with browser-loadable font MIME types

Why

Custom design systems can have correct font metadata and local font files, but the Design System tab may still render fallback fonts when parsed DESIGN.md typography overrides the richer extracted font objects. In the Content Jams design system, markdown parsing produced family values like Nunito Sans, / JetBrains Mono, and dropped Google Fonts URLs, weights, and fallback metadata. Project .woff2 assets were also served as application/octet-stream.

Verification

  • pnpm --filter @open-design/web test tests/runtime/design-kit.test.ts
  • pnpm --filter @open-design/web typecheck
  • pnpm --filter @open-design/daemon test tests/project-raw-cache.test.ts
  • pnpm --filter @open-design/daemon typecheck
  • pnpm guard
  • git diff --check

Manual validation: verified the Content Jams design-system Typography tab in the dev app renders the intended fonts after the source fix.

@lefarcen

Copy link
Copy Markdown
Contributor

Thanks @iviaxpow3r — this is a nicely scoped fix for a real user-facing typography regression.

One small PR-body follow-up before the review queue moves along: could you add the Surface area checklist? The current Summary + Why + Verification already cover the rest of the template well, so that checklist is the only missing piece.

Also, this touches runtime behavior that should get a QA pass before merge, so please hold off self-merging for now — we’ll queue QA once the PR is merge-ready.

@lefarcen
lefarcen requested a review from PerishCode July 30, 2026 19:54
@lefarcen lefarcen added size/M PR changes 100-300 lines risk/high High risk: apps/desktop, daemon, auth, migration, workflows, package deps type/bugfix Bug fix needs-validation Runtime change detected; needs human or /explore agent validation. labels Jul 30, 2026

@PerishCode PerishCode left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The font normalization and MIME additions address the reported path, but the new same-family merge rule regresses explicit typography edits by treating list length as field presence. The inline comment identifies the required merge behavior and regression coverage.

🔁 Powered by Looper · runner=reviewer · agent=codex · An autonomous AI dev team for your GitHub repos.

...overlayFont,
family: baseFont.family,
fallbacks: overlayFont.fallbacks.length > baseFont.fallbacks.length ? overlayFont.fallbacks : baseFont.fallbacks,
weights: overlayFont.weights.length > baseFont.weights.length ? overlayFont.weights : baseFont.weights,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Preserve missing metadata, but do not discard explicit shorter edits. These comparisons use array length as a proxy for whether the markdown supplied a value, so a same-family edit from weights [400, 700] to [400], or from four fallbacks to one intentional fallback, silently keeps the stale brand.json value. That contradicts this function's documented field-by-field overlay contract: only a missing or empty overlay field should retain the base value. Use overlayFont.fallbacks.length > 0 ? overlayFont.fallbacks : baseFont.fallbacks and the equivalent check for weights, then add regression cases where a non-empty overlay has equal/fewer entries and must win.

🔁 Powered by Looper · runner=reviewer · agent=codex · An autonomous AI dev team for your GitHub repos.

@lefarcen

Copy link
Copy Markdown
Contributor

Hey @iviaxpow3r@PerishCode has the current blocking review on this head, and the inline note there is the right place to start: the same-family merge should preserve missing metadata without letting shorter explicit markdown edits get overwritten by stale brand.json arrays.

While you’re in there, could you also update the PR body with the Surface area checklist plus a short Bug fix verification note describing the regression seam this change covers? That should make the next pass a lot faster.

💡 To drive this PR to merge hands-free, paste this to your AI coding agent (Claude Code / Codex / opencode / Cursor …):
Take over nexu-io/open-design#6291 until it merges — read https://raw.githubusercontent.com/nexu-io/looper/main/skills/pr-takeover/SKILL.md and follow it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-validation Runtime change detected; needs human or /explore agent validation. risk/high High risk: apps/desktop, daemon, auth, migration, workflows, package deps size/M PR changes 100-300 lines type/bugfix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants