Skip to content

chore(ui): verify theme propagation and add audit warnings - #33254

Open
shah-harshit wants to merge 2 commits into
mainfrom
6566-theme-root-propagation-tests
Open

chore(ui): verify theme propagation and add audit warnings#33254
shah-harshit wants to merge 2 commits into
mainfrom
6566-theme-root-propagation-tests

Conversation

@shah-harshit

@shah-harshit shah-harshit commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Describe your changes:

Part of open-metadata/openmetadata-collate#6566
Closes open-metadata/openmetadata-collate#6567
Gate contract: open-metadata/openmetadata-collate#6564
Token foundation: #33249

This PR combines two small shared-theme foundation slices:

  • Verifies that the single root ThemeProvider governs application and portal content.
  • Verifies that customer brand variables persist across theme changes and that stale variables are removed.
  • Reports explicit tw:dark:* overrides and unsupported --ai-* theme tokens as review warnings.
  • Documents the fixed-color and dark-override exception requirements.
  • Runs both design-token scanner suites in UI Checkstyle and keeps successful warning output visible.

The reference to #6566 is intentionally non-closing because that ticket also owns the separate Collate pre-paint restoration change. Existing audit errors remain errors; only the new migration rules are warning-level and non-blocking.

Type of change:

  • Improvement
  • Tests

High-level design:

The ThemeProvider tests exercise the existing provider through its public context and observable DOM/root-style effects. Portal content is rendered through createPortal into document.body, while the active theme remains owned by document.documentElement.

The token scanners reuse their existing finding and severity model. They classify tw:dark:* and --ai-* occurrences as warnings so migration debt is visible without blocking incremental AI-mode work. Existing hardcoded-value error classifications and exit behavior are unchanged.

There are no production runtime, token-value, component, domain, generated-file, API, or submodule changes.

Tests:

Use cases covered

  • A body-mounted portal follows live light/dark theme changes through the root theme.
  • Portal elements and document.body do not receive copied theme classes.
  • Customer brand variables survive theme changes.
  • Replaced and removed customer branding clears stale variables.
  • Explicit dark variants and --ai-* tokens produce warnings, not errors.
  • Shared semantic utilities do not produce those warnings.

Unit tests

  • yarn test src/context/UntitledUIThemeProvider/theme-provider.test.tsx --runInBand — 15 tests passed.
  • node scripts/design-tokens/scanner.test.js — 28 checks passed.
  • node --test scripts/design-tokens/tw-scanner.test.js — 3 tests passed.
  • node scripts/tw-audit.js scripts/design-tokens/tw-scanner.test.js — 0 errors and 4 expected warnings; exit 0.

Backend and ingestion integration tests

  • Not applicable; no backend or ingestion changes.

Playwright tests

  • Not applicable; no user-visible runtime change.

Local verification

  • Focused ESLint and Prettier checks passed.
  • JavaScript syntax and workflow YAML syntax checks passed.
  • git diff --check passed.

UI screen recording / screenshots:

Not applicable. This PR adds regression coverage, audit warnings, and contributor guidance without changing rendered UI.

Checklist:

  • I have read the CONTRIBUTING document.
  • The PR references both implementation tickets, the Gate Zero contract, and the token dependency.
  • New dark-theme audit classifications are warning-level and covered by focused tests.
  • Existing audit error behavior is unchanged.
  • JSON Schema migrations are not applicable.
  • UI screenshots are not applicable because rendered behavior is unchanged.

@shah-harshit shah-harshit added safe to test Add this label to run secure Github workflows on PRs skip-pr-checks Bypass PR metadata validation check UI UI specific issues labels Sep 13, 2026
@shah-harshit shah-harshit self-assigned this Sep 13, 2026
@shah-harshit shah-harshit changed the title test(ui): verify root theme and portal propagation chore(ui): verify theme propagation and add audit warnings Sep 13, 2026
@gitar-bot

gitar-bot Bot commented Sep 13, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

Adds regression tests for theme propagation and portal behavior, verifying that root <html> theme governs React portals mounted under document.body, customer brand variables survive live light/dark switching, and stale variables clear on branding replacement or removal. No issues found.

Options

Display: compact → Counting what did not apply, without listing it.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@github-actions

Copy link
Copy Markdown
Contributor

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 72%
72.85% (102464/140632) 57.58% (61983/107632) 58.84% (20353/34589)

