Skip to content

Commit 213e2bd

Browse files
committed
test(fork): complete fork-owned test sibling migration
## What Changed - Moved fork-only test blocks from 50 upstream-owned test files into `*.fork.test.*` siblings across desktop, mobile, server, web, client runtime, contracts, shared, and release scripts. - Restored upstream test content where compatible and retained only production-contract adaptations in shared files. - Kept exactly two documented file-local harness deferrals: `apps/desktop/src/window/DesktopWindow.test.ts` and `apps/server/src/server.test.ts`. - Hardened `fork:scan` so only a removed test opener in the same zero-context hunk can offset an added opener. An unrelated deletion elsewhere can no longer hide a fork append. - Removed 1,894 lines of copied harness debris and extracted the terminal Manager fixture into a focused fork-owned helper. ## Why This completes the forward-tree shape for RSI-Software#448. RSI-Software#498 still owns the leased replay that removes the 87 historical `upstream-test` warnings before closure. ## Verification - `vp test run <103 affected test files>`: 103 files, 1,524 tests passed. - Typechecks passed for `@t3tools/desktop`, `@t3tools/mobile`, `t3`, `@t3tools/web`, `@t3tools/client-runtime`, `@t3tools/contracts`, and `@t3tools/shared`. - Targeted lint and formatting passed across all 105 changed files. - `vp run fork:delta --check`: 253 fork commits tagged. - `vp run fork:scan --since hyprws`: zero new `upstream-test` warnings. The two bulk-migration footprint advisories are expected; four rebase-scan gaps predate this branch. ## Checklist - [x] This PR is focused on the remaining test-isolation seam - [x] I explained what changed and why Refs RSI-Software#448 Squashes: - 703d7da test(fork): complete fork-owned test sibling migration (RSI-Software#1533) (RSI-Software#1513) - 6082b83 fixup! test(fork): complete fork-owned test sibling migration Fork-Domain: fork-meta Fork-Tier: qol
1 parent 5f5a3c1 commit 213e2bd

24 files changed

Lines changed: 2208 additions & 203 deletions
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
import * as NodeServices from "@effect/platform-node/NodeServices";
2+
import { assert, describe, it } from "@effect/vitest";
3+
import * as Effect from "effect/Effect";
4+
import * as Layer from "effect/Layer";
5+
import * as Option from "effect/Option";
6+
import * as DesktopEnvironment from "./DesktopEnvironment.ts";
7+
import * as DesktopConfig from "./DesktopConfig.ts";
8+
const defaultInput = {
9+
dirname: "/repo/apps/desktop/dist-electron",
10+
homeDirectory: "/Users/alice",
11+
platform: "darwin",
12+
processArch: "arm64",
13+
appVersion: "0.0.22",
14+
appPath: "/Applications/T3 Code.app/Contents/Resources/app.asar",
15+
isPackaged: false,
16+
resourcesPath: "/Applications/T3 Code.app/Contents/Resources",
17+
runningUnderArm64Translation: false,
18+
} satisfies DesktopEnvironment.MakeDesktopEnvironmentInput;
19+
const makeEnvironmentLayer = (
20+
overrides: Partial<DesktopEnvironment.MakeDesktopEnvironmentInput> = {},
21+
env: Record<string, string | undefined> = {},
22+
) =>
23+
DesktopEnvironment.layer({
24+
...defaultInput,
25+
...overrides,
26+
}).pipe(Layer.provide(Layer.mergeAll(NodeServices.layer, DesktopConfig.layerTest(env))));
27+
const makeEnvironment = (
28+
overrides: Partial<DesktopEnvironment.MakeDesktopEnvironmentInput> = {},
29+
env: Record<string, string | undefined> = {},
30+
) =>
31+
DesktopEnvironment.DesktopEnvironment.pipe(Effect.provide(makeEnvironmentLayer(overrides, env)));
32+
describe("DesktopEnvironment", () => {
33+
it.effect("resolves agent placement only for a valid development launch", () =>
34+
Effect.gen(function* () {
35+
const placement = yield* makeEnvironment(
36+
{},
37+
{
38+
VITE_DEV_SERVER_URL: "http://localhost:5173",
39+
T3CODE_DESKTOP_AGENT_WORKSPACE: "8",
40+
T3CODE_DESKTOP_AGENT_PLACEMENT_TITLE: "t3code-dev-agent-abc",
41+
},
42+
);
43+
assert.deepEqual(
44+
placement.devAgentPlacement,
45+
Option.some({ workspace: 8, title: "t3code-dev-agent-abc" }),
46+
);
47+
const production = yield* makeEnvironment(
48+
{},
49+
{
50+
T3CODE_DESKTOP_AGENT_WORKSPACE: "8",
51+
T3CODE_DESKTOP_AGENT_PLACEMENT_TITLE: "t3code-dev-agent-abc",
52+
},
53+
);
54+
assert.deepEqual(production.devAgentPlacement, Option.none());
55+
const invalid = yield* makeEnvironment(
56+
{},
57+
{
58+
VITE_DEV_SERVER_URL: "http://localhost:5173",
59+
T3CODE_DESKTOP_AGENT_WORKSPACE: "0",
60+
T3CODE_DESKTOP_AGENT_PLACEMENT_TITLE: "invalid,title",
61+
},
62+
);
63+
assert.deepEqual(invalid.devAgentPlacement, Option.none());
64+
}),
65+
);
66+
it.effect("keeps devtools on by default and lets a dev run opt out", () =>
67+
Effect.gen(function* () {
68+
const defaults = yield* makeEnvironment({}, { VITE_DEV_SERVER_URL: "http://localhost:5173" });
69+
assert.equal(defaults.devToolsEnabled, true);
70+
for (const value of ["0", "false", "off"]) {
71+
const environment = yield* makeEnvironment(
72+
{},
73+
{ VITE_DEV_SERVER_URL: "http://localhost:5173", T3CODE_DESKTOP_DEVTOOLS: value },
74+
);
75+
assert.equal(environment.devToolsEnabled, false, value);
76+
}
77+
}),
78+
);
79+
});

