Skip to content

feat(web): filter sidebar threads by environment - #8530

Open
saphid wants to merge 3 commits into
pingdotgg:mainfrom
saphid:web/sidebar-environment-filter
Open

saphid wants to merge 3 commits into
pingdotgg:mainfrom
saphid:web/sidebar-environment-filter

Conversation

@saphid

@saphid saphid commented Aug 28, 2026 •

Copy link
Copy Markdown
Contributor

With multiple environments, web and desktop mix every machine’s threads in the sidebar. This adds an Environments checklist beside the project picker to narrow the list and an All environments action to restore it.

The session-only selection applies to pinned, active, settled, snoozed, and draft rows, and combines with the persisted project filter. Project choices follow the enabled environments; hiding every environment for the selected project resets its scope. At least one environment stays enabled, newly added environments appear by default, and removed catalog entries are pruned during render. The user guide explains both filters and how to clear them, addressing Theo’s documentation carryover from #9241.

Rebased onto current main (b2b43bef73). Main had since extracted the sidebar header into SidebarThreadHeader, so the environment-filter menu now passes through as a new environmentFilter prop on that component instead of living inline; behavior and rendering are unchanged. Upstream’s persisted project scope, machine badges, and current sidebar rendering are retained. Searches of upstream history and merged/open sidebar-filter PRs found no equivalent environment filter on main.

Verification:

  • vp test run apps/web/src/components/Sidebar.logic.test.ts: 168 passed.
  • vp exec tsc --noEmit -p apps/web/tsconfig.json: passed after vp i restored missing dependencies; existing Effect suggestions remain.
  • vp lint apps/web/src/components/Sidebar.tsx apps/web/src/components/Sidebar.logic.ts apps/web/src/components/Sidebar.logic.test.ts: passed, existing warnings remain.
  • vp fmt --check on the four changed files and git diff --check: passed.

Existing real-client evidence compares base e3b644c5af with candidate 5a9505325, captured at 1280×800 using two disposable servers paired through the normal UI. These are older recordings: the visible environment-menu structure is unchanged, so they still demonstrate filtering and restoring the list. This refresh adds an accessible active-filter label and uses an unambiguous pagination-reset key; neither changes the recorded appearance. They do not show newer upstream sidebar styling or machine badges. A fresh attached-preview pass on the final candidate paired two disposable local servers through the normal UI: filtering reduced two bootstrap rows to one, All environments restored both, and the accessible button name changed to include (filter active) and back.

Before — threads from both environments:

Before: threads from both environments

After — filter to one environment, then restore all:

After: filter to one environment, then restore all

Full before recording · Full after recording

The GIFs were downloaded, decoded, and sample frames inspected during this refresh. Electron, relay/tunnel, and catalog removal were not exercised in a live client; focused tests cover catalog pruning and the last-enabled guard. Mobile uses a separate thread list. This change adds no provider, backend, or wire-contract behavior; global search and the command palette retain their existing scope.

Independent review: direct Claude Fable 5, high, read-only with tools disabled, exited 0. Its accessible-label and pagination-key findings were fixed and the final diff reviewed again. The draft-count dependency concern was ruled out by inspecting the per-render store selector. Remaining evidence gap: the attached preview exposed the disabled menu row in the DOM but omitted the menu in captured pixels; disabled-row tooltip hover/video proof remains unverified. Existing before/after interaction media is retained; this gap prevents claiming complete tooltip verification.

Coordination trace: T3 thread f8f62d4f-e284-46ce-a13c-b973c02e21ee

Refresh and verification: GPT-6 Astra in Codex (T3 Code). Independent review: Claude Fable 5 high in Claude Code.

Summary by CodeRabbit

  • New Features

    • Added an Environments sidebar filter for hiding threads, drafts, and project entries from selected environments.
    • Prevents all environments from being disabled at once and automatically updates filtering when environments disconnect.
    • Restores broader project scope when the selected project is unavailable in enabled environments.
    • Shows a dedicated empty state when filters hide all entries.
  • Documentation

    • Documented combining project and environment filters in the thread sidebar.

@coderabbitai

coderabbitai Bot commented Aug 28, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: bc2caefd-8000-47b0-8866-8d8eb1aea76c

📥 Commits

Reviewing files that changed from the base of the PR and between 8c4fd21 and 7985c1c.

📒 Files selected for processing (2)
  • apps/web/src/components/Sidebar.tsx
  • docs/user/thread-sidebar.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • docs/user/thread-sidebar.md

Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

