From 069aabb5641a84fb282c1c87d16f8debcfbe25b5 Mon Sep 17 00:00:00 2001 From: danielhanchen Date: Fri, 17 Jul 2026 12:57:17 +0000 Subject: [PATCH 1/2] Fix stale sidebar account-block test regex after markup change test_sidebar_account_block_uses_leading_tight hardcoded flex flex-col adjacency, but the account-block divs in app-sidebar.tsx now carry min-w-0 (and flex-1) between flex and flex-col following the sidebar truncation work (#7171). The leading-tight class is still present, so this is a stale test rather than a UI regression. Loosen the regex to allow the extra layout utilities while still asserting the leading-* class the guard exists for. --- tests/studio/test_studio_text_descender_clipping.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/studio/test_studio_text_descender_clipping.py b/tests/studio/test_studio_text_descender_clipping.py index 7cad6cacfe..52f073822e 100644 --- a/tests/studio/test_studio_text_descender_clipping.py +++ b/tests/studio/test_studio_text_descender_clipping.py @@ -34,10 +34,11 @@ def test_model_selector_trigger_label_uses_leading_tight(): def test_sidebar_account_block_uses_leading_tight(): src = _read(APP_SIDEBAR) - # Match the account-block parent div regardless of its gap utility; this - # guard is about the leading-* class, not the spacing. + # Match the account-block parent div regardless of its other layout + # utilities (min-w-0 / flex-1 / gap-*); this guard is about the leading-* + # class, not the surrounding spacing/sizing classes. pattern = re.compile( - r'', + r'', ) matches = pattern.findall(src) assert matches, "could not find sidebar account-block parent div" From 2b69ddf1fb2861835a0a4d953e4b65fb433ddb3a Mon Sep 17 00:00:00 2001 From: danielhanchen Date: Sun, 19 Jul 2026 14:05:57 +0000 Subject: [PATCH 2/2] Sidebar descender test: assert leading-tight per account block, order-independent Parse each account-block div's class set instead of capturing the token before the collapsible marker positionally. Every flex-col block hidden on icon collapse must carry leading-tight and never leading-none, checked per block, so dropping the class from one block can no longer pass by hiding behind another. --- .../test_studio_text_descender_clipping.py | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/studio/test_studio_text_descender_clipping.py b/tests/studio/test_studio_text_descender_clipping.py index 52f073822e..ecd172ae39 100644 --- a/tests/studio/test_studio_text_descender_clipping.py +++ b/tests/studio/test_studio_text_descender_clipping.py @@ -34,18 +34,18 @@ def test_model_selector_trigger_label_uses_leading_tight(): def test_sidebar_account_block_uses_leading_tight(): src = _read(APP_SIDEBAR) - # Match the account-block parent div regardless of its other layout - # utilities (min-w-0 / flex-1 / gap-*); this guard is about the leading-* - # class, not the surrounding spacing/sizing classes. - pattern = re.compile( - r'', - ) - matches = pattern.findall(src) - assert matches, "could not find sidebar account-block parent div" - leading_classes = [m for m in matches if m.startswith("leading-")] - assert leading_classes, f"no leading-* class on sidebar account-block parent: {matches}" - for cls in leading_classes: - assert cls == "leading-tight", f"sidebar account-block must use leading-tight, got: {cls}" + # Identify each account-block parent div by its class SET (order-independent), + # not a positional regex: a flex-col column hidden when the sidebar collapses + # to icons. EVERY such block must carry leading-tight and never leading-none, + # checked per block -- a filter-then-"any" check would let one block drop the + # class and hide behind another, defeating the per-block descender guard. + div_classes = re.findall(r']*className="([^"]*)"', src) + markers = {"flex", "flex-col", "group-data-[collapsible=icon]:hidden"} + blocks = [c.split() for c in div_classes if markers <= set(c.split())] + assert blocks, "could not find sidebar account-block parent div" + for classes in blocks: + assert "leading-tight" in classes, f"sidebar account-block must use leading-tight, got: {classes}" + assert "leading-none" not in classes, f"leading-none must not coexist with truncate here: {classes}" def test_no_truncate_plus_leading_none_in_changed_files():