Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

refactor: keep CityIntelPane's HUD tab bar hand-rolled but fix its tablist ARIA (#2847)

[._.]/ Adam Eivy6464693ec7ca
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index 7ceb411d38..102adb350a 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -78,3 +78,4 @@
- **[issue-2841] Convert long positional parameter lists to options objects** — `appendIntervalOccurrences` (8 args) and its sibling `appendCronOccurrences` in `server/services/workflow.js`, `scaffoldVite` (7 args) and the equally-long `scaffoldPortOS` in `server/routes/`, and `createAgentRun` (6 args) in `server/services/agentRunTracking.js` now take a single destructured options object, matching the codebase's dominant convention and removing the "which of these five interchangeable numbers goes where" hazard at each call site. All call sites updated; `scaffold.test.js` gains two regression tests pinning the named-options dispatch shape. Behavior-preserving.
- **[issue-2890] Take the held-back `undici` 8 bump** — the failing `safeUrlFetch` pin test turned out not to be about `connect.lookup` at all (undici 8's connector still honors it, so the DNS-rebinding IP pin is expressed exactly as before). undici 8 dropped v7's implicit wrapping of the legacy `onConnect`/`onHeaders`/`onComplete` request-handler shape, so a bare undici-8 `Agent` handed to the *built-in* `fetch` of any Node that still bundles undici 7 (22/24/25, including the 24.x CI matrix) throws `InvalidArgumentError: invalid onRequestStart method` — and because `fetchGuarded` swallows network errors to null, every guarded fetch would have silently returned null rather than falling back to an unpinned connect. The new exported `buildPinnedDispatcher()` wraps the pinned `Agent` in undici 8's documented `Dispatcher1Wrapper`, which both the legacy and the v8 handler contracts accept, so one build works across Node 22→26. The end-to-end pin proof now runs through that production factory instead of a hand-rolled `new Agent(...)`, so it also guards the runtime-compat half.
- **[issue-2881] Extract a shared cloud-CLI image-provider resolver** — `resolveCloudProviderConfig(settings, mode)` in the new `server/services/imageGen/cloudProviderConfig.js` owns the enable-gate + job-param bundle that seven dispatch sites (the image-gen route, the dispatcher's `generateImage`/`checkConnection`, first-pass gen, LoRA dataset gen, universe batch render, character reference sheets, pipeline visual stages) each duplicated once per cloud backend. `resolveMode` in `visualStageHelpers.js` becomes a candidate walk over an `isModeUsable` predicate instead of a ladder that grew two `if`s per backend, and the two providers' no-image error narrations now share `buildNoImageReason`. Behavior-preserving except that a queued grok render's response now reports `model: "grok-imagegen"` (it previously reported nothing) and a codex queue row records the effective model instead of an unset one — both already the value the provider renders with. The provider-module lifecycle harness (grok.js structurally copying codex.js) stays deferred until a third cloud CLI arrives, per the issue's acceptance criteria.
+- **[issue-2847] Confirm and harden the CyberCity intel tab bar** — the hand-rolled `role="tablist"` in `CityIntelPane` stays hand-rolled (its cyan/`font-pixel` HUD skin and severity-tinted count chips would need a one-off variant in the shared `ui/TabPills`, which no other call site would use) and now carries a comment saying so, so future audits skip it. The ARIA it duplicates is corrected in the process: the collapse toggle moves out of the tablist (it was an invalid non-tab child), each tab gains `id`/`aria-controls` paired to a real `role="tabpanel"`, roving `tabIndex` plus Left/Right/Home/End keyboard navigation, and `aria-expanded` on the collapse toggle; `aria-selected` now tracks the selected tab rather than dropping to false while the pane is collapsed. The three buttons are driven from the already-exported `CITY_INTEL_TABS` instead of triplicated markup.
diff --git a/client/src/components/city/CityIntelPane.jsx b/client/src/components/city/CityIntelPane.jsx
index f7077cf726..efa25463a5 100644
--- a/client/src/components/city/CityIntelPane.jsx
+++ b/client/src/components/city/CityIntelPane.jsx
@@ -353,6 +353,12 @@ export function CityIntelContent({ tab, items, eventLogs }) {
return <AttentionList items={items} />;
}
+const INTEL_TAB_HINTS = {
+ attention: 'Things needing your attention',
+ timeline: 'Recent-action timeline',
+ activity: 'Live event log',
+};
+
export default function CityIntelPane({ apps, cosAgents, reviewCounts, instances, systemHealth, notificationCounts, eventLogs }) {
// The active tab is URL-addressable via `cityPane` (shared with the compact
// layout), so a reload / back-forward restores it and a deep link opens it.
@@ -370,73 +376,97 @@ export default function CityIntelPane({ apps, cosAgents, reviewCounts, instances
const criticalCount = items.filter(i => i.severity === 'critical').length;
const selectTab = (id) => { setActivePane(id); setCollapsed(false); };
+ // Roving tabindex: only the selected tab is in the sequential tab order, and
+ // Left/Right/Home/End move selection *and* focus between tabs (WAI-ARIA
+ // automatic-activation tabs pattern).
+ const tabRefs = useRef({});
+ const onTabKeyDown = (e) => {
+ const dir = { ArrowRight: 1, ArrowLeft: -1 }[e.key];
+ let next = null;
+ if (dir) {
+ const i = CITY_INTEL_TABS.findIndex(t => t.id === tab);
+ next = CITY_INTEL_TABS[(i + dir + CITY_INTEL_TABS.length) % CITY_INTEL_TABS.length].id;
+ } else if (e.key === 'Home') next = CITY_INTEL_TABS[0].id;
+ else if (e.key === 'End') next = CITY_INTEL_TABS[CITY_INTEL_TABS.length - 1].id;
+ if (!next) return;
+ e.preventDefault();
+ selectTab(next);
+ tabRefs.current[next]?.focus();
+ };
+
+ const tabCount = (id) => {
+ if (id === 'attention') return items.length;
+ if (id === 'activity') return eventLogs?.length || 0;
+ return 0;
+ };
+
return (
<div className={`absolute top-16 right-3 ${collapsed ? '' : 'bottom-20'} w-72 pointer-events-auto`}>
<div className={`${collapsed ? '' : 'h-full'} bg-black/85 backdrop-blur-sm border border-cyan-500/30 rounded-lg overflow-hidden flex flex-col`}>
- <div className="flex items-stretch border-b border-cyan-500/20" role="tablist" aria-label="Intel">
- <button
- type="button"
- role="tab"
- aria-selected={tab === 'attention' && !collapsed}
- onClick={() => selectTab('attention')}
- className={`flex-1 flex items-center justify-center gap-1.5 px-2 py-2 transition-colors ${
- tab === 'attention' && !collapsed
- ? 'bg-cyan-500/10 text-cyan-400'
- : 'text-cyan-500/50 hover:bg-cyan-500/5'
- }`}
- title="Things needing your attention"
- >
- <span className="font-pixel text-[10px] tracking-wider font-bold">ATTENTION</span>
- {items.length > 0 && (
- <span className={`font-pixel text-[9px] px-1 rounded ${
- criticalCount > 0 ? 'bg-port-error/30 text-port-error' : 'bg-cyan-500/20 text-cyan-300'
- }`}>
- {items.length}
- </span>
- )}
- </button>
- <button
- type="button"
- role="tab"
- aria-selected={tab === 'timeline' && !collapsed}
- onClick={() => selectTab('timeline')}
- className={`flex-1 flex items-center justify-center gap-1.5 px-2 py-2 border-l border-cyan-500/20 transition-colors ${
- tab === 'timeline' && !collapsed
- ? 'bg-cyan-500/10 text-cyan-400'
- : 'text-cyan-500/50 hover:bg-cyan-500/5'
- }`}
- title="Recent-action timeline"
- >
- <span className="font-pixel text-[10px] tracking-wider font-bold">TIMELINE</span>
- </button>
- <button
- type="button"
- role="tab"
- aria-selected={tab === 'activity' && !collapsed}
- onClick={() => selectTab('activity')}
- className={`flex-1 flex items-center justify-center gap-1.5 px-2 py-2 border-l border-cyan-500/20 transition-colors ${
- tab === 'activity' && !collapsed
- ? 'bg-cyan-500/10 text-cyan-400'
- : 'text-cyan-500/50 hover:bg-cyan-500/5'
- }`}
- title="Live event log"
- >
- <span className="font-pixel text-[10px] tracking-wider font-bold">ACTIVITY</span>
- {eventLogs?.length > 0 && (
- <span className="font-pixel text-[9px] text-cyan-500/40">{eventLogs.length}</span>
- )}
- </button>
+ <div className="flex items-stretch border-b border-cyan-500/20">
+ {/* Deliberately NOT `ui/TabPills`: this bar wears the immersive CyberCity
+ HUD skin (cyan-on-black, `font-pixel` micro-caps, per-tab severity-tinted
+ count chips) that the shared component hardcodes as port-accent, and it
+ can only be expressed there by adding a one-off variant that no other
+ call site would use. The ARIA/roving-tabindex wiring below mirrors
+ TabPills' contract, so audits can skip this divergence. */}
+ <div className="flex-1 flex items-stretch min-w-0" role="tablist" aria-label="Intel">
+ {CITY_INTEL_TABS.map((t, i) => {
+ const active = t.id === tab;
+ const count = tabCount(t.id);
+ return (
+ <button
+ key={t.id}
+ ref={(el) => { tabRefs.current[t.id] = el; }}
+ type="button"
+ role="tab"
+ id={`city-intel-tab-${t.id}`}
+ aria-selected={active}
+ aria-controls={collapsed ? undefined : `city-intel-panel-${t.id}`}
+ tabIndex={active ? 0 : -1}
+ onKeyDown={onTabKeyDown}
+ onClick={() => selectTab(t.id)}
+ className={`flex-1 min-w-0 flex items-center justify-center gap-1.5 px-2 py-2 transition-colors ${
+ i > 0 ? 'border-l border-cyan-500/20' : ''
+ } ${active ? 'bg-cyan-500/10 text-cyan-400' : 'text-cyan-500/50 hover:bg-cyan-500/5'}`}
+ title={INTEL_TAB_HINTS[t.id]}
+ >
+ <span className="font-pixel text-[10px] tracking-wider font-bold">{t.label}</span>
+ {count > 0 && (t.id === 'attention' ? (
+ <span className={`font-pixel text-[9px] px-1 rounded ${
+ criticalCount > 0 ? 'bg-port-error/30 text-port-error' : 'bg-cyan-500/20 text-cyan-300'
+ }`}>
+ {count}
+ </span>
+ ) : (
+ <span className="font-pixel text-[9px] text-cyan-500/40">{count}</span>
+ ))}
+ </button>
+ );
+ })}
+ </div>
<button
type="button"
onClick={() => setCollapsed(c => !c)}
className="px-2 py-2 border-l border-cyan-500/20 text-cyan-500/50 hover:bg-cyan-500/5 hover:text-cyan-400 transition-colors"
title={collapsed ? 'Expand' : 'Collapse'}
+ aria-expanded={!collapsed}
+ aria-controls={collapsed ? undefined : `city-intel-panel-${tab}`}
aria-label={collapsed ? 'Expand intel pane' : 'Collapse intel pane'}
>
<span className="font-pixel text-[11px]">{collapsed ? '[+]' : '[-]'}</span>
</button>
</div>
- {!collapsed && <CityIntelContent tab={tab} items={items} eventLogs={eventLogs} />}
+ {!collapsed && (
+ <div
+ role="tabpanel"
+ id={`city-intel-panel-${tab}`}
+ aria-labelledby={`city-intel-tab-${tab}`}
+ className="flex-1 min-h-0 flex flex-col"
+ >
+ <CityIntelContent tab={tab} items={items} eventLogs={eventLogs} />
+ </div>
+ )}
</div>
</div>
);
diff --git a/client/src/components/city/CityIntelPane.test.jsx b/client/src/components/city/CityIntelPane.test.jsx
new file mode 100644
index 0000000000..edbe558028
--- /dev/null
+++ b/client/src/components/city/CityIntelPane.test.jsx
@@ -0,0 +1,76 @@
+import { describe, it, expect } from 'vitest';
+import { render, screen, fireEvent } from '@testing-library/react';
+import { MemoryRouter } from 'react-router-dom';
+import CityIntelPane from './CityIntelPane';
+
+function renderPane(props = {}) {
+ return render(
+ <MemoryRouter>
+ <CityIntelPane apps={[]} cosAgents={[]} instances={[]} eventLogs={[]} {...props} />
+ </MemoryRouter>
+ );
+}
+
+describe('CityIntelPane tab bar', () => {
+ it('exposes exactly the three intel tabs in a labelled tablist', () => {
+ renderPane();
+ const list = screen.getByRole('tablist', { name: 'Intel' });
+ const tabs = screen.getAllByRole('tab');
+ expect(tabs.map(t => t.textContent)).toEqual(['ATTENTION', 'TIMELINE', 'ACTIVITY']);
+ // The collapse toggle is a sibling of the tablist, not a child of it —
+ // a non-tab child would be an invalid `role="tablist"` owner.
+ expect(list).not.toContainElement(screen.getByRole('button', { name: /collapse intel pane/i }));
+ });
+
+ it('wires aria-selected, roving tabindex, and aria-controls to a matching tabpanel', () => {
+ renderPane();
+ const [attention, timeline] = screen.getAllByRole('tab');
+ expect(attention).toHaveAttribute('aria-selected', 'true');
+ expect(attention).toHaveAttribute('tabindex', '0');
+ expect(timeline).toHaveAttribute('aria-selected', 'false');
+ expect(timeline).toHaveAttribute('tabindex', '-1');
+
+ const panel = screen.getByRole('tabpanel');
+ expect(attention.getAttribute('aria-controls')).toBe(panel.id);
+ expect(panel.getAttribute('aria-labelledby')).toBe(attention.id);
+ });
+
+ it('moves selection with arrow keys and wraps, and jumps with Home/End', () => {
+ renderPane();
+ const tabs = () => screen.getAllByRole('tab');
+ fireEvent.keyDown(tabs()[0], { key: 'ArrowRight' });
+ expect(tabs()[1]).toHaveAttribute('aria-selected', 'true');
+ fireEvent.keyDown(tabs()[1], { key: 'End' });
+ expect(tabs()[2]).toHaveAttribute('aria-selected', 'true');
+ fireEvent.keyDown(tabs()[2], { key: 'ArrowRight' });
+ expect(tabs()[0]).toHaveAttribute('aria-selected', 'true');
+ fireEvent.keyDown(tabs()[0], { key: 'ArrowLeft' });
+ expect(tabs()[2]).toHaveAttribute('aria-selected', 'true');
+ fireEvent.keyDown(tabs()[2], { key: 'Home' });
+ expect(tabs()[0]).toHaveAttribute('aria-selected', 'true');
+ });
+
+ it('collapses the panel and drops the stale aria-controls reference', () => {
+ renderPane();
+ const toggle = screen.getByRole('button', { name: /collapse intel pane/i });
+ expect(toggle).toHaveAttribute('aria-expanded', 'true');
+ fireEvent.click(toggle);
+
+ expect(screen.queryByRole('tabpanel')).toBeNull();
+ const expand = screen.getByRole('button', { name: /expand intel pane/i });
+ expect(expand).toHaveAttribute('aria-expanded', 'false');
+ expect(expand).not.toHaveAttribute('aria-controls');
+ // Selection survives the collapse; the tab just has no rendered panel to own.
+ const [attention] = screen.getAllByRole('tab');
+ expect(attention).toHaveAttribute('aria-selected', 'true');
+ expect(attention).not.toHaveAttribute('aria-controls');
+ });
+
+ it('re-expands when a tab is clicked while collapsed', () => {
+ renderPane();
+ fireEvent.click(screen.getByRole('button', { name: /collapse intel pane/i }));
+ fireEvent.click(screen.getAllByRole('tab')[1]);
+ expect(screen.getByRole('tabpanel')).toBeTruthy();
+ expect(screen.getAllByRole('tab')[1]).toHaveAttribute('aria-selected', 'true');
+ });
+});