The sidebar adds a session-only environment filter. It hides matching threads, drafts, and project entries, maintains valid selections as environments connect or disconnect, and documents the new controls.

Changes

Sidebar environment filtering

Layer / File(s) Summary
Environment filter logic and tests
apps/web/src/components/Sidebar.logic.ts, apps/web/src/components/Sidebar.logic.test.ts
Adds helpers to toggle disabled environments, preserve one enabled environment, prune disconnected ids, and reset invalid filters. Tests cover these behaviors and same-instance returns.
Sidebar filter state and row filtering
apps/web/src/components/Sidebar.tsx
Tracks pruned filter state, updates project scope, filters drafts and threads, clears hidden selections, and resets settled-tail pagination.
Environment filter menu and documentation
apps/web/src/components/Sidebar.tsx, docs/user/thread-sidebar.md
Adds the environment menu, last-environment protection, filtered empty state, and documentation for combined project and environment filters.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant EnvironmentMenu
  participant Sidebar
  participant ThreadList
  participant DraftRows
  User->>EnvironmentMenu: Toggle an environment
  EnvironmentMenu->>Sidebar: Update disabled environment ids
  Sidebar->>ThreadList: Recompute visible threads
  Sidebar->>DraftRows: Recompute visible drafts
  ThreadList-->>User: Show enabled-environment threads
  DraftRows-->>User: Show enabled-environment drafts
Loading

Suggested reviewers: juliusmarminge, t3dotgg, maria-rcks

Merge Risk: ⚪ Minimal · up to 7985c

