Repository navigation
test: update server tests for fork naming and behavior - #363
Merged
Merged
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
…en helper Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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).browserSetupHomeForUserresolves the channel home throughresolveChannelIdentity, 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).forkCliCommand, which uses the channelexecutableName(s2code[-nightly|-preview]). The regexes still matchedshuv2code. I updated them; the patterns are just as strict..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 raisedDesktopAppUnreachableError. The fixtures now useDEFAULT_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-identitymarker. 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.TestClockto 2026-08-15. The usage code is identical to upstream at the merge base./varpoints to/private/var), so the service opens the realpath and thepath === transcriptspy check misses. The test now builds the transcript path fromrealpath(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).formatServiceStatuslabels versions ass2code@<version>and builds repair and update commands throughforkCliCommand, so they reads2code[-nightly] service installands2code-nightly update. The tests still expectedshuv2code. I updated those expectations. I also renamed the cross-channel negative check fromnot.toContain("shuv2code update")tonot.toContain("s2code update"), because after the rename the old check could never fail.apps/server/src/provider/CodexManagedRuntime.test.ts(1 test). The fixture setsT3CODE_HOMEto 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'sapplyProductEnvironmentwarns on stderr wheneverT3CODE_HOMEis set without a matchingS2CODE_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 base3c34f88too, 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.tsfromapps/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).origin/main(test(server): expect the reported package name in npm install ownership #362) as a regular merge commit;ServerEnvironment.test.tspasses 6/6 in ci-full shard 7.3b2895f469(Codex fix): https://github.com/shuv1337/s2code/actions/runs/4165425689511d495a349(after merging main): https://github.com/shuv1337/s2code/actions/runs/41648905915c028e5c233(with the service fix): https://github.com/shuv1337/s2code/actions/runs/41648752803abbe14f8c2(first commit): https://github.com/shuv1337/s2code/actions/runs/41644839590browser3/3 (shard 5),app16/16 (shard 6),UsageService42/42 (shard 7) andconfig15/15 (shard 8).service.test.ts(5),project.test.ts(2),ServerEnvironment.test.ts(1) andProviderSwitch.integration.test.ts(1).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.bundledDev.test.ts(also failed on the base run) andChatView.browser.test.tsx(a 15s timeout). This PR touches no web code.Done by Claude Opus 5.5 in T3 Code (Cursor harness).