Skip to content

fix(responsive): collapse a route's two builds of one stylesheet and two precisions of one style - #2238

Open
chubes4 wants to merge 1 commit into
mainfrom
fix/chrome-single-doc
Open

chubes4 wants to merge 1 commit into
mainfrom
fix/chrome-single-doc

Conversation

@chubes4

@chubes4 chubes4 commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Part of #1261: identical header chrome should capture the same way on every route.

Problem

In #1261, two collapsed single-document routes carried per-device class swaps and a responsive style marker that no other route had:

  1. Two builds of one stylesheet. The source served one route's phone document from another build of a component stylesheet (a rolling deploy). Class names differed (_avatar_amy81_7 _withNewColorWiring_amy81_20 versus _avatar_3772p_7 _withNativeThemeOverrides_3772p_20) while every rule was the same. The responsive collapse projected responsive-desktop-class-* / responsive-class-* swaps onto that route only. curl confirms the source serves the two builds to the two user agents.
  2. Two precisions of one style. A client-rendered document writes inline styles through CSSOM, which rounds to six significant digits (padding-bottom: 119.526%), while the server-rendered copy keeps 119.5260663507109%. The collapse treated these as different and emitted a data-blocks-engine-capture-responsive-<hash> override.

Fix

  • New build-equivalent-classes.ts. Each phone-only class token is paired with the desktop-only token whose rules match its own (other paired tokens stand in for each other, and tokens named only by a selector are included). A pairing is kept only when, per stylesheet group, renaming makes the phone rules for every paired token exactly the desktop rules for their counterparts, and the group styles an element the phone document renders. Rule-free tokens are paired only by position next to proven ones. assembleResponsiveCapture applies the proven renames to the phone document before assembly. When the rules differ, nothing is renamed.
  • sameInlineStyle compares numbers at CSSOM precision. When the two documents serialize one declaration list differently, both elements keep the authored (higher-precision) serialization, so no override is projected. This applies to both the equivalent-projection and identity-merge paths.

Tests

New responsive-assembly.test.ts cases:

  • A phone build with renamed but identical rules keeps the desktop class names (fails on main, passes here).
  • A phone build whose rules differ keeps both names (guard).
  • A rounded CSSOM style keeps the authored serialization with no projection hook (fails on main, passes here).

npx tsc -p tsconfig.build.json is clean. The full suite result compared with main is posted below.

Filed by Franklin (Claude via Pi, Roadie).

…two precisions of one style

A rolling deploy can serve one route's phone document another build of a
component stylesheet: other class names, the same rules. The collapse then
projected per-device class swaps onto that route alone. Phone class names
whose rules are proven to be the desktop names' rules (per stylesheet,
including tokens only a selector names) take the desktop names before
assembly.

A client-rendered document serializes inline styles through CSSOM, rounding
numbers to six significant digits, so one declaration list projected a
responsive override. Inline styles now compare at CSSOM precision and keep
the authored serialization.

Refs #1261
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