Skip to content

fix(database): ship the page CSS as the scoped console:style asset - #605

Merged
rohitg00 merged 1 commit into
mainfrom
fix/database-page-styles-scoped
Jul 27, 2026
Merged

fix(database): ship the page CSS as the scoped console:style asset#605
rohitg00 merged 1 commit into
mainfrom
fix/database-page-styles-scoped

Conversation

@rohitg00

Copy link
Copy Markdown
Contributor

The #/ext/database page shipped in #598 kept its 316 lines of CSS in ui/src/page/page-styles.ts and rendered them as a <style> element inside the page component. That is the one place this worker's injectable UI diverges from docs/sops/injectable-console-ui.md and from every other UI-shipping worker: page rules belong in the console:style asset, scoped under the data-iii-ui wrapper the console mounts around each injected render.

Two consequences:

  • The rules were scoped to .db-page instead of [data-iii-ui="database"], so they were unlayered CSS competing with the console's layered document rather than fenced to this worker's subtree.
  • The console's lint_style pass and the worker's embedded_styles_are_scoped test both only inspect the registered asset, so neither covered them.

This moves every rule into ui/styles.css with the scope attribute on each selector, the same flat form state, eval, and iii-directory use. The @keyframes name keeps its db- prefix (keyframe names are global) and the @media block scopes its inner rules. src/ui.rs module docs now say page.js carries the page as well as the function-trigger renderer.

No visual change: the same rules apply to the same elements, now via the stylesheet the console link-swaps instead of a <style> tag mounted with the page.

Asset sizes stay well inside the 8 MiB per-asset cap: dist/styles.css 3.3kb to 18.8kb, dist/page.js 614.6kb to 602.2kb.

Verification

  • cargo fmt --all -- --check, cargo clippy --all-targets --all-features -- -D warnings, cargo test --all-features (226 unit tests, including the three ui::tests)
  • pnpm build in database/ui (tsc + esbuild)
  • Replayed the console's lint_style logic over the built dist/styles.css: no @font-face, zero unscoped top-level selectors

The `#/ext/database` page carried its own 316 lines of CSS in
`page-styles.ts` and rendered them as a `<style>` element inside the page
component. That is the one place the database worker's injectable UI
diverged from the protocol every other UI-shipping worker follows: page
rules belong in the `console:style` asset, scoped under the wrapper
attribute the console mounts around each injected render.

Two things follow from the divergence. The rules were selector-scoped to
`.db-page` rather than `[data-iii-ui="database"]`, so they were unlayered
CSS competing with the console's layered document instead of being fenced
to this worker's subtree. And the console's `lint_style` check plus the
worker's own `embedded_styles_are_scoped` test both only see the
registered asset, so neither covered them.

Move every rule into `ui/styles.css` with the scope attribute on each
selector, matching state, eval, and iii-directory. The `@keyframes` name
keeps its `db-` prefix (keyframe names are global) and the `@media` block
scopes its inner rules. `dist/styles.css` grows from 3.3kb to 18.8kb and
`dist/page.js` drops from 614.6kb to 602.2kb, both far inside the 8 MiB
per-asset cap.

No visual change: the same rules apply to the same elements, now through
the stylesheet the console link-swaps rather than a `<style>` tag mounted
with the page.
@rohitg00 rohitg00 added the no-ticket PR deliberately has no Linear ticket (bump/typo/CI-only) label Jul 27, 2026
@vercel

vercel Bot commented Jul 27, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
workers Ready Ready Preview, Comment Jul 27, 2026 9:49am
workers-tech-spec Ready Ready Preview, Comment Jul 27, 2026 9:49am

Request Review

@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@rohitg00, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 7 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: c821677a-8cd2-4262-a09e-10db05d0cc93

📥 Commits

Reviewing files that changed from the base of the PR and between 8da4585 and 1f85823.

📒 Files selected for processing (4)
  • database/src/ui.rs
  • database/ui/src/page/index.tsx
  • database/ui/src/page/page-styles.ts
  • database/ui/styles.css
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/database-page-styles-scoped

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

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

skill-check — worker

0 verified, 49 skipped (no docs/).

Layer Result
structure
vale
ai
render

Four for four. Nicely done.

@rohitg00
rohitg00 merged commit cf5c4e1 into main Jul 27, 2026
18 checks passed
@rohitg00
rohitg00 deleted the fix/database-page-styles-scoped branch July 27, 2026 10:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-ticket PR deliberately has no Linear ticket (bump/typo/CI-only)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant