Skip to content

Show thread storage as a folder tree in the Info panel - #5144

Merged
brsbl merged 13 commits into
mainfrom
bb/thread-storage-viz-design-thr_pkx7jnw5gf
Oct 7, 2026
Merged

brsbl merged 13 commits into
mainfrom
bb/thread-storage-viz-design-thr_pkx7jnw5gf

Conversation

@brsbl

@brsbl brsbl commented Oct 7, 2026 •

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

#4898 replaced the thread storage file tree with a flat list. Files in nested folders lost their structure and showed only the last folder name as a hint. The Info panel rows also highlighted on every hover, and the changed-file line counts appeared whenever the pointer crossed a row. That made the panel busy to move through.

What changed

Thread storage tree

  • Thread storage is a folder tree again, built from the same Info list rows instead of @pierre/trees.
  • Folders start closed, show a 12px caret, and list before files.
  • A folder holding only one subfolder shows as one row (qa/screenshots).
  • Children indent one glyph per level, with guide lines in the commit rail's style.
  • Folder names use the quiet tertiary color. File names stay full color.
  • Search opens every matching folder and keeps the five-row cap and "N more".
  • Selecting a stored file elsewhere (a tab or file search) opens the folders above it.

Info rows

  • Rows no longer get a hover background. Clickable rows show a pointer cursor.
  • Keyboard focus shows a soft row background (bg-state-hover) instead of a ring.
  • The row action is labelled "Open file in tab".

Changed files

  • The line counts appear only while the size squares are hovered, or while the row has keyboard focus. Their hover target is 64×24px, and clicking it opens the diff.
  • The folder hint shows the full parent path with a trailing slash (src/feature/). It is truncated from the left, so the nearest folder stays visible, and it gives way before the file name.

Panel

  • The commit timeline continues past the last commit with a fading tail, so a single commit still reads as a timeline.
  • When only the properties block renders, it ends with a divider.

Shared code

  • TruncateStart adds a trailing direction mark, so trailing punctuation stays at the end.

No API, CLI, SDK, persisted data or wire changes.

How you verified

Screenshots come from the branch web app in headless Chrome for Testing through the Browser Automation plugin, at 2×. Both revisions use the same seeded fixture threads:

  • Full: 8 commits, 8 uncommitted files including a deeply nested path, 14 nested storage files, and 2 forks.
  • Merge conflict: 1 commit.
  • Clean: properties only.

Before: 54a4a22 (merge base) · After: e61dba9, except the properties-only row at 652e555 (PR head). The only commit after e61dba9 changes the keyboard-focus reveal of line counts, which none of these states show. Captured at 2×.

Screen / state Viewport Before After
Info panel / default Desktop · 1440×1800 Before: Info panel / default After: Info panel / default
Thread storage / fully shown (before: "N more" opened; after: folders opened) Desktop · 1440×1800 Before: Thread storage / fully shown (before: "N more" opened; after: folders opened) After: Thread storage / fully shown (before: "N more" opened; after: folders opened)
Thread storage / search "md" Desktop · 1440×1800 Before: Thread storage / search "md" After: Thread storage / search "md"
Uncommitted file / size squares hovered Desktop · 1440×1800 Before: Uncommitted file / size squares hovered After: Uncommitted file / size squares hovered
Commits / one commit Desktop · 1440×1800 Before: Commits / one commit After: Commits / one commit
Info panel / properties only Desktop · 1440×1800 Before: Info panel / properties only After: Info panel / properties only
Thread storage / fully shown Mobile · 390×844 Before: Thread storage / fully shown After: Thread storage / fully shown

Slop Cop (one cumulative review of all five panels, at d1b5033):

  • Security, architecture, code quality and performance were reviewed. End-to-end QA in the exact build passed all seven flows with no console errors.
  • Two P1s, both fixed in 7a74b10:
    • Row names were set not to shrink. Commit rows have two actions, which then slid under the timestamp.
    • Storage search rendered every match without the row cap.
  • P2s go to a follow-up PR:
    • collator reuse in the tree sort
    • merged folders collapsing when they split
    • expanded folders carrying over between threads
    • the overflow cap counting only top-level entries
    • reusing directoryFromPath

Manual QA: signed off by the user.

Tests: new unit tests cover tree building, folder merging, ordering, ancestor paths, and opening the folders above a selected file. Remote CI runs on the PR. Tests, typecheck and lint were not run locally.

BB-Thread: Thread storage viz design
BB-Thread-ID: thr_pkx7jnw5gf

AGENT GENERATED

🤖 Generated with Claude Code

brsbl and others added 12 commits October 7, 2026 15:21
Folders nest in the shared Info list rows with carets and indent guides,
single-folder chains join into one row, and search expands matches. Info
rows no longer highlight on hover, and changed-file line counts appear only
while the size squares are hovered.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Clickable rows show a pointer cursor now that hover backgrounds are gone,
clicking a changed file's size squares opens its diff again, keyboard
focus on a changed-file row reveals its line counts, and selecting a stored
file opens the folders above it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The hint truncates from the start so the nearest folder stays visible, and
row names keep their width while the hint gives way.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
TruncateStart now anchors both ends of its text so trailing punctuation
stays at the end inside its right-to-left truncation box.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Row names shrink again so rows with two actions keep them clear of the
timestamp, with folder hints yielding first via a high flex-shrink. Storage
search flattens matches before the shared list cap, so large result sets show
five rows and "N more" as on main.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-07T22:26:30.638687Z e61dba9 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e61dba924f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

Comment on lines +55 to +58
return {
kind: "folder",
path: current.path,
name,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep merged folder identities stable

When an expanded chain such as qa/shots/* later gains a sibling like qa/summary.md, the merged node's identity changes from qa/shots to qa. Since expandedFolders still contains only qa/shots, the realtime inventory update unexpectedly collapses the entire branch. Use the chain's stable outer path as the expansion identity, or migrate expansion state when the tree shape changes.

Useful? React with 👍 / 👎.

Comment on lines 206 to +210
<InfoList
items={filteredFiles}
getKey={(file) => file.path}
renderItem={(file) => (
<InfoListRow
leading={
<Icon
name={resolveRightPanelFileIconName(file.path)}
className="size-3 text-subtle-foreground"
aria-hidden
/>
}
name={getFileNameFromPath({ path: file.path })}
context={getParentFolderNameFromPath({ path: file.path })}
title={`Open ${file.path}`}
selected={selectedPath === file.path}
target={{ kind: "button", onSelect: () => selectPath(file.path) }}
actions={[
{
icon: "ExternalLink",
label: "Open in tab",
onSelect: () => selectPath(file.path),
},
]}
/>
)}
items={tree}
getKey={(node) => node.path}
renderItem={(node) =>
flattenThreadStorageNode(node, isFolderExpanded).map(renderRow)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Apply the row limit to flattened visible nodes

When many files share one top-level folder, items has length one, so InfoList never enables its limit; expanding that folder immediately renders every descendant, potentially all 1,000 files returned by the storage query. This removes the previous five-row overflow gate and can make the panel extremely long and expensive to render. Limit the flattened visible rows rather than only the root nodes.

Useful? React with 👍 / 👎.

Comment on lines +32 to +35
const [expandedFolders, setExpandedFolders] = useState<ReadonlySet<string>>(
() => new Set(selectedPath ? threadStorageAncestorPaths(selectedPath) : []),
);
const [revealedPath, setRevealedPath] = useState(selectedPath);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reset folder expansion when switching threads

When the mounted thread-detail view navigates from one thread to another, this state is retained because the hook has no thread-scoped reset. Any matching folder paths in the new thread therefore start expanded instead of honoring the documented collapsed-by-default behavior, and the set accumulates paths across navigation. Scope the state to the thread ID or reset it when the thread changes.

Useful? React with 👍 / 👎.

@brsbl
brsbl merged commit 89f40e7 into main Oct 7, 2026
84 of 87 checks passed
@brsbl
brsbl deleted the bb/thread-storage-viz-design-thr_pkx7jnw5gf branch October 7, 2026 22:59
brsbl added a commit that referenced this pull request Oct 7, 2026
## Human comments

## What was wrong

The Slop Cop review of #5144 left five P2 follow-ups in the thread
storage tree.

- **Slow sort:** the tree sorted names with `localeCompare` and options,
which builds a new collator on every comparison.
- **Merged folders closing:** a merged single-child folder
(`qa/screenshots`) remembered only its deepest path. When an agent wrote
a file that split the chain, the open folder closed on its own.
- **State leaking between threads:** the open-folder state lived on the
thread view instance, so it carried over between threads.
- **Uncapped overflow:** the "N more" cap counted only top-level
entries. An opened folder rendered every child, and a selected file
behind the top-level "N more" stayed hidden even though its folders
opened.
- **Duplicate helper:** the changed-file folder hint used a local
parent-path helper that duplicated `directoryFromPath` from
`@bb/thread-view`.

## What changed

- `thread-storage-tree.ts` sorts with one module-level `Intl.Collator`.
Folder nodes carry `chainPaths`. Flattening caps each open folder's
children at five and adds a "N more" row for that folder.
- `useThreadStorageBrowser`:
  - opens and closes a whole merged chain together
  - tracks folders that show all their children
  - remembers the last selected file
  - resets folder state when `threadId` changes
- `InfoList` takes a `revealIndex` and expands when that index is behind
"N more". Its "N more" row is now `InfoListMoreRow`, which the tree
reuses at depth.
- `ChangesSection` uses `directoryFromPath`. The local
`getParentFolderPathFromPath` is removed.

No API, CLI, SDK, persisted data or wire changes.

## How you verified

The screenshots come from the branch web app at 2×, in headless Chrome
for Testing through the Browser Automation plugin. Both sides use the
same fixture thread: 24 storage files, including a `logs/` folder with
10 files, and `plan.md` and `summary.md` behind the top-level "N more".

Before: `89f40e7` (main) · After: `d545579` (PR head) · Captured at 2×

| Screen / state | Viewport | Before | After |
| --- | --- | --- | --- |
| Thread storage / 10-file folder opened | Desktop · 1440×1800 |
![Before: folder shows all 10
files](https://github.com/user-attachments/assets/4956e084-9f91-4caf-8bae-3f5ccedd8dc7)
| ![After: folder shows 5 files and 5
more](https://github.com/user-attachments/assets/eaba8d84-af69-4d7e-8332-1ef3bace0a3b)
|
| Thread storage / folder "N more" clicked (main has no per-folder cap)
| Desktop · 1440×1800 | ![Before: folder shows all 10
files](https://github.com/user-attachments/assets/99882c6b-7973-4abc-b6b3-43dd7972cedb)
| ![After: folder shows all 10
files](https://github.com/user-attachments/assets/450a098e-c05a-4000-9bd4-a7a78613d7a3)
|
| Thread storage / merged `deep/nested` opened, then `deep/top.md`
written | Desktop · 1440×1800 | ![Before: deep closed after the
split](https://github.com/user-attachments/assets/3742806d-f430-4641-901d-da458fada0d5)
| ![After: deep and nested stay
open](https://github.com/user-attachments/assets/bba0505e-9e14-4591-a130-0d38df9c2932)
|
| Thread storage / `logs` opened, switched to another thread and back |
Desktop · 1440×1800 | ![Before: logs still open from
before](https://github.com/user-attachments/assets/2db4be17-57f6-4889-9cf5-a63557f80ada)
| ![After: logs closed
again](https://github.com/user-attachments/assets/48f419ae-9510-4e26-93d0-f126864adac1)
|
| Thread storage / after opening summary.md from its tab | Desktop ·
1440×1800 | ![Before: summary.md hidden behind 2
more](https://github.com/user-attachments/assets/3cf2d553-4b6a-40b6-801e-ffbe1019e08e)
| ![After: list expanded to show
summary.md](https://github.com/user-attachments/assets/536961d8-34f8-483e-987e-c11c324e2e07)
|
| Thread storage / 10-file folder opened | Mobile · 390×844 | ![Before:
folder shows all 10
files](https://github.com/user-attachments/assets/d7172396-7bf1-41a7-85ca-af971ebea808)
| ![After: folder shows 5 files and 5
more](https://github.com/user-attachments/assets/83c991ce-e54f-4d05-a359-f6dd387dc48c)
|

**End-to-end QA** on `d545579` (headless Chrome for Testing 154 through
the Browser Automation plugin) passed. It covered the folder cap and its
"N more", a merged folder splitting while the panel was open, switching
threads without a reload, and the console, which had no errors.

**Unit tests:**
- per-folder cap, and the case where only one child would be hidden
- `chainPaths`
- opening and closing a merged chain together
- resetting folder state on thread change
- remembering the last selected file
- `InfoList` `revealIndex`

The existing ordering tests cover the collator. Remote CI runs on the
PR. Tests, typecheck and lint were not run locally.

Follow-up to #5144.

BB-Thread: [Thread storage viz
design](https://brsbl.getbb.app/projects/proj_khiw2za95v/threads/thr_pkx7jnw5gf)
BB-Thread-ID: thr_pkx7jnw5gf

> AGENT GENERATED

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <[email protected]>
brsbl added a commit that referenced this pull request Oct 8, 2026
## Human comments

## What was wrong

Changed-file rows show the file's full folder path as a hint. When the
panel had room, a deeply nested file's hint ran most of the row's width
(`…s/design-system/src/components/navigation/sidebar/`) while the other
hints stayed short (`src/`, `docs/`). The one long hint broke the list's
rhythm.

## What changed

The Info row folder hint is capped at `max-w-44` (11rem). Long paths
still truncate from the left, so the nearest folders stay visible.
Plugin names three or four folders above a file stay readable
(`plugins/navigation/app/ui/`, `…/provider-claude-code/src/bridge/`).
Short hints don't change, and the full path stays in the row's tooltip.

Widths were compared on real bb paths. At 7rem every plugin name was
cut, and at 9rem `provider-claude-code` was still cut. At 13rem, long
`apps/` and `packages/` hints began to sprawl across the row again.

Narrow panels already truncated the hint below this width, so
phone-width layouts look the same.

## How you verified

Captured from the branch web app at 2× in headless Chrome for Testing
through the Browser Automation plugin. Both captures use the same
fixture thread. Its uncommitted files use real bb paths from `plugins/`,
`apps/app/src/` and `packages/shared-ui/`.

Before: `d18f6f2` (main) · After: `78cb136` (PR head) · Captured at 2×

| Screen / state | Viewport | Before | After |
| --- | --- | --- | --- |
| Uncommitted files / bb paths, list expanded | Desktop · 1440×1800 |
![Before: long hints run across the
row](https://github.com/user-attachments/assets/1e5c33ac-ed21-4898-bbe8-7fccfb38ea19)
| ![After: hints capped at 11rem with plugin names
visible](https://github.com/user-attachments/assets/9e882e24-7905-4605-8e6b-06beb7125290)
|

Remote CI runs on the PR. Tests, typecheck and lint were not run
locally.

Follow-up to #5144.

BB-Thread: [Thread storage viz
design](https://brsbl.getbb.app/projects/proj_khiw2za95v/threads/thr_pkx7jnw5gf)
BB-Thread-ID: thr_pkx7jnw5gf

> AGENT GENERATED

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
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