@sonarqubecloud

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown
Contributor

✅ Playwright Results — workflow succeeded

Validated commit 81d5efd0792e7459a5c483edfdc72c271e5a5a4a in Playwright run 34756541244, attempt 1.

✅ 4500 passed · ❌ 0 failed · 🟡 6 flaky · ⏭️ 1 skipped · 🧰 0 lifecycle flaky

Performance

Blocking targets: ✅ met · Optimization targets: 🟡 in progress

Shard-job maxima below are not the full workflow wall time; the linked run includes build, fixture, planning, and reporting.

🕒 Full workflow signal wall (to summary) 53m 8s

⏱️ Max setup 5m 5s · max shard execution 21m 7s · max shard-job elapsed before upload 24m 33s · reporting 23s

🌐 218.73 requests/attempt · 2.24 app boots/UI scenario · 38.28% common-shard skew

Optimization targets still in progress:

  • Common shard skew was 38.28% (convergence target: at most 15%).
  • Browser traffic was 218.73 requests per attempt (convergence target: fewer than 200).
  • Application boot ratio was 2.24 per UI scenario (10683 boots / 4766 scenarios; convergence target: at most 1).
Shard Passed Failed Flaky Skipped Lifecycle failed Lifecycle flaky
✅ Shard advanced-search-01 130 0 0 0 0 0
✅ Shard chromium-01 160 0 0 0 0 0
✅ Shard chromium-02 169 0 0 0 0 0
✅ Shard chromium-03 158 0 0 0 0 0
✅ Shard chromium-04 147 0 0 0 0 0
✅ Shard chromium-05 185 0 0 0 0 0
✅ Shard chromium-06 164 0 0 1 0 0
🟡 Shard chromium-07 238 0 1 0 0 0
✅ Shard chromium-08 166 0 0 0 0 0
🟡 Shard chromium-09 161 0 1 0 0 0
✅ Shard chromium-10 204 0 0 0 0 0
✅ Shard chromium-11 158 0 0 0 0 0
✅ Shard chromium-12 159 0 0 0 0 0
✅ Shard chromium-13 212 0 0 0 0 0
🟡 Shard chromium-14 192 0 1 0 0 0
✅ Shard chromium-15 199 0 0 0 0 0
🟡 Shard chromium-16 187 0 1 0 0 0
✅ Shard chromium-17 205 0 0 0 0 0
✅ Shard chromium-18 188 0 0 0 0 0
🟡 Shard chromium-19 170 0 1 0 0 0
✅ Shard chromium-20 183 0 0 0 0 0
🟡 Shard chromium-21 172 0 1 0 0 0
✅ Shard chromium-22 165 0 0 0 0 0
✅ Shard data-asset-rules-01 65 0 0 0 0 0
✅ Shard domain-isolation-01 16 0 0 0 0 0
✅ Shard global-state-01 34 0 0 0 0 0
✅ Shard import-export-01 80 0 0 0 0 0
✅ Shard import-export-02 70 0 0 0 0 0
✅ Shard ingestion-01 46 0 0 0 0 0
✅ Shard ingestion-02 48 0 0 0 0 0
✅ Shard reindex-01 28 0 0 0 0 0
✅ Shard search-01 12 0 0 0 0 0
✅ Shard search-rbac-01 29 0 0 0 0 0
🟡 6 flaky test(s) (passed on retry)
  • Pages/Tag.spec.tsVerify Owner Add Delete (shard chromium-07, 1 retry)
  • Pages/Lineage/LineageFilters.spec.tsVerify LineageSearchSelect in lineage mode (shard chromium-09, 1 retry)
  • Pages/Entity.spec.tsDelete Topic (shard chromium-14, 1 retry)
  • Features/ChangeSummaryBadge.spec.tsAutomated badge should appear on entity description with Automated source (shard chromium-16, 1 retry)
  • Features/ActivityFeed.spec.tsShould encode the chinese character while mentioning api endpoint (shard chromium-19, 1 retry)
  • Pages/Lineage/DataAssetLineage.spec.tsverify create lineage for entity - File (shard chromium-21, 1 retry)

📦 Download artifacts

How to debug locally
# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip    # view trace

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

Labels

safe to test Add this label to run secure Github workflows on PRs skip-pr-checks Bypass PR metadata validation check UI UI specific issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant