Skip to content

fix(remote): give host project groups their own sidebar section and the shared project sort - #2394

Merged
vastsa merged 3 commits into
vastsa:mainfrom
mybolide:fix/remote-project-group-section
Nov 23, 2026
Merged

vastsa merged 3 commits into
vastsa:mainfrom
mybolide:fix/remote-project-group-section

Conversation

@mybolide

@mybolide mybolide commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Issue #2370 was fixed on main by #2382 (project id on attach, group fold,
source-chip wrapping). This is the part of that report that is still missing,
split out of #2371 after #2382 landed so it can be reviewed on its own:

  1. Host groups had no section. They were rendered directly after the local
    project list with no heading, so a host project read as a retained local one
    and every host conversation repeated a per-row Remote chip. They now sit
    under their own Remote heading (data-sidebar-section="remote"), emitted
    only while at least one host group is visible, and rows inside that section
    drop the redundant chip.
  2. Group order followed session arrival. groupRemoteProjectSessions
    returned groups in host session-array order, so opening a conversation in one
    host project moved that group to the top while the local list stayed put.
    Groups now sort through the same comparator the local list uses, so their
    position follows the sidebar project sort (recent, created, oldest,
    name).

The project comparator moved out of Sidebar.tsx into
apps/desktop/src/lib/project-order.ts so both lists read one rule instead of
two copies of the same archive/pin/manual/date chain. The local list is
behaviour-preserving: its comparator was moved, not rewritten.

Verification

Check Result
node scripts/e2e-remote-project-groups-journey.mjs (real paired host) ACCEPTANCE PASS 30/30
node --test on the 3 touched desktop test files 28/28 pass
pnpm --filter @pi-desktop/desktop typecheck exit 0
pnpm --filter @pi-desktop/docs check:docs 528 pages
pnpm lint:biome 0 findings
pnpm check:pr-base head contains origin/main (950200348)

Merged origin/main (950200348) into the branch. The one conflict, in
Sidebar.tsx, was that main now wraps the project list in showProjectsSection
and renders a Recent section above it: the resolution keeps main's structure
and puts the Remote heading plus the host groups at the end of the existing
project list, so the section is still only emitted while a host has a group.
All checks above were re-run after that merge.

The journey script now also covers the ordering report, so the acceptance is
runnable rather than manual:

PASS group-order-follows-project-sort-not-session-arrival — first=["2","1"] last=["2","1"]
PASS negative-unsorted-arrival-order-would-differ — ["1","2"]

It ran against a real paired pi-desktop-host-core on Windows at this head with
PI_HOST_CORE_BINARY=target/debug/pi-desktop-host-core.exe, so the
list → attach → group retention, persisted collapse, and stable ordering path is
covered end to end. New unit-level coverage:

  • apps/desktop/test/remote-project-groups.test.mjs — the heading appears before
    the groups and only when a host has one, its box matches the shared label
    inset, the surface drops the per-row chip, every locale names the section, and
    the fold uses the shared projectCollapsed state under the remote:: key
    without touching openProjectPaths.
  • apps/desktop/test/remote-project-session.test.mjs — the same two host
    projects produce the same group order whether the host lists the opened
    session first or last, under both recent and name.

Scope

Sidebar.tsx, project-order.ts (new), remote-project-catalog.ts,
sessions.css, one dialog-free component test, one grouping test, the journey
script, nine locale lines, and two spec paragraphs. No protocol, persistence,
database, or host-core change.

#2371 is closed in favour of this pull request; its identity, fold, and chip
fixes all landed in #2382 and are not duplicated here.

Host-owned groups trailed the local project list with no heading, so a host
project read as a retained local one, and every host conversation repeated a
"Remote" chip that the section heading can carry once.

Group order also followed the host's session array, so opening a conversation
in one host project moved that group above another while the local list stayed
put. The project comparator now lives in one helper used by both lists, so a
host group sorts through the same project sort as a local one and a project's
position no longer depends on which of its sessions arrived first.

The section heading is emitted only while a host has a group, and rows inside
it drop the per-row source chip. Covered by a component test for the heading
wiring, the shared fold state and the chip suppression, a grouping test for
order stability, and ordering assertions in the paired-host journey script.
@vastsa

vastsa commented Nov 20, 2026

Copy link
Copy Markdown
Owner

This branch currently conflicts with main in apps/desktop/src/components/Sidebar.tsx (and is 81 commits behind). Please merge the latest main and resolve the conflict; we'll review once CI is green on the updated head.

…oup-section

Keeps the branch on current main so the host-group section and shared
project sort can be reviewed against the code that will actually ship.
The single conflict was in `Sidebar.tsx`, where main wrapped the projects
section in `showProjectsSection` and added the Recent-sessions area: the
resolution keeps main's structure and places the `Remote` heading plus the
host groups inside the existing projects list, with the section still
emitted only while a host has a group.
@mybolide

Copy link
Copy Markdown
Contributor Author

Merged the latest main (950200348) into this branch; the branch is no longer behind and pnpm check:pr-base passes.

The only conflict was in apps/desktop/src/components/Sidebar.tsx: main now wraps the project list in showProjectsSection and renders a Recent section above it. The resolution keeps main's structure unchanged and puts the Remote heading plus the host groups at the end of the existing project list, still emitted only while at least one host group is visible, so the local/Recent behaviour is untouched.

Re-ran everything at the updated head 7efc52a63:

Check Result
node scripts/e2e-remote-project-groups-journey.mjs (real paired pi-desktop-host-core) ACCEPTANCE PASS 30/30
node --test on the 3 touched desktop test files 28/28 pass
pnpm build:js + desktop tsc --noEmit exit 0
pnpm lint:biome 0 findings (151 files)
pnpm --filter @pi-desktop/docs check:docs 528 pages
pnpm check:pr-base passed

The PR body now reflects the new base and the merge note. Still 18 files, +537 −82 against main, with no protocol, persistence, or host-core change.

@vastsa
vastsa merged commit 1b09965 into vastsa:main Nov 23, 2026
6 checks passed
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.

2 participants