Skip to content

fix(web): sidebar shortcut browser tests no longer reach the live server - #217

Merged
christinoleo merged 1 commit into
mainfrom
factory/T3-26-mx4muu84
Dec 1, 2026
Merged

christinoleo merged 1 commit into
mainfrom
factory/T3-26-mx4muu84

Conversation

@christinoleo

Copy link
Copy Markdown
Owner

T3-26. Two Sidebar shortcut browser tests fail on the fork's main, and so does "keeps the search query…" in Sidebar.search.browser.test.tsx. All three stop where Ctrl+Shift+] should move from thread-a to thread-b.

Cause

The sidebar code was never the problem. Agents run inside the live T3 service and inherit T3CODE_PORT=3773. In apps/web/vite.config.ts, the Vite dev proxy targets that port, and the browser-test server is built from the same config. So the test app's /api and /.well-known requests went to the live server, not to the in-process fake environment. The sidebar's thread rows then carried the live server's environment id (406d8596…), while the route used the fake id environment-render. Thread navigation looks up the current row by environmentId:threadId, never found it, and did nothing.

Proof, on unchanged fork main:

  • With T3CODE_PORT set, both shortcut tests fail. Temporary logging showed the row keys were 406d8596…:thread-a and the route key was environment-render:thread-a.
  • With env -u T3CODE_PORT, both tests pass.

That also explains why upstream "passes": it ran without that variable.

Fix

Upstream already fixed this in pingdotgg#46738 (facc02ea36), which the fork hasn't merged yet. This PR cherry-picks it: Vite skips the dev proxy when mode === "test". It doesn't touch the tests or the app's runtime behaviour. When the fork next merges upstream, that commit is already applied.

Proof

  • vp test run src/components/Sidebar.shortcuts.browser.test.tsx src/components/Sidebar.search.browser.test.tsx with T3CODE_PORT=3773 still set: 2 files, 3 tests pass ("leaves thread shortcuts…", "waits on thread navigation shortcuts while a confirmation dialog is open", "keeps the search query…").
  • Real web client: vp run dev with this worktree's own .t3 state and three Replay threads. With Gamma selected, Ctrl+Shift+] went to Beta, then Alpha. Ctrl+Shift+[ went back to Beta.

Tests

None added. The three existing tests are the regression tests, and they now pass.

Decisions

  • Cherry-pick upstream's fix instead of writing a fork-side one. It is the same root cause and the same one-line guard, and it merges cleanly later. The other option was a fork-local change to the Vite config. That would conflict on the next upstream merge for no gain.
  • No change to Sidebar.tsx. The task brief suspected fork sidebar changes. The diagnosis above rules them out: with the proxy disabled, the fork's sidebar passes unchanged.

Checks passed on 4dd85a3 (vp run check:changed origin/main: format, lint, knip, typecheck).

Built by Claude Opus 5.5 in Claude Code (T3 Code factory worker).

🤖 Generated with Claude Code

@christinoleo
christinoleo merged commit 529f642 into main Dec 1, 2026
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