Skip to content

test: update server tests for fork naming and behavior - #363

Merged
shuv1337 merged 4 commits into
mainfrom
test/server-fork-naming
Nov 3, 2026
Merged

shuv1337 merged 4 commits into
mainfrom
test/server-fork-naming

Conversation

@shuv1337

@shuv1337 shuv1337 commented Nov 3, 2026 •

Copy link
Copy Markdown
Owner

Twelve server tests in ci-full run 41637996220 failed after the fork rename and an upstream test time bomb. In every case the product behaves as intended and the test was stale, so no product code changes.

Root causes and fixes (all test-side)

  • apps/server/src/cli/browser.test.ts (3 tests). browserSetupHomeForUser resolves the channel home through resolveChannelIdentity, which now returns .s2code-v2[-nightly|-preview] (DEFAULT_HOME_DIRECTORY). The test still expected .shuv2code-v2*, so I updated the expected path.

  • apps/server/src/cli/app.test.ts (7 tests).

    • The SSH and unsupported-platform errors format their command through forkCliCommand, which uses the channel executableName (s2code[-nightly|-preview]). The regexes still matched shuv2code. I updated them; the patterns are just as strict.
    • The five channel activation and fallback tests started fake desktops under .shuv2code-v2*. The CLI now resolves the default home to .s2code-v2*; a legacy home is chosen only when it holds state, and these legacy homes held only a marker. So the CLI looked under the new home, found no socket, and raised DesktopAppUnreachableError. The fixtures now use DEFAULT_HOME_DIRECTORY, as the other tests in this file already do.
  • apps/server/src/cli/config.test.ts (1 test). The fork's home-ownership guard (ensureProductHome) refuses a non-empty home that has no .product-identity marker. It runs before the running-server preflight, so the test hit "Cannot establish product ownership" before it reached "A T3 Code server is already running". The product wording has not changed. The sibling test in the same file already writes the marker; this one now does too.

  • apps/server/src/usage/UsageService.test.ts.

    • "reports saved usage of a removed directory only for windows it reaches": this is a time bomb, unrelated to the rename. Saved usage is kept for 92 days of wall-clock time, and the fixture's transcript is dated 2026-08-01, so it aged out around 2026-11-01. I ported the upstream fix pingdotgg/t3code#28603, which pins TestClock to 2026-08-15. The usage code is identical to upstream at the merge base.
    • "retains Codex reconciliation and partial coverage…": this test is in the base-failing list and fails on macOS. The macOS temp dir is a symlink (/var points to /private/var), so the service opens the realpath and the path === transcript spy check misses. The test now builds the transcript path from realpath(home), the same approach this file already uses for the Pi source test. The assertion is unchanged.
  • apps/server/src/cli/service.test.ts (5 tests). formatServiceStatus labels versions as s2code@<version> and builds repair and update commands through forkCliCommand, so they read s2code[-nightly] service install and s2code-nightly update. The tests still expected shuv2code. I updated those expectations. I also renamed the cross-channel negative check from not.toContain("shuv2code update") to not.toContain("s2code update"), because after the rename the old check could never fail.

  • apps/server/src/provider/CodexManagedRuntime.test.ts (1 test). The fixture sets T3CODE_HOME to a wrong server home on purpose (upstream f5cf9a0, which also asserts that path is never created), to prove the token helper ignores it. CI does not supply that variable; the test does. The fork's applyProductEnvironment warns on stderr whenever T3CODE_HOME is set without a matching S2CODE_HOME, which is intended fork behavior. The fork server itself always exports both with the same value, so real helpers don't warn. Stripping it like test(server): strip fork home aliases from the test environment #350 would drop upstream's check, so both helper runs now assert that exact warning line as stderr.

  • apps/server/src/cli/project.test.ts (2 busy-live-server tests): not in this PR. Both time out at 120s at base 3c34f88 too, locally and with no source differences from this branch, so they are pre-existing.

No assertions were loosened and no tests were skipped. UsageLimitFailover, ProviderSwitch and web tests are untouched.

Verification

  • vp test run src/cli/browser.test.ts src/cli/app.test.ts src/usage/UsageService.test.ts src/cli/config.test.ts from apps/server: 4 files and 76 tests pass. Before the change, 13 failed.
  • vp run --filter t3 --filter @t3tools/contracts --filter @t3tools/shared --filter @t3tools/web typecheck: 4/4 successful.
  • vp run check:changed: format, lint, knip, graphql, typecheck and tests all pass.
  • vp test run src/cli/service.test.ts: 16/16 pass (5 failed before this change). All five files together: 92/92 pass.
  • vp test run src/provider/CodexManagedRuntime.test.ts: 4/4 pass (1 failed before this change).
  • Merged origin/main (test(server): expect the reported package name in npm install ownership #362) as a regular merge commit; ServerEnvironment.test.ts passes 6/6 in ci-full shard 7.
  • ci-full on 3b2895f469 (Codex fix): https://github.com/shuv1337/s2code/actions/runs/41654256895
  • ci-full on 11d495a349 (after merging main): https://github.com/shuv1337/s2code/actions/runs/41648905915
  • ci-full on c028e5c233 (with the service fix): https://github.com/shuv1337/s2code/actions/runs/41648752803
  • ci-full on abbe14f8c2 (first commit): https://github.com/shuv1337/s2code/actions/runs/41644839590
    • All four files pass in CI: browser 3/3 (shard 5), app 16/16 (shard 6), UsageService 42/42 (shard 7) and config 15/15 (shard 8).
    • The remaining server failures are all in the pre-existing base-failing list, and none are new: service.test.ts (5), project.test.ts (2), ServerEnvironment.test.ts (1) and ProviderSwitch.integration.test.ts (1).
    • Shard 1 was cancelled after UsageLimitFailover.integration.test.ts, which is also in the base list, hung for about 18 minutes. Files queued after it in that shard did not run.
    • Test Web failed in bundledDev.test.ts (also failed on the base run) and ChatView.browser.test.tsx (a 15s timeout). This PR touches no web code.

Done by Claude Opus 5.5 in T3 Code (Cursor harness).

Co-authored-by: Cursor <cursoragent@cursor.com>
@shuv1337
shuv1337 merged commit 95a779d into main Nov 3, 2026
15 of 23 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.

1 participant