You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(sidebar): select a session row only for its own host's copy of the id - #35
A session id can exist on two hosts when a session is copied. The sidebar compared only the id to mark a row selected, so both hosts' rows showed as selected (CodeRabbit on #33, listed as open in #15).
Change
The sidebar passes the rows a selectedSessionKey of <hostId>:<id>, built from the selected session's host. Each row compares it with its own sessionRowKey(hostId, id), and the row's React key uses the same helper.
The row memo comparator re-renders a parent row when the selection changes, because nested rows render inside its memo boundary. The unread branch already does this.
Tests
SessionSidebar.presentation.test.mjs:
A ProjectRow with stable sets checks that a row is selected only for its own host's key, nested rows included.
A SessionSidebar with the same id listed on this machine and on h1 checks that only h1's row is selected.
Mutations caught: comparing the id only; hardcoding local in the sidebar's key; dropping the comparator's nested-row check.
The other SessionSidebar*.test.mjs files pass, and so does tsc --noEmit.
Not in this PR
Running, awaiting-input, unread and exited marks are still keyed by the id alone. That belongs to the id-keyed state item of #15.
Review round 1 (full)
Adversarial:
Comparator skipped nested rows on a selection change (latent, pre-existing): fixed.
Test reused fresh Sets and Maps, so the comparator was never exercised: fixed.
No sidebar-level test of the host in the key: added.
Empty-string host id: rejected. Real host ids are never empty.
Code review (medium):
The sidebar test never rendered this machine's row: fixed. Both projects are expanded, and the test asserts on the row.
Every parent row re-renders on a selection change: accepted, and noted in a comment. This matches the unread branch; a per-subtree key set can be added if trees grow large.
The key template is repeated: fixed with sessionRowKey.
Unread is keyed by id: deferred, as above.
Simplification: nothing to cut beyond the shared helper.
Summary by CodeRabbit
Bug Fixes
Session selection now correctly distinguishes sessions with the same ID on different hosts, including nested sessions. The sidebar highlights the matching host’s session.
No actionable comments were generated in the recent review.
Walkthrough
Session selection and React row identity now use a host-qualified session key. The sidebar passes this key to project rows, and row selection and memoization compare against it. Presentation tests cover matching host and session IDs, including nested rows and duplicate session IDs across hosts.
Changes: Sidebar session selection
Layer / File(s)
Summary
Build and pass host-qualified keys components/SessionSidebar-rows.tsx, components/SessionSidebar.tsx
The sidebar builds a key from the host ID and session ID. Project and session rows use this key for selection and React identity.
Update selection rendering and tests components/SessionSidebar-rows.tsx, components/SessionSidebar.presentation.test.mjs
The memo comparator detects changes to keyed selection, including changes that affect parent rows with children. Tests cover selection of top-level and nested rows, including duplicate session IDs on different hosts.
ompweb-dev/tau issue 15 describes copied session IDs across hosts and requests that still identify sessions by ID alone. This PR addresses sidebar selection and row identity, but does not change delete or archive requests.
Possibly related PRs
ompweb-dev/tau#33: Both PRs change sidebar row identity to use the host and session ID, so rows with duplicate session IDs on different hosts have distinct keys.
Suggested reviewers:kahme247
Merge Risk: Minimal · up to 1aa7a
Sidebar selection now distinguishes copies of the same session ID on different hosts. The change is small and covered by presentation tests, so merge risk is minimal.
Security architecture risk: Minimal · up to 1aa7a
The sidebar now highlights the selected host’s copy of a session without changing which session row actions target or what those actions can access.
Retained concerns
No architecture-level concerns identified.
Security review details
Security Blast Radius
observed — The changed selection result affects row styling and the accessibility current marker. Clicking a row still forwards that row’s session object, not the selection key.
Trust Boundaries and Controls
observed — The presentation key is not used for authorization or request targeting. Rename, archive, delete, and transcript requests still derive their targets from the acted-on row’s session ID and host.
Pre-merge checks: 4
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title names the main change: sidebar session selection now matches on the session's host as well as its ID, so a row is selected only for its own host's copy of a session. The raw summary and obje…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title names the main change: sidebar session selection now matches on the session's host as well as its ID, so a row is selected only for its own host's copy of a session. The raw summary and objectives confirm this is the core change (host-and-ID selection key, comparator update for nested rows, and tests for same-ID sessions on different hosts). The title uses the conventional fix(sidebar) prefix and is 73 characters long, which is within a reasonable length for a title.
Finishing Touches
Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: defaults
Review profile: CHILL
Plan: Advanced
Run ID: 74c957a5-1c81-4b64-aed5-5fd013e99430
Commits
Reviewing files that changed from the base of the PR and between 79244bf and 1aa7a27.
Files selected for processing: 3
components/SessionSidebar-rows.tsx
components/SessionSidebar.presentation.test.mjs
components/SessionSidebar.tsx
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A session id can exist on two hosts when a session is copied. The sidebar compared only the id to mark a row selected, so both hosts' rows showed as selected (CodeRabbit on #33, listed as open in #15).
Change
selectedSessionKeyof<hostId>:<id>, built from the selected session's host. Each row compares it with its ownsessionRowKey(hostId, id), and the row's React key uses the same helper.Tests
SessionSidebar.presentation.test.mjs:ProjectRowwith stable sets checks that a row is selected only for its own host's key, nested rows included.SessionSidebarwith the same id listed on this machine and onh1checks that onlyh1's row is selected.localin the sidebar's key; dropping the comparator's nested-row check.SessionSidebar*.test.mjsfiles pass, and so doestsc --noEmit.Not in this PR
Running, awaiting-input, unread and exited marks are still keyed by the id alone. That belongs to the id-keyed state item of #15.
Review round 1 (full)
sessionRowKey.Summary by CodeRabbit