‎apps/desktop/src/electron/ElectronWindow.test.ts‎

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import * as Cause from "effect/Cause";
44
import * as Effect from "effect/Effect";
55
import * as Fiber from "effect/Fiber";
66
import * as Layer from "effect/Layer";
7-
import * as Option from "effect/Option";
87
import type * as Electron from "electron";
98
import { beforeEach, vi } from "vite-plus/test";
109

@@ -57,15 +56,6 @@ vi.mock("electron", () => ({
5756
}));
5857

5958
import * as ElectronWindow from "./ElectronWindow.ts";
60-
import {
61-
HUB_WINDOW_IDENTITY,
62-
PROJECT_WINDOW_PRELOAD_ARGUMENT,
63-
isProjectWindowPreload,
64-
projectWindowIdentity,
65-
projectWindowPreloadArgument,
66-
readProjectWindowPreloadRef,
67-
} from "../window/WindowIdentity.ts";
68-
import { EnvironmentId, ProjectId } from "@t3tools/contracts";
6959

7060
const layerTestFor = (platform: NodeJS.Platform) =>
7161
ElectronWindow.layer.pipe(Layer.provide(Layer.succeed(HostProcess.Platform, platform)));

‎apps/desktop/src/ipc/methods/window.test.ts‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { EnvironmentId, ProjectId } from "@t3tools/contracts";
21
import { assert, describe, it } from "@effect/vitest";
32
import * as NodeServices from "@effect/platform-node/NodeServices";
43
import * as HostProcess from "@t3tools/shared/HostProcess";
@@ -21,7 +20,6 @@ vi.mock("electron", () => ({
2120
import * as DesktopBackendConfiguration from "../../backend/DesktopBackendConfiguration.ts";
2221
import * as DesktopBackendManager from "../../backend/DesktopBackendManager.ts";
2322
import * as DesktopBackendPool from "../../backend/DesktopBackendPool.ts";
24-
import * as DesktopWindow from "../../window/DesktopWindow.ts";
2523
import {
2624
getLocalEnvironmentBootstraps,
2725
getRelayTelemetryEnabled,

‎apps/desktop/src/updates/DesktopUpdates.test.ts‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { assert, describe, it } from "@effect/vitest";
22
import { DESKTOP_UPDATE_RESTART_MARKER_FILE } from "@t3tools/contracts";
3-
import { EnvironmentId, ProjectId } from "@t3tools/contracts"; // fork-hook: project-windows/updates-test-ids-import
43
import * as Cause from "effect/Cause";
54
import * as Deferred from "effect/Deferred";
65
import * as Effect from "effect/Effect";
@@ -18,7 +17,6 @@ import * as DesktopBackendPool from "../backend/DesktopBackendPool.ts";
1817
import * as DesktopAppSettings from "../settings/DesktopAppSettings.ts";
1918
import * as DesktopEnvironment from "../app/DesktopEnvironment.ts";
2019
import * as DesktopState from "../app/DesktopState.ts";
21-
import { HUB_WINDOW_IDENTITY, projectWindowIdentity } from "../window/WindowIdentity.ts";
2220
import * as DesktopUpdates from "./DesktopUpdates.ts";
2321
import { flushCallbacks, makeHarness } from "./updatesTestHarness.ts";
2422

0 commit comments

Comments
 (0)