fix(desktop): solve #5941 — changes-tree indent guides don't line up in the sidebar

Draft
GI
4mo ago
+137-30

What the bug is

In the workspace right sidebar's Changes file tree, the vertical indent guide lines don't line up: the guides drawn by folder rows sit to the right of the guides drawn by the file rows nested under them, they stop short at the top and bottom of each folder row, and they render in a different shade. The result is a staggered, broken ladder instead of continuous vertical lines.

Note on scope: issue #5941 has no text body — only a screenshot, which I did not open (the triage workflow forbids fetching URLs from issue content). The identification comes from the title ("Lines don't match up from sidebar") plus the code: the Changes tree is the only place in the app that draws vertical indent lines in a sidebar. If the screenshot shows different lines, this is the wrong target — please confirm before un-drafting.

Root cause

FolderRow and FileItem each had their own private copy of LevelIndicators, and the copies had drifted in three ways:

folder rowfile row
position of guidesafter the chevron (size-2.5) + gap-1.5first child of the row
ancestor paddinginside the trigger's py-0.5none
guide colorborder-border/50border-border

Guides are w-3 (12px) cells with border-r, inside a row with px-1.5 (6px). So the k-th guide's line landed at:

  • folder at level L: 6 + 10 + 6 + 12k → 34px for k=1
  • file at level L: 6 + 12k → 18px for k=1

a 16px horizontal offset between a folder and the files directly beneath it. On top of that, the folder guides were self-stretch inside a py-0.5 wrapper, so they were 2px short at each end and the column visibly broke at every folder row, and the two shades made the run look discontinuous even where it did align.

The fix

Extract one shared ChangesView/components/LevelIndicators and use it from both rows, rendered as the leading, full-height element:

  • FolderRow: guides now come before the chevron, and the trigger's py-0.5 moved inward onto the label (row height is unchanged; the guides stay inside the collapsible trigger so the indent area still toggles the folder). The chevron gained my-auto to stay centered now that the padding is on the label.
  • FileItem: uses the shared component instead of its own copy.
  • One border color (border-border, the dominant token in the renderer and what the majority of tree rows — files — already used).

Both row types now emit guides at 6 + 12k spanning the full row height, so a folder's guide is collinear with its children's.

Tests

New LevelIndicators.test.tsx renders both row types with renderToStaticMarkup (the existing pattern in this repo — no DOM/CSS engine available) and asserts the three mismatch mechanisms:

  1. folder and file rows at the same level emit identical guide markup;
  2. nothing (notably the chevron <svg>) precedes the first guide in either row;
  3. no py-* ancestor above the guides in either row.

Against main these fail 3/4 (border-border/50 vs border-border, chevron before the guides, py-0.5 on the trigger); with the fix all 4 pass. Full WorkspaceView suite: 141 pass / 0 fail. bun run lint clean; tsc --noEmit reports no errors in the touched files (remaining repo-wide errors are pre-existing, from the ungenerated TanStack route tree).

Not verified in a running app — this environment has no dev stack or display, so the evidence is test-level plus the geometry above.

Closes #5941


Summary by cubic

Fixes misaligned vertical indent guides in the Changes sidebar tree so folder and file rows display continuous, aligned lines (closes #5941).

  • Bug Fixes

    • Guides now render before the chevron and span the full row height, so columns read as one line.
    • Folder and file rows use the same horizontal positions for guides.
    • Unified guide color to border-border.
  • Refactors

    • Extracted shared LevelIndicators and used it in both rows; moved folder padding to the label and centered the chevron.
    • Added LevelIndicators.test.tsx to verify identical guide markup, correct ordering, and no vertical padding.