Skip to content

The agent that grows with you

test(desktop): every rail layout keeps a door to the active default; rail changes run the core E2E

Brooklyn Nicholson158fd638da16
diff --git a/apps/desktop/src/app/chat/sidebar/profile-rail-fleet.test.tsx b/apps/desktop/src/app/chat/sidebar/profile-rail-fleet.test.tsx
index 549b22561cf..4cc5a45b19f 100644
--- a/apps/desktop/src/app/chat/sidebar/profile-rail-fleet.test.tsx
+++ b/apps/desktop/src/app/chat/sidebar/profile-rail-fleet.test.tsx
@@ -148,7 +148,8 @@ const connectionsRegistry = connectionsStore.$connectionsRegistry as ReturnType<
typeof atom<DesktopConnectionsRegistry | null>
>
-const { $profileOrder, $profiles, $profileScope } = await import('@/store/profile')
+const { $activeGatewayProfile, $profileOrder, $profiles, $profileScope } = await import('@/store/profile')
+const activeGatewayProfile = $activeGatewayProfile as ReturnType<typeof atom<string>>
const profiles = $profiles as ReturnType<typeof atom<Array<{ is_default: boolean; name: string }>>>
const profileScope = $profileScope as ReturnType<typeof atom<string>>
const { _resetFleetRosterForTests } = await import('@/store/fleet-roster')
@@ -244,6 +245,7 @@ afterEach(() => {
hasMultipleConnections.set(false)
connectionsRegistry.set(null)
activeConnectionId.set(null)
+ activeGatewayProfile.set('default')
profileScope.set('default')
profiles.set([{ is_default: true, name: 'default' }])
delete (window as { hermesDesktop?: unknown }).hermesDesktop
@@ -693,3 +695,60 @@ describe('ProfileRail fleet mode', () => {
}
)
})
+
+// Every rail layout must keep a pointer door back to the ACTIVE gateway's
+// default. Each layout renders that door through its own code path (single-
+// gateway pill, fleet home square, condensed menu); the condensed fleet menu
+// dropped it (#106017, #131632). A new layout that drops it fails here.
+describe('ProfileRail: the active default is always one click away', () => {
+ const ARYA = { display_name: 'Arya', is_default: true, name: 'default' } as { is_default: boolean; name: string }
+
+ const named = (count: number) =>
+ Array.from({ length: count }, (_, index) => ({ is_default: false, name: `p${index + 1}` }))
+
+ // Profile counts sit either side of the condensed threshold (13), counting
+ // the fleet's at-rest squares: 3 on the other gateways in armFleet's roster.
+ const layouts = [
+ { fleet: false, condensed: false, active: null, count: 2 },
+ { fleet: false, condensed: true, active: null, count: 13 },
+ { fleet: true, condensed: false, active: 'local', count: 2 },
+ { fleet: true, condensed: true, active: 'local', count: 11 },
+ { fleet: true, condensed: false, active: 'gateway-a', count: 2 },
+ { fleet: true, condensed: true, active: 'gateway-a', count: 11 }
+ ] as const
+
+ const cases = layouts.flatMap(layout => (['named', 'all'] as const).map(from => ({ ...layout, from })))
+
+ it.each(cases)(
+ 'fleet=$fleet condensed=$condensed active=$active, from $from',
+ async ({ active, condensed, count, fleet, from }) => {
+ if (fleet) {
+ armFleet()
+ activeConnectionId.set(active)
+ }
+
+ profiles.set([ARYA, ...named(count)])
+ activeGatewayProfile.set('p1')
+ profileScope.set(from === 'all' ? '*' : 'p1')
+ await renderFleet()
+
+ expect(Boolean(screen.queryByRole('button', { name: 'Profiles' })), 'layout under test').toBe(condensed)
+
+ // A visible control named for the default (home pill / home square)…
+ const pill = screen
+ .queryAllByRole('button')
+ .find(button => /\bArya\b/.test(button.getAttribute('aria-label') ?? ''))
+
+ if (pill) {
+ fireEvent.click(pill)
+ } else {
+ // …or its row in the condensed menu.
+ fireEvent.pointerDown(screen.getByRole('button', { name: 'Profiles' }), { button: 0, ctrlKey: false })
+ fireEvent.click(await screen.findByRole('menuitemradio', { name: 'Arya' }))
+ }
+
+ expect(selectProfile).toHaveBeenCalledWith('default')
+ expect(selectConnection).not.toHaveBeenCalled()
+ }
+ )
+})
diff --git a/scripts/ci/classify_changes.py b/scripts/ci/classify_changes.py
index 3c0d9d019f8..941774de0d7 100644
--- a/scripts/ci/classify_changes.py
+++ b/scripts/ci/classify_changes.py
@@ -209,6 +209,9 @@ _E2E_LANES: dict[str, tuple[str, ...]] = {
"apps/shared/src/",
"apps/desktop/src/store/session",
"apps/desktop/src/store/transcript",
+ # fleet-condensed-default.spec.ts: the profile rail's doors per gateway.
+ "apps/desktop/src/app/chat/sidebar/profile-switcher",
+ "apps/desktop/src/app/chat/sidebar/fleet-",
),
"e2e_desktop_update": (
*_DESKTOP_E2E_SHARED,
diff --git a/tests/ci/test_classify_changes.py b/tests/ci/test_classify_changes.py
index 42ef4722214..ee48c3bf9cf 100644
--- a/tests/ci/test_classify_changes.py
+++ b/tests/ci/test_classify_changes.py
@@ -340,6 +340,10 @@ CASES = {
["apps/desktop/e2e/core/transcript-integrity.spec.ts"],
_lanes(frontend=True, e2e_desktop_core=True),
),
+ "desktop profile rail → desktop core": (
+ ["apps/desktop/src/app/chat/sidebar/profile-switcher.tsx"],
+ _lanes(frontend=True, e2e_desktop_core=True),
+ ),
"desktop update spec → desktop update, not core": (
["apps/desktop/e2e/update/app-update.spec.ts"],
_lanes(frontend=True, e2e_desktop_update=True),