Repository navigation
Find the overlay rails by testid, not by the corner spelled into the pattern - #11268
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@codex security review |
🛡️ Codex Security ReviewSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
c9796c8 to
b430ebb
Compare
22c9c3a to
30830bc
Compare
|
@codex review |
…pattern #11260 moved the rails flush to the bottom-right corner (right-4 -> right-0, max-h-[calc(100dvh_-_8px)] -> max-h-[100dvh]) and paid the inset as inline px padding. Four tests across two files matched the rail with a regex that spelled the old corner into the pattern, so they found nothing and reported the rails as missing rather than as moved: test_overlay_layering.py::test_the_notification_stack_uses_the_named_layer test_update_release_notes.py::test_the_overlay_stack_fits_the_viewport test_update_release_notes.py::test_the_desktop_stack_is_capped_like_the_browser_one test_update_release_notes.py::test_the_download_panel_can_shrink_inside_the_capped_stack The product change is deliberate and documented; the matchers are what move. Both files now find the rails by data-testid="overlay-rail", which is the same reasoning test_update_release_notes.py already grew _class_on_testid for: an anchor built out of the classes under test cannot survive one of them changing. Where the rail sits is now a claim in its own test rather than a side effect of the matcher, and the gutter rule #11260 introduced gets one too: the cap is the whole viewport and the gutters are paid as inline px, so the cards keep the band they had. That test also holds the two floors the comment gives (22px left and 14px top, from the deepest card shadow) and refuses a rem-valued padding utility, which is the #8082 failure the constants exist to avoid. Sabotage-proved: rail off the corner, cap removed, left gutter cut to 4px, and a px-3 utility restored each fail the right test with a message naming the cause. A pure restyle no longer breaks them, which is what went wrong here.
…onstant Two review items, both right, both the failure this file exists to catch. _applies passes on a gated rule, so md:fixed md:bottom-0 md:right-0 satisfied the corner guarantee while the rail was unpinned below that breakpoint. The file's own matcher tests say a positive guarantee takes _only_under; the rail assertions were the place that did not. Counting "padding*: STACK_" per file said nothing about which constant reached which property. paddingLeft fed from STACK_CARD_INSET_RIGHT still counted two, left the 22px floor vouching for a 28px constant nothing applied, and rendered a 16px gutter that clips the shadow the floor exists for. Now read per rail as a property-to-constant map and compared whole. Both sabotages fail the right test: gating the three utilities fails the corner test, and swapping paddingLeft's constant fails the gutter test.
Two more of the same shape, both right. The cap was a substring test, so md:max-h-[100dvh] counted as capped while every viewport below that breakpoint could spill cards off screen again. It takes _only_under now, like the corner assertions. The rem-padding refusal matched a bare token only, so !px-3 walked past it -- and an important Tailwind padding beats the non-important inline px padding outright, which is precisely the rem-scaled offset the constants exist to avoid. It reads through _split_variants now, so the variants and the importance marker come off first, and arbitrary rem values are refused alongside the numeric scale. Sabotages: md:max-h-[100dvh] fails the three capping tests, !px-3 and md:!px-3 each fail the gutter test. All three passed before.
…value
Three review items, all right, and two of them the same lesson twice.
test_overlay_layering.py found the rail with rfind("<")/find(">"). An attribute
holding a comparison starts that scan mid-expression and drops every class before
it, so a hard-coded z-index earlier in the className is invisible and the layering
test passes over the regression it exists to catch. The bracket- and literal-aware
scanner it needed already existed in test_update_release_notes.py, so it moves to
tests/_shared/jsx_tags.py and both files import it. tests/conftest.py already puts
that directory on sys.path for exactly this reason, in its own words: so the levels
"share one module rather than each growing a private copy".
The padding refusal enumerated spellings and kept missing them: first !px-3, then
px-2.5 (fractional, and this repo uses it) and !pr-[0px] / md:!p-[4px] (arbitrary,
non-rem, and !important beats the inline declaration outright). Enumerating values
has an endless tail, so it matches the PROPERTY now: the rail's padding comes from
the inline px style, and ANY padding utility on it is either rem-scaled or an
override. Seven spellings sabotage-proved, including all five named in review, plus
a plain pt-4.
The truncated-tag case is proved too: a comparison attribute before the test id
with z-[99] added to the className now fails the layering test.
ps- and pe- were outside the character class, and this repo uses both (ps-9, ps-1.5, ps-[5px], pe-[calc(...)]), so !ps-3 on a rail would have overridden the inline start gutter with a rem-scaled value and passed. The side letter stays optional and a "-" still has to follow it, so pointer-events-none, peer-* and place-items-center are unaffected; that is asserted as a control alongside the four sabotages (ps-3, !ps-3, pe-[calc(1rem)], md:!pe-2), each of which fails the gutter test.
…opped The class-anchored matcher this PR replaces carried "pointer-events-none" inside its pattern, so the rule was enforced as a side effect of finding the element. Anchoring on the testid found the rail without it, and nothing else asserted it. That is a behaviour contract, not styling. The rail spans its whole cap with a 28px transparent shadow gutter and a scroll region, and the cards inside opt back in with pointer-events-auto (the download panel by name), so a rail that loses the container rule swallows clicks meant for the UI behind it. Asserted ungated, next to the corner rules. Dropping the class fails the test, and so does gating it behind a breakpoint.
…ered part
_class_value answers what the className renders in EVERY state, which is what the
positive corner and cap guarantees need. The padding prohibition was reading the
same set, and for a "must never" that is the wrong question: cn("...", compact &&
"!pl-0") overrides the inline gutter whenever compact is true, and an
always-rendered reader never sees the token at all.
_rail_class_tokens reads the literals out of the whole expression instead, and the
two readers stay side by side with the asymmetry written down: "must always have X"
and "must never have Y" cannot be answered from the same set.
Sabotage: wrapping both rails as cn("...", isUpdating && "!pl-0") now fails the
gutter test and passed before.
…family Tailwind has two ways to set padding and the guard only knew one. The arbitrary-property form is emitted with !important and, once _split_variants has taken the marker off, begins with "[", so a pattern anchored on "p" never sees ![padding:0px] or [padding-left:0px]! at all. Both spellings now sit in one named pattern. The side letter stays optional with a "-" required after it, so pointer-events-none, peer-* and place-items-* are still out, and [margin-left:4px] and [position:fixed] are too; that control is asserted alongside the four sabotages (![padding:0px], [padding-left:0px]!, md:![padding-inline:1rem], [padding-block:2px]).
c7f992f to
948c27a
Compare
|
Codex Review: Didn't find any major issues. Hooray! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
…pattern (unslothai#11268) * Find the overlay rails by testid, not by the corner spelled into the pattern unslothai#11260 moved the rails flush to the bottom-right corner (right-4 -> right-0, max-h-[calc(100dvh_-_8px)] -> max-h-[100dvh]) and paid the inset as inline px padding. Four tests across two files matched the rail with a regex that spelled the old corner into the pattern, so they found nothing and reported the rails as missing rather than as moved: test_overlay_layering.py::test_the_notification_stack_uses_the_named_layer test_update_release_notes.py::test_the_overlay_stack_fits_the_viewport test_update_release_notes.py::test_the_desktop_stack_is_capped_like_the_browser_one test_update_release_notes.py::test_the_download_panel_can_shrink_inside_the_capped_stack The product change is deliberate and documented; the matchers are what move. Both files now find the rails by data-testid="overlay-rail", which is the same reasoning test_update_release_notes.py already grew _class_on_testid for: an anchor built out of the classes under test cannot survive one of them changing. Where the rail sits is now a claim in its own test rather than a side effect of the matcher, and the gutter rule unslothai#11260 introduced gets one too: the cap is the whole viewport and the gutters are paid as inline px, so the cards keep the band they had. That test also holds the two floors the comment gives (22px left and 14px top, from the deepest card shadow) and refuses a rem-valued padding utility, which is the unslothai#8082 failure the constants exist to avoid. Sabotage-proved: rail off the corner, cap removed, left gutter cut to 4px, and a px-3 utility restored each fail the right test with a message naming the cause. A pure restyle no longer breaks them, which is what went wrong here. * Require the rail's corner ungated, and bind each padding to its own constant Two review items, both right, both the failure this file exists to catch. _applies passes on a gated rule, so md:fixed md:bottom-0 md:right-0 satisfied the corner guarantee while the rail was unpinned below that breakpoint. The file's own matcher tests say a positive guarantee takes _only_under; the rail assertions were the place that did not. Counting "padding*: STACK_" per file said nothing about which constant reached which property. paddingLeft fed from STACK_CARD_INSET_RIGHT still counted two, left the 22px floor vouching for a 28px constant nothing applied, and rendered a 16px gutter that clips the shadow the floor exists for. Now read per rail as a property-to-constant map and compared whole. Both sabotages fail the right test: gating the three utilities fails the corner test, and swapping paddingLeft's constant fails the gutter test. * Read the cap and the padding utilities through their variants Two more of the same shape, both right. The cap was a substring test, so md:max-h-[100dvh] counted as capped while every viewport below that breakpoint could spill cards off screen again. It takes _only_under now, like the corner assertions. The rem-padding refusal matched a bare token only, so !px-3 walked past it -- and an important Tailwind padding beats the non-important inline px padding outright, which is precisely the rem-scaled offset the constants exist to avoid. It reads through _split_variants now, so the variants and the importance marker come off first, and arbitrary rem values are refused alongside the numeric scale. Sabotages: md:max-h-[100dvh] fails the three capping tests, !px-3 and md:!px-3 each fail the gutter test. All three passed before. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Share one JSX scanner, and refuse padding by property rather than by value Three review items, all right, and two of them the same lesson twice. test_overlay_layering.py found the rail with rfind("<")/find(">"). An attribute holding a comparison starts that scan mid-expression and drops every class before it, so a hard-coded z-index earlier in the className is invisible and the layering test passes over the regression it exists to catch. The bracket- and literal-aware scanner it needed already existed in test_update_release_notes.py, so it moves to tests/_shared/jsx_tags.py and both files import it. tests/conftest.py already puts that directory on sys.path for exactly this reason, in its own words: so the levels "share one module rather than each growing a private copy". The padding refusal enumerated spellings and kept missing them: first !px-3, then px-2.5 (fractional, and this repo uses it) and !pr-[0px] / md:!p-[4px] (arbitrary, non-rem, and !important beats the inline declaration outright). Enumerating values has an endless tail, so it matches the PROPERTY now: the rail's padding comes from the inline px style, and ANY padding utility on it is either rem-scaled or an override. Seven spellings sabotage-proved, including all five named in review, plus a plain pt-4. The truncated-tag case is proved too: a comparison attribute before the test id with z-[99] added to the className now fails the layering test. * Cover the logical padding utilities too ps- and pe- were outside the character class, and this repo uses both (ps-9, ps-1.5, ps-[5px], pe-[calc(...)]), so !ps-3 on a rail would have overridden the inline start gutter with a rem-scaled value and passed. The side letter stays optional and a "-" still has to follow it, so pointer-events-none, peer-* and place-items-center are unaffected; that is asserted as a control alongside the four sabotages (ps-3, !ps-3, pe-[calc(1rem)], md:!pe-2), each of which fails the gutter test. * Keep the rail's pointer-events contract, which the new matcher had dropped The class-anchored matcher this PR replaces carried "pointer-events-none" inside its pattern, so the rule was enforced as a side effect of finding the element. Anchoring on the testid found the rail without it, and nothing else asserted it. That is a behaviour contract, not styling. The rail spans its whole cap with a 28px transparent shadow gutter and a scroll region, and the cards inside opt back in with pointer-events-auto (the download panel by name), so a rail that loses the container rule swallows clicks meant for the UI behind it. Asserted ungated, next to the corner rules. Dropping the class fails the test, and so does gating it behind a breakpoint. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Read prohibitions off the whole class expression, not the always-rendered part _class_value answers what the className renders in EVERY state, which is what the positive corner and cap guarantees need. The padding prohibition was reading the same set, and for a "must never" that is the wrong question: cn("...", compact && "!pl-0") overrides the inline gutter whenever compact is true, and an always-rendered reader never sees the token at all. _rail_class_tokens reads the literals out of the whole expression instead, and the two readers stay side by side with the asymmetry written down: "must always have X" and "must never have Y" cannot be answered from the same set. Sabotage: wrapping both rails as cn("...", isUpdating && "!pl-0") now fails the gutter test and passed before. * Cover Tailwind's arbitrary padding properties as well as its utility family Tailwind has two ways to set padding and the guard only knew one. The arbitrary-property form is emitted with !important and, once _split_variants has taken the marker off, begins with "[", so a pattern anchored on "p" never sees ![padding:0px] or [padding-left:0px]! at all. Both spellings now sit in one named pattern. The side letter stays optional with a "-" required after it, so pointer-events-none, peer-* and place-items-* are still out, and [margin-left:4px] and [position:fixed] are too; that control is asserted alongside the four sabotages (![padding:0px], [padding-left:0px]!, md:![padding-inline:1rem], [padding-block:2px]). --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
What
Four tests across two files are red on main since #11260 (
2485a8fd9), which moved the notification rails flush to the bottom-right corner:Both files found the rail with a regex that spelled the old corner into the pattern:
So after #11260 it matched nothing, and the tests reported the rails as missing rather than as moved:
test_overlay_layering.py::test_the_notification_stack_uses_the_named_layertest_update_release_notes.py::test_the_overlay_stack_fits_the_viewporttest_update_release_notes.py::test_the_desktop_stack_is_capped_like_the_browser_onetest_update_release_notes.py::test_the_download_panel_can_shrink_inside_the_capped_stackThe product change is deliberate and documented in the commit. The matchers are what move.
The change
Both files now find the rails by
data-testid="overlay-rail", which #11260 added. This is the same reasoningtest_update_release_notes.pyalready grew_class_on_testidfor, in its own words: "An anchor built from classes cannot survive one of them being inserted or reordered, which is the failure this file is being fixed for." The rail matcher was the one place that had not been converted.Two claims that used to ride along inside the matcher now get tests of their own:
test_both_rails_are_still_pinned_to_the_bottom_right_corner- a testid-anchored matcher would happily return a rail that had wandered to the top left, so the corner is asserted explicitly and names the rail that moved.test_the_rail_gutters_come_out_of_the_cap_and_not_the_cards- Studio: stop the overlay rail clipping card shadows in dark mode #11260's actual claim, which no class can carry any more now the gutters are inline px. It holds the two floors the comment gives (22px left and 14px top, from the deepest card shadow0 8px 28px -6px), requires both rails to take all four paddings from named constants, and refuses a rem-valued padding utility, which is the Studio: add a loaded models indicator with per-model eject #8082 failure those px constants exist to avoid.Verification
a945e399f: 4 failed, 192 passed.right-0toleft-0)test_both_rails_are_still_pinned_to_the_bottom_right_cornertest_the_rail_gutters_come_out_of_the_cap_and_not_the_cardspx-3rem utility restoredA pure restyle no longer breaks them, which is exactly what went wrong here.
Stack
Based on #11255, which is based on #11262. Merge order: 11262, 11255, this, then 11263 / 11257.