fix(css): report a missing CSS optimizer once, and say how to add one - #3575
Conversation
|
Warning Review limit reached
Next review available in: 3 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the 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 configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Comment |
|
CI note: the first run had |
`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.
c1777cb to
5a867fa
Compare
|
Rebased onto current CI on the rebased commit: 27 pass, 6 skipping, 0 failing, first run — the Re-verified locally after the rebase:
One note on how the push was made: the local 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. |
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 buildon a freshly scaffolded project prints:veryfront serverepeats it at startup, and the hosted runtime emits it atlevel=warn component=css-compileronce per render — it was the single mostfrequent line in the dogfood project's cloud logs (4+ entries in the first four
seconds of the deployment's stream).
Two problems, one line:
regenerateCSSByHashacquires a generation session on everycold-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.
CSSOptimizationEngine, an internalcontract name. Nothing in the docs says how to register one, so a developer
reading it has no next step.
Root cause
acquireCSSGenerationSessioninsrc/html/styles-builder/tailwind-compiler.tslogged unconditionally whenever
minifywas 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:
The package name comes from the existing
getRecommendationmap, which alreadymaps
CSSOptimizationEngine→@veryfront/ext-css-lightning, and the phrasingmatches 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 missingoptimizer 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; nothingabout it needs a browser or a deployment.
The test acquires three sessions with no engine registered and asserts exactly
one
warnrecord naming@veryfront/ext-css-lightning. It first registers andacquires 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 (
3records, expected1), 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.the build now prints the actionable message once.
deno fmt --check,deno lint,deno check,lint:module-boundaries,lint:dependency-boundariesall clean.