Skip to content

🧩 feat: Let Theme Readers Ignore Unknown Appearance Tokens - #16373

Merged
berry-13 merged 1 commit into
canaryfrom
followup/127-16340-let-theme-readers-tolerate-unknown-appeara
Sep 25, 2026
Merged

berry-13 merged 1 commit into
canaryfrom
followup/127-16340-let-theme-readers-tolerate-unknown-appeara

Conversation

@berry-13

Copy link
Copy Markdown
Collaborator

Pull Request

Summary

validateThemeDefinition rejected a whole theme definition when a mode's appearance named a token the running build did not know. Each PR that adds an appearance token (the radius and font scales in #16340, the shadow scale in #16341) therefore made stored and interface.theme definitions using it unreadable to an older frontend: after a rollback the user lost the theme's colors and every other appearance value, not just the new one.

Readers now ignore an unknown appearance token instead of rejecting the definition. resolveTheme leaves it out, and ThemeProvider reports it once per applied definition with a console warning. A stored definition keeps the key, so rolling forward again restores it. Unknown color tokens, invalid values for known appearance tokens, and an unknown token whose name or value carries CSS or markup (;, braces, url(, angle brackets) still reject the definition. The stored, controlled and deployment paths share this behavior because they all go through the registry and the provider.

Addresses berry-13#127, raised on #16340.

Type of change

  • Feature

Testing

Tested environments/configuration:

  • jsdom unit suites; Playwright mock harness scenarios for the stored and deployment paths

Automated tests:

  • cd packages/client && npx jest src/theme: 282 passed. The 7 new or changed cases in registry.spec.ts and ThemeProvider.spec.tsx fail against the canary source and pass with this change.
  • cd client && npx jest src/Providers/__tests__/DeploymentTheme.spec.tsx: 16 passed, one new case for an inline interface.theme with an unknown token.
  • Added e2e/specs/mock/scenarios/theme-unknown-appearance.spec.ts with four scenarios: stored and deployment definitions with an unknown token apply the rest, an invalid known value still rejects, and CSS carried by an unknown token still rejects.
  • npx tsc --noEmit in packages/client, npm run typecheck in client, and npm run static-checks -- --against origin/canary: all clean.

Screenshots / recordings

No new UI. A theme carrying a newer token now paints instead of falling back to the default, which the e2e scenarios assert on the rendered root styles.

Risk / compatibility

Readers become more permissive only for appearance keys. An ignored key never reaches the DOM, and its name and value are still checked for injection. The server schema already accepts any string-valued appearance key, so no config changes.

Checklist

  • I reviewed my own changes
  • Relevant tests have been added or updated
  • Existing relevant tests pass
  • The change does not introduce new warnings or errors
  • Required documentation PR: N/A

A definition naming an appearance token this build does not know now
resolves with that token dropped and reported, instead of being rejected
whole. Unknown colours, invalid values for known tokens, and CSS or markup
carried by an unknown token still reject the definition.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 25, 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-09-25T18:35:06.090339Z 357732b PR opened
🔒 Security Review ✅ Completed 2026-09-25T18:35:45.278380Z 357732b PR opened
ℹ️ 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.

@github-actions

Copy link
Copy Markdown
Contributor

Lighthouse CI failed. The last 80 log lines contain the measured budgets and assertion failures.

│ 21      │ 'http://localhost:3080/api/convos?pinned=true&limit=100'                                                        │ 2668.6749999999884 │ 3435.1989999999932 │ 200    │
│ 22      │ 'http://localhost:3080/api/mcp/servers'                                                                         │ 3012.076000000001  │ 4277.263000000006  │ 200    │
│ 23      │ 'http://localhost:3080/api/permissions/mcpServer/effective/all'                                                 │ 3013.9070000000065 │ 3770.407999999996  │ 200    │
│ 24      │ 'http://localhost:3080/api/prompts/groups?limit=10'                                                             │ 3014.168000000005  │ 4275.717000000004  │ 200    │
│ 25      │ 'http://localhost:3080/api/keys?name=openAI'                                                                    │ 3274.320000000007  │ 3924.5290000000095 │ 200    │
│ 26      │ 'http://localhost:3080/api/presets'                                                                             │ 3275.4260000000068 │ 3929.7509999999893 │ 200    │
│ 27      │ 'http://localhost:3080/api/tags'                                                                                │ 3276.2460000000137 │ 3939.823000000004  │ 200    │
│ 28      │ 'http://localhost:3080/api/share/link/16390000-0000-4000-8000-000000000001'                                     │ 3276.6229999999923 │ 4277.546999999991  │ 200    │
│ 29      │ 'http://localhost:3080/api/messages/16390000-0000-4000-8000-000000000001'                                       │ 3277.097000000009  │ 4431.850000000006  │ 200    │
│ 30      │ 'http://localhost:3080/api/files/config'                                                                        │ 3278.0100000000093 │ 4183.940999999992  │ 200    │
│ 31      │ 'http://localhost:3080/api/agents/tools/web_search/auth'                                                        │ 3278.2570000000123 │ 6957.588000000018  │ 200    │
│ 32      │ 'http://localhost:3080/api/endpoints/token-config'                                                              │ 3278.4409999999916 │ 4439.325000000012  │ 200    │
│ 33      │ 'http://localhost:3080/api/agents/tools/calls?conversationId=16390000-0000-4000-8000-000000000001'              │ 3279.2919999999867 │ 4785.007000000012  │ 200    │
│ 34      │ 'http://localhost:3080/api/agents/chat/status/16390000-0000-4000-8000-000000000001?generationProtocolVersion=2' │ 4528.834999999992  │ 4786.421000000002  │ 200    │
└─────────┴─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴────────────────────┴────────────────────┴────────┘

Inspect .lighthouse HTML/JSON and e2e/lighthouse/README.md. Reuse loaded user/config data; overlap independent reads without bypassing authorization.

┌─────────┬────────────────────────────┬──────────────────────┬───────┐
│ (index) │ audit                      │ median               │ limit │
├─────────┼────────────────────────────┼──────────────────────┼───────┤
│ 0       │ 'largest-contentful-paint' │ 4507.426             │ 4500  │
│ 1       │ 'cumulative-layout-shift'  │ 0.018445685889297493 │ 0.1   │
│ 2       │ 'total-blocking-time'      │ 271.93700000000035   │ 500   │
└─────────┴────────────────────────────┴──────────────────────┴───────┘

  1) [chrome] › e2e/lighthouse/load.spec.ts:10:5 › serial database latency stays within web-vitals budgets 

    Error: Median largest-contentful-paint must stay within 4500

    expect(received).toBeLessThanOrEqual(expected)

    Expected: <= 4500
    Received:    4507.426

       at audit.ts:159

      157 |   console.table(measured);
      158 |   for (const { audit, median, limit } of measured) {
    > 159 |     expect(median, `Median ${audit} must stay within ${limit}`).toBeLessThanOrEqual(limit);
          |                                                                 ^
      160 |   }
      161 |   return results;
      162 | }
        at auditPage (/home/runner/work/LibreChat/LibreChat/e2e/lighthouse/audit.ts:159:65)
        at /home/runner/work/LibreChat/LibreChat/e2e/lighthouse/load.spec.ts:33:19

    attachment #1: screenshot (image/png) ──────────────────────────────────────────────────────────
    e2e/lighthouse/.test-results/load-serial-database-latency-stays-within-web-vitals-budgets-chrome/test-failed-1.png
    ────────────────────────────────────────────────────────────────────────────────────────────────

    Error Context: e2e/lighthouse/.test-results/load-serial-database-latency-stays-within-web-vitals-budgets-chrome/error-context.md

    attachment #3: trace (application/zip) ─────────────────────────────────────────────────────────
    e2e/lighthouse/.test-results/load-serial-database-latency-stays-within-web-vitals-budgets-chrome/trace.zip
    Usage:

        npx playwright show-trace e2e/lighthouse/.test-results/load-serial-database-latency-stays-within-web-vitals-budgets-chrome/trace.zip

    ────────────────────────────────────────────────────────────────────────────────────────────────


🤖: global teardown has been started
2026-09-25 18:36:24 �[32minfo�[39m: �[32mMongo Connection options�[39m
2026-09-25 18:36:24 �[32minfo�[39m: �[32m{�[39m
�[32m  "bufferCommands": false�[39m
�[32m}�[39m
🤖:  ✅  Connected to Database
🤖:  ✅  Found user in Database
🤖:  ✅  Deleted 1 convos & 2 messages
🤖:  ✅  Deleted user from Database
🤖: global teardown has been started
2026-09-25 18:36:24 �[32minfo�[39m: �[32mMongo Connection options�[39m
2026-09-25 18:36:24 �[32minfo�[39m: �[32m{�[39m
�[32m  "bufferCommands": false�[39m
�[32m}�[39m
🤖:  ✅  Connected to Database
🤖:  ⚠️  User not found in Database
  1 failed
    [chrome] › e2e/lighthouse/load.spec.ts:10:5 › serial database latency stays within web-vitals budgets 

Open the full run

@berry-13
berry-13 merged commit 0ea3e27 into canary Sep 25, 2026
39 of 40 checks passed
@berry-13
berry-13 deleted the followup/127-16340-let-theme-readers-tolerate-unknown-appeara branch September 25, 2026 19:12
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.

1 participant