Skip to content

fix(frontend): one font scale, the preference drives the --text-* tokens (#20390) - #20480

Closed
mrveiss wants to merge 3 commits into
mainfrom
issue-20390-one-font-scale
Closed

mrveiss wants to merge 3 commits into
mainfrom
issue-20390-one-font-scale

Conversation

@mrveiss

@mrveiss mrveiss commented Nov 1, 2026

Copy link
Copy Markdown
Owner

Thinking Path

The maintainer chose option A on #20390: --text-* stays as the one font-size scale, the font-size preference drives it, and --font-size-* goes away. Before this change the preference set --font-size-* and almost nothing read it, while ember overrides --text-*. The two scales used different names, so nothing fought; moving the preference onto --text-* creates the conflict, because a theme's own --text-xl and a [data-font-size] rule would compete on selector order and one would silently lose.

So the preference cannot override the steps. It sets a factor, and every --text-* definition (base and theme) multiplies by it. Theme picks the size, preference scales it, and neither depends on rule order.

What Changed

User-visible: the font-size preference (small / medium / large) now resizes text across the app, including the headings and views that read --text-*, in every theme including ember. Medium looks exactly as before. Small and large change sizes by up to half a pixel from the old per-step tables on the 14 files that already used the old scale, and now also apply to everything else on --text-*.

  • design-tokens.css: new --font-scale: 1; every --text-xs to --text-6xl is calc(<size>rem * var(--font-scale)). The seven --font-size-* definitions are removed.
  • themes/preferences.css: [data-font-size="small"] sets --font-scale: 0.9375, large sets 1.0625. Medium has no rule.
  • themes/ember.css: its six --text-* steps keep their sizes and multiply by --font-scale.
  • 14 stylesheets and components move var(--font-size-*) to the matching --text-* (100 lines).
  • New guard ds-second-font-scale (scripts/canonical/rules/ds_second_font_scale.mjs) fails on any --font-size-xs|sm|base|lg|xl|2xl|3xl definition or use under autobot-frontend/src. It is not a baseline ratchet; the tree holds zero, with one file waived for an open PR (below).
  • docs/developer/theming.md documents the scale and how theme and preference combine.

Values (medium unchanged):

step old small new small old large new large
xs 11 11.25 13 12.75
sm 13 13.125 15 14.875
base 15 15 17 17
lg 17 16.875 19 19.125
xl 19 18.75 21 21.25
2xl 22 22.5 26 25.5
3xl 28 28.125 32 31.875

Left alone: --font-size-md (seven uses, never defined, tracked in the undefined-variable baseline), --btn-font-size-md, --aui-*, and the SLM. Nothing in libs/autobot-ui or the SLM maps onto the removed scale.

Held file: views/llc/CompanySelectorView.vue line 399 still reads var(--font-size-xs) because #20388 holds the file. With the definition removed that one declaration computes to inherited size until the line is moved to var(--text-xs). It is waived in the guard by file and count with the PR number; remove the waiver in the PR that converts it.

Verification

  • vitest run --maxWorkers=2 src/assets/css/__tests__: 3 files, 29 tests passed, including the new fontScale.test.ts (7 tests: medium identical with and without ember, small and large factors on every step, small and large with ember scale ember's own steps, theme steps carry --font-scale, no --font-size-* definition remains).
  • vitest run --config scripts/canonical/vitest.config.mjs scripts/canonical/__tests__/ds_second_font_scale.test.mjs: 1 file, 6 tests passed. The first test plants a definition, a use, a fallback use and a .ts reference and the guard reports all four lines; the last test asserts the real tree reports none.
  • Not verified: rendering in a browser. The cascade is replayed from the stylesheet text, not computed by a browser.

Model Used

Claude Sonnet 5.5 (claude-sonnet-5-5), via Claude Code.

Single-issue rationale: the token removal, the guard and the theme-and-preference design must land together; the remaining #19907 font-size batches wait on this scale.

Refs #20390

@mrveiss mrveiss added this to the M3 - Refined GUI complete milestone Nov 1, 2026
@coderabbitai

coderabbitai Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 40 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between bb1f46a and 31406fd.

Files selected for processing: 22

  • autobot-frontend/scripts/canonical/__tests__/ds_second_font_scale.test.mjs
  • autobot-frontend/scripts/canonical/rules/ds_second_font_scale.mjs
  • autobot-frontend/src/assets/base.css
  • autobot-frontend/src/assets/css/__tests__/fontScale.test.ts
  • autobot-frontend/src/assets/css/design-tokens.css
  • autobot-frontend/src/assets/css/themes/ember.css
  • autobot-frontend/src/assets/css/themes/preferences.css
  • autobot-frontend/src/assets/styles/view.css
  • autobot-frontend/src/components/knowledge/WebResearchStatus.vue
  • autobot-frontend/src/components/llc/CompanyStatusControl.vue
  • autobot-frontend/src/components/llc/RoleAttachmentPanel.vue
  • autobot-frontend/src/components/modals/TelemetryConsentModal.vue
  • autobot-frontend/src/components/settings/LanguageSettingsPanel.vue
  • autobot-frontend/src/components/settings/TelegramSettingsPanel.vue
  • autobot-frontend/src/components/settings/TelemetrySettingsPanel.vue
  • autobot-frontend/src/components/ui/CommandPermissionDialog.vue
  • autobot-frontend/src/components/ui/HostSelectionDialog.vue
  • autobot-frontend/src/components/ui/PreferencesPanel.vue
  • autobot-frontend/src/views/llc/CompanyPortabilityView.vue
  • autobot-frontend/src/views/llc/CompanySelectorView.vue
  • autobot-frontend/src/views/llc/RolesView.vue
  • docs/developer/theming.md
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Notice: 29 open PRs — past the runaway threshold (25)

This is not a request to defer this PR. There is no cap on open PRs (#19397) -- nothing blocks opening or pushing a PR.

This notice only means the count is high enough to be worth a glance for a runaway — something opening PRs in a loop, or a merge pipeline that has stalled so nothing is draining.

Currently open:

If the queue is draining normally, ignore this. Otherwise:

  1. Check whether CI is dispatching at all — see the ci-dispatch-watchdog status on these PRs
  2. Approved PRs land through the merge train the coordinator sequences (merge commits, never squash) -- check the open chore(merge-train) PR is moving, not each PR on its own
  3. Look for a loop opening near-identical PRs

Warn-only runaway detector — .github/workflows/pr-queue-gate.yml. It never blocks a merge.

@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

✅ SSOT Configuration Compliance: Passing

🎉 No new hardcoded values of either class — ssot and other both block.

Known backlog in pipeline-scripts/hardcoded_values_baseline.txt is suppressed and tracked in #14371.

@mrveiss

mrveiss commented Nov 1, 2026

Copy link
Copy Markdown
Owner Author

Code review on PR #20480 (head 650ab06): approve. Read only, not rendered. Each --text-* step is its size times --font-scale: the theme picks the size and the preference scales it, with no compounding, and medium is unchanged. A guard blocks a second scale. Left: CompanySelectorView.vue:399 until #20388 lands, and --font-size-md, undefined before this PR, in four files under the baseline.

@mrveiss mrveiss added the phase:M3.3 Shared kit primitives label Nov 1, 2026
@mrveiss

mrveiss commented Nov 2, 2026

Copy link
Copy Markdown
Owner Author

Code review on PR #20480 (head fd35d87): approve.

Read only. CompanySelectorView.vue:399 uses --text-xs, which is defined, WAIVED_FILES is empty, and no --font-size-xs remains in the source.

@mrveiss

mrveiss commented Nov 2, 2026

Copy link
Copy Markdown
Owner Author

Code review on PR #20480 (head 5c138ad): approve.

Covers eba61ec..5c138ad, read only. Behaviour is unchanged. Low, cosmetic: in BaseButton the icon-to-text gap is now one space, and the text follows the kit size. The clone was measured from CI logs, comparing an older run of this branch with main; duplication-guard has not run at this head.

@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Auto-sync: merging main into issue-20390-one-font-scale conflicts

The sync aborted the merge and pushed nothing. Conflicts are information, so it never resolves one itself. Below, for each conflicted file, are the commits that touched it on each side since the merge base 1416e3d202. Merge main in yourself and push; the label clears on the first run that finds this branch 0 behind.

autobot-frontend/src/components/settings/TelegramSettingsPanel.vue

side commit subject issue refs
main 519950c01 fix(frontend): primary-fill labels read --text-on-primary, not a literal white (#20425) #20425
this branch 5c138ad54 refactor(frontend): the Telegram panel saves with the shared button, removing a duplicated style (#20390) #20390
this branch a86dc9134 feat(theme): the font-size preference drives the one --text-* scale; --font-size-* removed (#20390) #20390

@github-actions github-actions Bot added the sync-conflict Set by the branch sync (#19548) label Nov 3, 2026
@mrveiss

mrveiss commented Nov 3, 2026

Copy link
Copy Markdown
Owner Author

Code review on PR #20480 (head ed6bdf8): approve. Covers the merge of main, read only. Main's restyle, --text-on-primary on the save button, is carried: BaseButton's primary variant maps to the same token. The disabled state passes through. Not rendered.

@mrveiss

mrveiss commented Nov 6, 2026

Copy link
Copy Markdown
Owner Author

Code review (code-reviewer pass) at 851200c

Verdict: APPROVE

Checked: no --font-size-(xs..3xl) reference is left in autobot-frontend on main outside the files this PR converts (only a fixture string in the older ds_font_size_literal test remains); [data-font-size] is set on the root element (usePreferences.ts), the same element that carries :root and the ember variant, so calc(... * var(--font-scale)) resolves against the right factor; ember's redefined steps are scaled too; the new rule is auto-discovered by the registry and has a repo-wide "no unwaived reference" test plus positive and negative controls.

Severity File:line Issue Fix
low (non-blocking) autobot-frontend/src/assets/css/themes/preferences.css:17-26 Small/large steps are now one factor (0.9375 / 1.0625) instead of per-step tables; the comment says within half a pixel of the old values. That is a visible 1px shift on some steps, and --text-4xl..6xl now also scale where they did not before. Acceptable as the intended unification; state it in the release note.
low (non-blocking) autobot-frontend/src/assets/css/tests/fontScale.test.ts:36-50 The cascade is replayed from stylesheet text by regex, not computed by a browser. It will miss a theme file that is added later and not listed. The rule ds-second-font-scale plus the "every theme that redefines a step multiplies it" test cover ember only; extend the file list when a theme is added.

No blocking findings.

@mrveiss

mrveiss commented Nov 6, 2026

Copy link
Copy Markdown
Owner Author

Landed on main via merge train #20897 (merge 19e62c8): commit 851200c taken by the train is in main and the three-dot diff of this PR's head against main is empty. Closing.

@mrveiss mrveiss closed this Nov 6, 2026
timothybrush pushed a commit to timothybrush/AutoBot-AI that referenced this pull request Nov 6, 2026
@mrveiss
mrveiss deleted the issue-20390-one-font-scale branch November 8, 2026 10:29
@mrveiss

mrveiss commented Nov 8, 2026

Copy link
Copy Markdown
Owner Author

Branch deleted after verification: every commit is in main and the branch shows 0 changed files against main. Restore it from this PR if needed.

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

Labels

phase:M3.3 Shared kit primitives

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant