Repository navigation
feat(workspace): theme switch — light / dark / system at the top right of the central column (abilityai/trinity-enterprise#625) - #2841
Conversation
/review ReportBranch:
Critical FindingsNone. Informational Findings[I1] Scope: NavBar copy changed "Auto" → "System" (Confidence: 9/10) [I2] Room header at narrow widths not screenshotted (Confidence: 6/10) [I3] Test harness now applies [I4] [I5] Pre-existing doc drift (Confidence: 8/10) Clean Categories
Coverage question (#2829)Executed. The spec mounts the real components ( Learnings captured
Summary
Next: |
…s, opt-in per file `vitest.config.js` stays `environment: 'node'` for the pure-rules suite and gains `@vitejs/plugin-vue`, so a spec that must MOUNT an SFC opts into jsdom with a leading `// @vitest-environment jsdom`. First consumer: the Workspace theme switch (trinity-enterprise#625), whose AC asks for a click that reaches `setTheme` — a regex over the SFC cannot prove a click (#2829). Dev-only deps; the lock was regenerated lock-only with the image's npm (node:26) so the diff is the two packages and their tree (57 entries, none with install scripts, `npm audit` unchanged at dev's one pre-existing low). npm 11 also drops a stale root `dependencies` line for `@rollup/rollup-linux-arm64-musl`, which package.json declares under `optionalDependencies` (it stays there). Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01VpvcfgWkmQPD7DrDLmATTf
…t of the central column (trinity-enterprise#625)
The Workspace followed the global theme with no way to change it — its only
control was the NavBar's appearance menu, and the Workspace has no NavBar. A
platform user could not switch from the Workspace; an external client with no
stored preference could not switch at all.
- `components/portal/PortalThemeSwitch.vue`: trigger showing the RESOLVED
theme (icon + "System · dark" / "Light" / "Dark"; icon-only below `sm`) over
a popover; Esc + click-outside close, focus returns to the trigger. Reads
and writes `useThemeStore` only — no auth/agents/clientPortal import — so a
client session gets it. One store, one key: a choice here is what the
platform UI shows next, and vice versa.
- `components/base/ThemeChoice.vue` (+ `ThemeIcon.vue`): the ONE
light/dark/system picker — `radiogroup` of `role="radio"` buttons with
`aria-checked`, roving tabindex, arrow keys. The NavBar's inline raw-palette
picker is replaced by it (its raw-colour entry shrinks 35 → 23 non-gray,
re-frozen exactly and named in the baseline); the new files stay at zero.
- `#header-end` slot at the tail of both column headers
(`PortalConversation.vue`, `PortalRoom.vue`), filled by `views/Portal.vue`
— new chat, thread, agent landing and room; the skeleton heads the branch
chain and gets none. Only the root `dark` class flips and the slot carries
no `:key`, so scroll, draft and thread survive a switch.
- `utils/themeSwitch.js`: the decidable half, executed.
- `tests/unit/portalThemeSwitch.spec.js`: the suite's first MOUNTED component
test — renders "System · dark" from an empty store, three checked/unchecked
radios, a click calls `setTheme('dark')`, writes `trinity-theme`, flips the
root class, closes and re-labels; a NavBar choice is reflected. Mutations
(click never reaches the store / label hides the resolved state / Esc
ignored / aria-checked frozen) → red.
Verified live in Chromium on a dev server: light, dark, `system` resolving
honestly, icon-only at 390px with no collision, Enter opens, Tab lands on
the checked radio, ArrowLeft selects.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01VpvcfgWkmQPD7DrDLmATTf
…s: regenerate the lock with the image's npm (trinity-enterprise#625) Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01VpvcfgWkmQPD7DrDLmATTf
1d74ad2 to
f0d34a0
Compare
…th entries kept (dev's first) Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…ityai/trinity-enterprise#625) merge-train finding. The popover closed on Escape from a bubble-phase `document` listener and never marked the event. The conversation's own `document` listener cancels an in-flight turn, or ends a live voice call, on any Escape nobody claimed, so closing the menu mid-turn also killed the turn. That is the #2582/#2598 class in learnings.md. The popover now follows the same protocol as PortalFilePreview and PortalRailFiles. It listens in the capture phase, returns early on `defaultPrevented`, and calls `preventDefault()` only while the menu is open. With the menu closed it claims nothing, so Escape still cancels. Tests: - A mounted test runs the conversation's real `shouldCancelOnEscape` and `shouldEndCallOnEscape` against the same keystroke, with the menu open (both false) and closed (both true). - A second test checks that an earlier owner's claim leaves the menu open. - The "choose dark" test now clears the `dark` class first. `system` already resolved dark in beforeEach, so the assertion used to hold before the click. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
merge-train 2026-09-16: two commits pushed to this branch. Both are mechanical, and this PR stays on the train.
Docker was down locally, so the new spec is proven by this branch's Still open for after merge: |
vybe
left a comment
There was a problem hiding this comment.
merge-train 2026-09-16: validated at lane B (/validate-pr, /review). The one critical finding, Escape on the theme menu also cancelling a running turn or ending a call, is fixed in c028465 with mounted tests that run the conversation's real cancel rules. frontend-build passed 3090 tests, including this spec's 19. e2e is green. The raw-color ratchet passes after the dev merge. The pytest matrix stalled on base and head alike, and this diff has no Python, so it merges on the required checks.
Fixes abilityai/trinity-enterprise#625
Summary
The Workspace is styled for both themes and follows the global
useThemeStore, but its only control was the NavBar's appearance menu and the Workspace has no NavBar — a platform user could not change the theme from the Workspace, and an external client (no platform session, no stored preference) could not change it at all. This adds the switch, at the top right of the central column, driving the same store and key the platform UI uses.PortalThemeSwitch.vue— trigger whose icon and label show the resolved theme ("System · dark", "Light", "Dark"; icon-only belowsm) over a popover; Esc + click-outside close, focus returns to the trigger. ImportsuseThemeStoreonly — never auth / agents / clientPortal — so a client session gets it (pinned).base/ThemeChoice.vue(+ThemeIcon.vue) — the ONE light/dark/system picker:radiogroupofrole="radio"buttons witharia-checked, roving tabindex, arrow keys. The NavBar's inline raw-palette picker is replaced by it, so the two cannot drift; NavBar's raw-colour entry shrinks 35 → 23 non-gray (re-frozen exactly, scoped to that entry and named in the baseline — the bug(subscriptions): a Workspace message on a rate-limited subscription fails instead of switching and completing — close the SUB-003 gaps on the turn path #2638 shape). The new files carry zero non-gray palette classes.#header-endslot at the tail of both column headers (PortalConversation.vue,PortalRoom.vue), filled byviews/Portal.vue: new chat, thread, agent landing (one branch since ent#523) and room; the stage skeleton heads the branch chain and gets none. Terminal stage states (unavailable / error / unreachable) have no header and are left alone.darkclass flips; the slot carries no:key, so scroll, composer draft and the active thread survive a switch. The popover is absolutely anchored to the header's right edge, so it widens nothing.utils/themeSwitch.js— the decidable half (options, resolved theme, label, icon, aria label).Test harness (own commit)
AC #8 asks for a test in which a click reaches
setTheme. The suite isenvironment: 'node'with no mount harness, and a regex over the SFC cannot prove a click (#2829's rule) — sovitest.config.jsgains@vitejs/plugin-vueand a spec may opt into jsdom per file (// @vitest-environment jsdom); the default staysnode. Dev-only depsjsdom+@vue/test-utils; lock regenerated lock-only with the image's npm (node:26) so the diff is those two and their tree (57 entries, none with install scripts;npm auditunchanged at dev's one pre-existing low). npm 11 also drops a stale rootdependenciesline for@rollup/rollup-linux-arm64-musl(package.json declares it underoptionalDependencies, where it stays).@vue/test-utils2.5 pullsjs-beautify→nopt, whoseenginesname node 22+ — a warning undernpm cion CI's node 20 (verified: the same path my local node 20 run took), not a failure.tests/unit/portalThemeSwitch.spec.jsis the suite's first mounted component test: renders "System · dark" from an empty store, opens to three checked/unchecked radios, a click callssetTheme('dark'), writestrinity-theme, flips the root class, closes and re-labels the trigger; a NavBar choice is reflected here; Esc and click-outside close; arrow keys and roving tabindex onThemeChoice; plus source guards for the slot placement, the two fills, the no-session-dependency rule and the NavBar consuming the primitive.Mutation: click never reaches the store → 1 red · label hides the resolved state → 2 red · Esc ignored → 1 red ·
aria-checkedfrozen → 2 red.Verified in a browser (Chromium, worktree dev server against the local backend)
Light and dark, both with the popover open;
systemresolving honestly; 390px viewport → icon-only 32px trigger, no collision with the title band; Enter opens, Tab lands on the checked radio, ArrowLeft selects; focus returns to the trigger after a choice.Acceptance criteria
Portal.vuetwo#header-endfills; slot in both headersuseThemeStore, no second store/keyPortalThemeSwitch.vue→themeStore.setTheme; speca choice made elsewhere … is reflected heresystemdefault, resolved state shown honestlythemeSwitch.js::themeSwitchLabel→ "System · dark"; spec:keyaria-label="Theme: …",radiogroup/radio/aria-checked, roving tabindex, EscsetTheme, current reflectedportalThemeSwitch.spec.js(mounted)Test plan
cd src/frontend && npm run test:unit→ 137 files / 3083 passednpm run check:tokensOK; raw-colour ratchet 14/14;vite buildgreenDocs:
requirements/core-agent.md§5.33 (WORKSPACE_THEME_SWITCH),feature-flows/dark-mode-theme.md(Workspace switch section + entry point),feature-flows.mdindex row,architecture/workspace.md(compact-header section).Cross-tracker:
Fixescross-references the private issue but does not auto-close it — closed manually at release.🤖 Generated with Claude Code
https://claude.ai/code/session_01VpvcfgWkmQPD7DrDLmATTf