Skip to content

Machine filter and Archive (N) become two hooks in their own files - #49

Merged
ziyadakl merged 3 commits into
spec107/integrationfrom
spec107/machine-filter
Nov 3, 2026
Merged

ziyadakl merged 3 commits into
spec107/integrationfrom
spec107/machine-filter

Conversation

@ziyadakl

@ziyadakl ziyadakl commented Nov 3, 2026

Copy link
Copy Markdown
Owner

Part of ziyadakl/tokenmaxxing#119 (spec pingdotgg#107)

Summary

Sidebar.tsx
  useSidebarLookups
    withoutArchivedProjects(...)            -> allProjects, allThreads   (unchanged, archive slice's line)
    useSidebarEnvironmentFilter(...)        -> environmentFilterId, projects, projectGroups
  Sidebar body
    useSidebarEnvironmentFilterUi(...)      -> header control, labels, empty states, visibleThreads,
                                               searchEnvironmentIds, clears selection on scope change
    useSidebarBulkArchive(...)
      prepare(selectedThreads) -> menuItem, run()
      run: check -> confirm -> refresh targets -> check -> archive -> report

new files (apps/web/src/components/sidebar/)
  bulkArchive.logic.ts (+test)          moved from Sidebar.logic.ts, unchanged
  useSidebarBulkArchive.ts              the hook
  environmentFilter.logic.ts (+test)    5 functions moved from Sidebar.logic.ts + buildEnvironmentProjectGroups
  environmentFilterStore.ts (+test)     own store and localStorage key; adopts the old saved value once
  useSidebarEnvironmentFilter.tsx       the two filter hooks

Footprint, Upstream files the Fork edits (merge-base 8657eec):

Files Lines
Fork total, before 181 +13698 -2908
Fork total, after 178 +12831 -2875
This feature's files alone, before 9 +1280 -89
This feature's files alone, after 6 (Sidebar.tsx, Sidebar.logic.ts, Sidebar.logic.test.ts, SidebarThreadHeader.tsx, SidebarDraftBlock.tsx, thread-sidebar.md) +413 -56

Those 6 files also hold other slices (groups, auto-archive, desktop mirror). This feature's own lines left in Sidebar.tsx: about 60 (hook calls, the Archive menu entry and run line, imports, and the allThreads plumbing in useSidebarThreads/partitionSidebarThreads). uiStateStore.ts, uiStateStore.test.ts and SidebarDraftBlock.browser.test.tsx leave the footprint. The honest floor for the filter is about 30-45 seam lines because it changes which code sees all threads and which sees filtered ones.

Kept on purpose: hasVisibleProjects on SidebarThreadHeader (gating at the call site would re-indent the 150-line project-scope Combobox), and the allThreads/observedThreads parameters in useSidebarThreads (the notes' isVisible tip would change the snooze wake clock's input).

Evidence

  • Before (integration 0fe86c2): Sidebar.logic 122, Sidebar.drag 45, uiStateStore 20, SidebarDraftBlock.browser 1, Sidebar.logic.browser 2, Sidebar.pointer.browser 2 = 192 pass.
    After: Sidebar.logic 92 + bulkArchive.logic 12 + environmentFilter.logic 18 (the same 122), Sidebar.drag 45, uiStateStore 13 + environmentFilterStore 14 (7 moved from uiStateStore, 7 new: legacy adoption, blank values, unreadable value), the 5 browser tests unchanged = 199 pass.
  • The moved tests are verbatim apart from import paths. The uiStateStore filter cases moved to environmentFilterStore.test.ts because the filter's state left that store.
  • vp check 0 errors, tsc --noEmit (apps/web) clean, vp run knip:check pass.
  • No test renders the whole Sidebar with the machine menu or Archive (N); the seam wiring is checked by reading, not by a test.

Behaviour kept identical, with one DOM note: unfiltered, the search empty state is Upstream's single <p> again (it was a div wrapping a p with the same classes).

Merge Danger

Door: two-way. Revert restores the old files; the saved machine choice is copied to a new localStorage key and the old key is untouched.

Blast Radius: sidebar (web) only

A user who picked a machine before this build keeps that choice (read once from t3code:ui-state:v1, copied to t3code:sidebar-environment-filter:v1). Conflicts expected with the archive-projects PR on the withoutArchivedProjects import line in Sidebar.tsx (I left that call and import where they are), and with the groups slice on Sidebar.tsx/Sidebar.logic.ts.

🤖 Generated with Claude Code

Sidebar.tsx keeps hook calls: useSidebarBulkArchive (prepare/run) and
useSidebarEnvironmentFilter/useSidebarEnvironmentFilterUi. The filter's logic,
its tests and its saved choice leave Sidebar.logic.ts, uiStateStore.ts and their
tests; the choice has its own store and key and adopts the old saved value once.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:XXL labels Nov 3, 2026
The archive filter call moves into useSidebarEnvironmentFilter (archive first,
then machine), using the archived-projects module path. CUSTOM.md keeps
integration's table with this feature's two rows.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@ziyadakl
ziyadakl merged commit 5d19fdd into spec107/integration Nov 3, 2026
27 checks passed
@ziyadakl
ziyadakl deleted the spec107/machine-filter branch November 3, 2026 08:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XXL 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