The environment filter behavior and its sidebar state transitions are covered by the supplied implementation and tests; no actionable merge risk remains.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 3 files. (1 skipped: 1… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely identifies the main change: adding environment filtering to the web sidebar thread list.
Description check ✅ Passed The description explains what changed, why it changed, UI behavior, verification results, evidence, and known gaps. It does not reproduce the template headings or checklist, but it is sufficiently com…
Full details: Docstring Coverage

Explanation

Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 3 files. (1 skipped: 1 unsupported.)

✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Aug 28, 2026
@macroscopeapp

macroscopeapp Bot commented Aug 28, 2026 •

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Not approved

Macroscope's review found this PR not approvable — This adds a new environment-filter workflow with production-side state and changes to project menus, drafts, thread partitioning, selection, pagination, and empty states. It preserves the all-environments default and adds helper tests, but the breadth of the user-facing behavior warrants human review.

You can add or adjust custom eligibility rules. Learn more.

macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Aug 28, 2026
@saphid
saphid force-pushed the web/sidebar-environment-filter branch from 258c853 to 8983e13 Compare August 28, 2026 21:35
@macroscopeapp
macroscopeapp Bot dismissed their stale review August 28, 2026 21:35

Dismissing prior approval to re-evaluate 8983e13

@macroscopeapp macroscopeapp Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

One consistency finding on the new environment-filter trigger: it is the only icon SidebarMenuButton in this header row without the coarse-pointer hit-target overlay its neighbors use. Everything else (Menu/MenuPopup/MenuCheckboxItem composition, width-class contract on MenuPopup, active-filter dot matching PullRequestListFilters) matches the shared component system.

Posted via Macroscope — UI Consistency

Comment thread apps/web/src/components/Sidebar.tsx Outdated
Comment thread apps/web/src/components/Sidebar.tsx Outdated
@saphid
saphid force-pushed the web/sidebar-environment-filter branch 2 times, most recently from 14ed67b to 72c948d Compare August 29, 2026 03:48

@macroscopeapp macroscopeapp Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Two consistency findings on the new environment filter control in apps/web/src/components/Sidebar.tsx. Everything else (dot indicator matching PullRequestListFilters, MenuPopup width contract, SidebarMenuButton icon-color indirection) lines up with the existing system.

Posted via Macroscope — UI Consistency

Comment thread apps/web/src/components/Sidebar.tsx Outdated
Comment thread apps/web/src/components/Sidebar.tsx Outdated

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit d80e30b. Configure here.

Comment thread apps/web/src/components/Sidebar.logic.ts Outdated

@macroscopeapp macroscopeapp Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

One finding on the new commit: the locked environment row explains its constraint with a native title attribute instead of the shared Tooltip primitive. Details inline.

Posted via Macroscope — UI Consistency

Comment thread apps/web/src/components/Sidebar.tsx Outdated

@macroscopeapp macroscopeapp Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

One finding on the newest commit: the environment checkbox rows now pin data-highlighted text colors, which overrides MenuCheckboxItem's accent-surface foreground contract.

Posted via Macroscope — UI Consistency

Comment thread apps/web/src/components/Sidebar.tsx Outdated
Comment thread apps/web/src/components/Sidebar.tsx Outdated
@t3dotgg

t3dotgg commented Sep 4, 2026

Copy link
Copy Markdown
Member

Note

🤖 GPT-6 Astra (preview) responding on behalf of Theo

This note is part of an automated cleanup pass.

Documentation carryover from #9241 at 32c1c96: update docs/user/thread-sidebar.md to explain that web and desktop can filter by project and environment, and explain how to clear each filter. Adapt the text to this PR's retained combobox and environment controls. Do not copy the alternative's Project/Environment submenu instructions. This records documentation work for follow-up and does not claim the text has been added.

macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Sep 7, 2026
@cursor

cursor Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Bugbot is paused — on-demand spend limit reached

Bugbot uses usage-based billing for this team and has hit its on-demand spend limit.

A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue.

@saphid
saphid force-pushed the web/sidebar-environment-filter branch from 5a95053 to abf6424 Compare September 11, 2026 02:37
@macroscopeapp
macroscopeapp Bot dismissed their stale review September 11, 2026 02:37

Dismissing prior approval to re-evaluate abf6424

@saphid

saphid commented Sep 11, 2026

Copy link
Copy Markdown
Contributor Author

Docs carryover from #9241 is addressed in abf6424: docs/user/thread-sidebar.md now has a Filter the thread list section. It covers the project picker (clear it with All projects), the Environments menu (clear it with All environments; at least one environment stays selected), and how the two filters combine. It describes this PR's combobox and environment menu, not the Project/Environment submenu from #9241.

@saphid
saphid force-pushed the web/sidebar-environment-filter branch 2 times, most recently from 02c5cb5 to 8c4fd21 Compare September 11, 2026 12:36
@saphid

saphid commented Sep 12, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto b1e223e2b0 and verified the current sidebar implementation. Theo’s #9241 documentation carryover remains in docs/user/thread-sidebar.md; the previous reply and all eight resolved inline threads still apply.

CodeRabbit’s docstring-coverage warning is not being addressed with additional boilerplate: the helper comments already explain the disabled-set representation, last-enabled guard, and catalog-reset constraint. AGENTS.md asks us to keep explanations close to the code and avoid narrating discoverable implementation. Its aggregate coverage threshold does not establish a missing user-facing instruction.

Direct independent reviewer command (frozen full diff provided on stdin):

claude -p --safe-mode --model claude-fable-5 --effort high --tools '' --strict-mcp-config --no-session-persistence --output-format json --system-prompt '<read-only review instructions>'

Actual review model: claude-fable-5; final review process exit: 0. Standards baseline: 144fbf46af335d8d18a95c8d4b4f2e9e0207fa2e. An initial invocation returned only a plan and was discarded. Completed reviews found no high/medium code defects. I fixed the accessible active-filter name and made the pagination-reset key unambiguous, then repeated the 168-test sidebar suite, web typecheck, targeted lint, format, and diff checks successfully.

Other independent suggestions were checked: persisted project-scope reset is the intended behavior when its environments are hidden; the empty-state text describes the current scope; conditional tooltip wrapping matches the existing filter primitives; and the draft count is a per-render store selector, not a memo missing dependencies. No change warranted for those findings.

Fresh disposable-client verification confirms filtering/restoring both environments and the accessible label in both states. The PR body retains the older before/after GIFs and explicitly records the remaining disabled-row tooltip capture gap. Macroscope’s human-review requirement remains a maintainer decision; I am not treating its skipped check as approval.

@saphid
saphid force-pushed the web/sidebar-environment-filter branch from 8c4fd21 to 7985c1c Compare September 12, 2026 11:48
saphid and others added 2 commits September 24, 2026 22:26
@saphid
saphid force-pushed the web/sidebar-environment-filter branch from 7985c1c to a6e6d5a Compare September 24, 2026 12:28
The rebase onto current main carried the environment-filter menu's
focus-ring, font-weight, and disabled-row color overrides on
SidebarMenuButton and MenuCheckboxItem, which now trip the shadcn
no-restyle lint rule (those components own their own shape/color/
typography). Drop the overrides and rely on each component's own
default treatment.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants