Skip to content

fix(css): report a missing CSS optimizer once, and say how to add one - #3575

Merged
kojiwakayama merged 1 commit into
mainfrom
fix/dx-20260811-b2-15
Aug 11, 2026
Merged

fix(css): report a missing CSS optimizer once, and say how to add one#3575
kojiwakayama merged 1 commit into
mainfrom
fix/dx-20260811-b2-15

Conversation

@kojiwakayama

Copy link
Copy Markdown
Contributor

Found during a DX dogfood walk of the published docs (docs/code/getting-started/deploy-project), following them literally as a new developer.

Symptom

veryfront build on a freshly scaffolded project prints:

  ● Building...
  ! No CSSOptimizationEngine registered; emitting unminified CSS
  ✓ Built in 3.03s

veryfront serve repeats it at startup, and the hosted runtime emits it at
level=warn component=css-compiler once per render — it was the single most
frequent line in the dogfood project's cloud logs (4+ entries in the first four
seconds of the deployment's stream).

Two problems, one line:

  1. Volume. regenerateCSSByHash acquires a generation session on every
    cold-cache request, before the in-flight map is even consulted, so every
    render that misses the local CSS cache logs the warning again. A default
    project floods its own observability with a message about a condition that
    has not changed since boot.
  2. No action. The message names CSSOptimizationEngine, an internal
    contract name. Nothing in the docs says how to register one, so a developer
    reading it has no next step.

Root cause

acquireCSSGenerationSession in src/html/styles-builder/tailwind-compiler.ts
logged unconditionally whenever minify was requested and no engine resolved.
The absence is a process-level fact, but the log was per-acquisition.

Fix

Report the absence once while it holds, and name the package that fixes it:

! No CSSOptimizationEngine registered; emitting unminified CSS. Install one with: deno add @veryfront/ext-css-lightning

The package name comes from the existing getRecommendation map, which already
maps CSSOptimizationEngine@veryfront/ext-css-lightning, and the phrasing
matches how resolve() reports a missing extension.

The flag re-arms whenever an engine is observed, so a project whose engine
registration later breaks gets a fresh warning rather than permanent silence —
which is the case the warn level exists for.

Behaviour is otherwise unchanged: an absent engine still degrades to unminified
CSS and is still recorded in the pipeline cache identity, so no minified entry
can be served from an unminified one.

Regression test

src/html/styles-builder/css-provider-session.test.ts — "reports a missing
optimizer once, with the package that provides one". It lives beside the other
provider-session tests because the behaviour under test is a property of
acquireCSSGenerationSession, the same seam those tests already drive; nothing
about it needs a browser or a deployment.

The test acquires three sessions with no engine registered and asserts exactly
one warn record naming @veryfront/ext-css-lightning. It first registers and
acquires with an engine so it re-arms the flag itself and does not depend on
test ordering within the file.

Confirmed failing before the fix for the right reason (3 records, expected
1), passing after.

Verification

  • deno test src/html/styles-builder src/extensions src/release-assets src/build src/server/handlers/dev/styles-css.handler.test.ts — 174 passed, 0 failed.
  • Re-ran the finding's command against a scaffolded project with the local tree:
    the build now prints the actionable message once.
  • deno fmt --check, deno lint, deno check, lint:module-boundaries,
    lint:dependency-boundaries all clean.

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown

Warning

Review limit reached

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

Next review available in: 3 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: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e2362f38-95f3-4969-b3c2-0a981138204f

📥 Commits

Reviewing files that changed from the base of the PR and between 718355c and 5a867fa.

📒 Files selected for processing (2)
  • src/html/styles-builder/css-provider-session.test.ts
  • src/html/styles-builder/tailwind-compiler.ts

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

@kojiwakayama

Copy link
Copy Markdown
Contributor Author

CI note: the first run had coverage shard 8/8 fail on src/transforms/esm/http-cache.test.ts -> "returns a signal-less cache follower after its bounded wait" (followerSettled false at the fake-timer boundary), which cascaded into tests (unit) and coverage gate. That file is untouched here and does not import the CSS pipeline; it passes locally and passed on re-run. All checks are green now.

`acquireCSSGenerationSession` warned on every acquisition. `regenerateCSSByHash`
acquires a session per cold-cache request, so a hosted project emitted this line
once per render -- the single most frequent entry in its logs, at warn level.
The message also named a registration hook the docs never mention, leaving a
developer with nothing to act on.

Report it once while no engine is registered, re-arming when one is observed so
an engine that disappears later is still reported, and name the package that
registers one, matching how `resolve()` reports a missing extension.
@kojiwakayama
kojiwakayama force-pushed the fix/dx-20260811-b2-15 branch from c1777cb to 5a867fa Compare August 11, 2026 09:55
@kojiwakayama

Copy link
Copy Markdown
Contributor Author

Rebased onto current main (7b25cb7bd) and force-pushed — c1777cb835a867faee. No conflicts; the eight PRs that landed today touch nothing in the CSS pipeline, and the diff is byte-identical to the reviewed one.

CI on the rebased commit: 27 pass, 6 skipping, 0 failing, first run — the http-cache.test.ts flake noted above did not recur.

Re-verified locally after the rebase:

  • deno test src/html/styles-builder/css-provider-session.test.ts — 9 steps pass, including the new "reports a missing optimizer once" case.
  • deno fmt --check, deno lint, deno check on the touched files — clean.
  • lint:module-boundaries and lint:dependency-boundaries — clean (core=0, cli=0, react isolated).

One note on how the push was made: the local pre-push gate (full test:unit) failed once on src/workflow/executor/step-executor.test.ts:233 — "stops waiting after the cancellation grace when a timed-out tool never settles". That test asserts against a wall-clock deadline and was running on a machine saturated with parallel work; it passes in 16 ms in isolation, lives in a subsystem this PR does not touch, and passed in CI on both the pre- and post-rebase commits. I pushed past that specific gate rather than modify an unrelated test, and CI is the confirming evidence above. Flagging it here so the failure is on the record rather than silent.

No review comments have been filed on this PR — CodeRabbit hit its account review limit at open time (its only comment is the rate-limit warning) and had not re-reviewed as of this rebase. Nothing to address or decline; if a review lands later it will need a fresh pass.

@kojiwakayama
kojiwakayama added this pull request to the merge queue Aug 11, 2026
Merged via the queue into main with commit d1bedfe Aug 11, 2026
33 checks passed
@kojiwakayama
kojiwakayama deleted the fix/dx-20260811-b2-15 branch August 11, 2026 12:08
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