← Back to Pull requests

fix(prd-261): theme uploads refuse the first paint the browser would drop #1378

Open
unknown opened this pull request with 425 lines diff across 5 files
View on GitHub
unknown unknown commented on Oct 30, 2026 23:16 UTC
Author

Why

Candy 1.0.0 shipped broken on SaaS. Core's upload checks accepted prepaint values, and a look schema, that core's own browser boot code then drops:

  • the gradients disappeared, so the cards came out transparent;

  • one unpainted knob, roundness, made every look fail with an unknown field.
  • The author only found out on SaaS.

    What changes

    These checks are upload only, in the new services/themes/first_paint.py, called by the package reader. The per-boot re-check in serve.theme_prepaint is unchanged, so installs that already exist keep booting.

  • Values the browser drops (BAD_CSS_VALUE, with the browser's reason):

  • - color-mix, linear-gradient, radial-gradient, opacity, blur, drop-shadow and _;
    - the 200-character cap, now one named constant (contract.PREPAINT_VALUE_MAX).
  • KNOB_NOT_PAINTED: a schema knob no prepaint cell paints. The browser's look spec leaves it out, so every look fails.

  • KNOB_NOT_IN_SCHEMA: a knob the table paints that the schema lacks.

  • PREPAINT_DEFAULTS_UNFIT: defaults that don't fit what the browser keeps, so the whole table is dropped. This replaces the mobile check's own unfit branch, so a package gets one code, not two.

  • BAD_PREPAINT: knob, pair and numeric-rule names the browser refuses.

  • One gate, written twice: css_value.py and css-value.ts. boot-sanitize.ts and mobile_tokens.py now use it.

  • - The new frontend/lib/theme-host/first-paint.ts mirrors first_paint.py using the browser's own sanitizePrepaint and lookSpecOf.
    - The parity test therefore checks the server's rules against what the browser actually does.
  • Corpus:

  • - a new firstPaint section (8 cases with pinned sentences);
    - prepaintDrops (12 cases);
    - 3 new package cases;
    - fixtures re-tabled so hello paints all its knobs.
  • UI and docs: the publish form lists the new codes under Looks, and the theme-host docs are updated.
  • Live themes

    I ran core's real reader on the released packages:

  • Play 1.2.1, HUD 1.1.2 and Arcade 1.0.0 are accepted;

  • Candy 1.0.0 is refused (16 BAD_CSS_VALUE and KNOB_NOT_PAINTED);

  • Candy 1.0.1 (kit #51, merged) passes.
  • Test plan (CI)

  • test_prd261_first_paint.py, the theme_package corpus, and mobile_package, boot_files_cache, review_stage and theme_files with their fixtures.

  • validator-parity.test.ts (the firstPaint and prepaintDrops sections), boot.test.ts, publish-theme.test.tsx.

  • tsc, ruff, the code-shape gate, import-linter.
  • The Design Kit's PR applies the same rules to its own check, the harness and its review job. The kit re-vendors css-value.ts on its next core re-pin.

    <!-- This is an auto-generated comment: release notes by coderabbit.ai -->

    <!-- coderabbit-ai-generated:v1 -->

    Summary by CodeRabbit

    New Features
    Theme packages now receive first-paint checks for values and knob names that the browser would drop, defaults that do not fit, and mismatches between painted knobs and the look schema.
    Validation reports specific errors for these cases. Mobile themes using look-based defaults are also checked against the prepaint table.
    Documentation
    * Updated theme package, mobile, and security guidance to explain first-paint validation and the conditions that cause content to be rejected.

    <!-- end of auto-generated comment: release notes by coderabbit.ai -->

    Diff: 425 lines (+318 / -107) across 5 files Reviewer: claude[bot] Review duration: 14m
    All Vouch review confidence checks passed
    Residual risk 0.26 = Change Risk (0.45) × (1 − Review Confidence (0.43)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.45 · 425 lines diff across 5 files
    0.45
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    42%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.362
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #1378"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 43.0% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 45.1% (MEDIUM) · Higher = larger blast radius
    45.1%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 43.0% · Lower = rushed or shallow review
    43.0%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 25.7% · Safe to merge
    25.7%