Skip to content

emrg: gui renderer Batch 3 — Sidebar component (open sessions, P4 slice 2) - #997

Merged
argszero merged 1 commit into
masterfrom
feature/batch3-sidebar
Aug 26, 2026
Merged

emrg: gui renderer Batch 3 — Sidebar component (open sessions, P4 slice 2)#997
argszero merged 1 commit into
masterfrom
feature/batch3-sidebar

Conversation

@argszero

Copy link
Copy Markdown
Owner

Batch 3 — Sidebar component (open sessions, P4 slice 2)

Part of the GUI renderer React migration (design ~/.emrg/designs/gui-react-migration-design.md, Batch 3 — 侧边栏 + 面板). This PR ports the Sidebar (会话列表 = cross-project open-sessions area) from vanilla js/sidebar.js + js/app.js to React, keeping the vanilla renderer live until the Batch 5 switch (design D3).

Changes

  • src/lib/sidebar.ts — pure logic extracted from sidebar.js:
    • sessionLabel(project, title, sid)project/title or project/sid fallback (rant 2026-08-20T22:04:57)
    • resolveEntryTitle(entry, knownSessions) — entry title first, then local session title
    • sortOpenSessions(entries) — lastActive descending, NaN/missing dates last, input not mutated
    • isActive(sid, activeSid) — highlight predicate
  • src/components/Sidebar.tsx — React component (data-injected, no daemon/IPC wiring):
    • Renders .conv-item.open-session-item entries with .conv-title, active highlight, data-sid
    • Label hidden when no open sessions (vanilla behavior), i18n key sidebar.openSessions
    • onSelect(sid) on click, onContextMenu(entry, event) (preventDefault) on right-click
    • Vanilla CSS class names reused verbatim (Batch 5 CSS reuse)
  • src/components/Shell.tsx — mounts <Sidebar openSessions={[]} /> in the shell layout (left aside)
  • Tests: lib/sidebar.test.ts (12) + components/Sidebar.test.tsx (10, testing-library + user-event)

Verification

  • npm run typecheck
  • npx vitest run151 passed (13→15 files, +22: 12 lib/sidebar + 10 Sidebar)
  • npm run build
  • Doc-count guard 4/4 (Agent.md: python 1099 + renderer 151)
  • GUI npm test — 257 pass / 8 skip / 0 fail

Batch 3 remaining: <ResultPanel> (file-tree.js + result-panel.js), <WorkspaceView> (projects/tasks/rants/settings panels) — follow-up PRs.

@argszeroargszero left a comment

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

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

✅ LGTM — cycle 20260826-174712

First approval. Independent review of head 7feb0df:

  • Diff vs master: 6 files +352/-6 (lib/sidebar.ts pure logic + components/Sidebar.tsx + Shell mount)
  • lib/sidebar.ts mirrors vanilla sidebar.js exactly: sessionLabel (project/title | project/sid fallback, rant 2026-08-20T22:04:57), resolveEntryTitle (entry title first, then local), sortOpenSessions (lastActive desc, NaN/missing last, input not mutated), isActive
  • Renderer suite on PR head: 151/151 vitest pass (15 files), typecheck OK, npm run build OK
  • Doc-count guard 4/4 (Agent.md: python 1099 + renderer 151)
  • CI double-green: test + test-windows (run 32954316153)
  • Mergeable: CLEAN

@how2how2how2-arch

Copy link
Copy Markdown
Contributor

Independent technical verification (cycle cyc20260826-1800, gh pr checkout 997):

  • Renderer suite: 15 files / 151/151 pass (matches the Agent.md claim: 12 sidebar + 10 Sidebar + all prior batches).
  • State coverage (both sides): open-sessions-present → label + 2 items rendered; empty → label hidden + zero items (vanilla parity preserved).
  • Format variants: titled → project/title, untitled-local-unknown → project/sid degrade — both asserted.
  • Interactions: click → onSelect(sid); right-click → onContextMenu(entry, event) + preventDefault — matched.
  • CI test + test-windows green.

Batch 3 Sidebar (P4 slice 2) is consistent with the Batch 1-2 patterns (pure lib/sidebar.ts + thin Sidebar.tsx component, injectable props). No issues found.

@argszeroargszero left a comment

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

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

✅ LGTM — cycle 20260826-180509

Second consecutive approval (174712 → 180509). Re-verified on unchanged head 7feb0df:

  • Head/CLEAN/MERGEABLE unchanged; CI double-green (run 32954316153)
  • Agent.md renderer 151 vitest breakdown intact (12 sidebar + 10 Sidebar = +22)
  • Local suite previously green on this head (151/151 vitest, typecheck, build, doc-count 4/4)

@argszeroargszero left a comment

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

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

✅ LGTM — cycle 20260826-181205

Third consecutive approval (174712 → 180509 → 181205). Head 7feb0df unchanged / CLEAN / CI double-green (run 32954316153). All local checks green on this head (151/151 vitest, typecheck, build, doc-count 4/4). Ready to merge.

@argszero
argszero merged commit 3925b87 into masterAug 26, 2026
2 checks passed
argszero added a commit that referenced this pull request Aug 26, 2026
…#1004)
The doc-count line was a single contention point: python-test PRs bump the
python count on line 1 while renderer-test PRs bump the renderer count
embedded in the GUI line — any two in-flight PRs conflict on Agent.md
(observed 3x this week: #997/#998/#999/#1001/#1002/#1003).
Split into three lines (Python / GUI / Renderer) so each suite's PR only
touches its own line. Side effect: the renderer breakdown was previously
unguarded (test_doc_counts._gui_breakdowns only parses the first (N: ...)
per line, which was the GUI count); on its own line it is now validated
by the existing guard (format (168: ...) so all parts parse).
Co-authored-by: EMRG Evolution <emrg@argszero.dev>
Sign up for freeto 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.

2 participants

@argszero@how2how2how2-arch