Skip to content
TypeScript

test(lint): ban per-test timeouts and unreasoned skips (#22560)

Julius Marmingeb280e7d385fc
diff --git a/AGENTS.md b/AGENTS.md
index ad6c6a14363..95dd9e96065 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -99,7 +99,15 @@ An empty database is a bad test. Seed your worktree's `.t3` with a copy of real
- Test meaningful logic or observable behavior. Do not render components to static markup to assert props or attributes, or add tests that merely assert callback wiring or mirror the implementation.
- **Do not run repo-wide checks.** No `vp check`, no `vp run -r test`, no `vp run -r typecheck` unless I ask. CI owns the full suite.
- Backend behavior changes ship with focused tests for that behavior.
-- The server is event-sourced, and side effects run after the command commits. In tests, drain the effect worker (`OrchestrationEffectWorkerV2.drain`) or await the specific persisted event or `Deferred` that marks the milestone. Never wait on sleeps or polling. A test that needs a timeout to pass is wrong.
+- The server is event-sourced, and side effects run after the command commits. In tests, drain the effect worker (`OrchestrationEffectWorkerV2.drain`) or await the specific persisted event or `Deferred` that marks the milestone. Never wait on sleeps or polling. A test that needs a timeout to pass is wrong. Concretely:
+ - `it.effect` runs on a `TestClock`; `Effect.sleep` only advances through `TestClock.adjust`. `it.live` is wall-clock and only for subprocess or network fixtures.
+ - No `yieldNow` or `sleep` polling loops. Await the `Deferred`, take from the `Queue`, or drain the worker.
+ - No per-test timeout argument or `retry`. The project timeout is the ceiling, and flaky tests are fixed, not retried.
+ - No `performance.now()` or `Date.now()` deltas. Assert on events and counts, not elapsed time.
+ - Browser tests assert through `expect.element` or `vi.waitFor`, never `requestAnimationFrame` or `transitionend`.
+ - `vi.mock` factories must not spread a real module that pulls in Shiki or the diff workers.
+ - `it.skip` and friends need a tracking issue on the line above: `// quarantine: #1234 <why>`.
+ - Lint enforces this: `t3code/no-test-timeout-or-unreasoned-skip`, `t3code/no-frame-waits-in-browser-tests`, `t3code/no-wall-clock-in-tests`, `t3code/no-real-time-wait-in-tests`, `t3code/no-polling-loop-in-tests`.
- Web browser tests are `*.browser.test.tsx` or `*.browser.test.ts` and render with `await using screen = await render(...)` from `apps/web/test/render.tsx`. `t3code/require-disposable-render` errors on the old patterns.
- Acquire what the test drives after mounting (fake timers it advances, spies it sets up after mounting) after the render, so it disposes before the unmount. Anything the first render reads comes before it.
- A helper that renders and then waits or clicks puts the screen in an `AsyncDisposableStack` and `move()`s it out only on success, so a failed wait still unmounts.
diff --git a/apps/mobile/src/reactCompilerCoverage.test.ts b/apps/mobile/src/reactCompilerCoverage.test.ts
index 3415bd353ba..e680a41652e 100644
--- a/apps/mobile/src/reactCompilerCoverage.test.ts
+++ b/apps/mobile/src/reactCompilerCoverage.test.ts
@@ -145,4 +145,4 @@ describe("React Compiler coverage", () => {
it("lists only files that exist", () => {
expect(Object.keys(KNOWN_BAILOUTS).filter((file) => !sourceFiles.includes(file))).toEqual([]);
});
-}, 300_000);
+});
diff --git a/apps/server/integration/transferBudgetV2.integration.test.ts b/apps/server/integration/transferBudgetV2.integration.test.ts
index b4dd358c17b..5064848571b 100644
--- a/apps/server/integration/transferBudgetV2.integration.test.ts
+++ b/apps/server/integration/transferBudgetV2.integration.test.ts
@@ -219,150 +219,144 @@ const synchronized = (queue: Queue.Queue<StreamItem>) =>
),
);
-it.live(
- "reports V2 thread HTTP and WebSocket transfer budgets",
- () =>
- Effect.gen(function* () {
- const runs: TransferBudgetRun[] = [];
- for (const provider of [
- ProviderDriverKind.make("codex"),
- ProviderDriverKind.make("claudeAgent"),
- ]) {
- const counter = makeSqlStatementCounter();
- const run = yield* Effect.scoped(
- Effect.gen(function* () {
- const sink = yield* EventSink.EventSinkV2;
- const projection = yield* ProjectionStore.ProjectionStoreV2;
- yield* sink.write({ events: [threadCreated(provider)] });
- for (let index = 0; index < TRANSFER_HISTORY_TURN_COUNT; index++)
- yield* sink.write({ events: turnEvents(provider, index, false) });
- const context = yield* Effect.context<Layer.Success<typeof layerServices>>();
- const server = yield* Layer.build(
- HttpRouter.serve(layerRoutes, { disableListenLog: true }).pipe(
- Layer.provide(Layer.succeedContext(context)),
- Layer.provideMerge(
- NodeHttpServer.layer(NodeHttp.createServer, {
- host: "127.0.0.1",
- port: 0,
- websocket: { perMessageDeflate: true },
- }),
- ),
- ),
- );
- const address = Context.get(server, HttpServer.HttpServer).address;
- if (!("port" in address)) return yield* Effect.die("Expected TCP server");
- const base = `http://127.0.0.1:${address.port}`;
- const threadSnapshot = yield* measureHttpGet({
- url: `${base}/api/orchestration/threads/${THREAD_ID}`,
- headers: { [ORCHESTRATION_PROTOCOL_HEADER]: String(ORCHESTRATION_PROTOCOL_VERSION) },
- });
- assert.equal(
- threadSnapshot.status,
- 200,
- Buffer.from(threadSnapshot.decodedBody).toString(),
- );
- assert.equal(threadSnapshot.contentEncoding, "gzip");
- const decodedThread = yield* decodeThreadSnapshot(
- Buffer.from(threadSnapshot.decodedBody).toString(),
- );
- assert.equal(decodedThread.projection.messages.length, TRANSFER_HISTORY_TURN_COUNT * 2);
- assert.equal(
- decodedThread.projection.turnItems.length,
- TRANSFER_HISTORY_TURN_COUNT * 6,
- );
- assert.notInclude(Buffer.from(threadSnapshot.decodedBody).toString(), "digest=");
- const shellSnapshot = yield* measureHttpGet({
- url: `${base}/api/orchestration/shell`,
- headers: { [ORCHESTRATION_PROTOCOL_HEADER]: String(ORCHESTRATION_PROTOCOL_VERSION) },
- });
- assert.equal(shellSnapshot.status, 200);
- const decodedShell = yield* decodeShellSnapshot(
- Buffer.from(shellSnapshot.decodedBody).toString(),
- );
- assert.equal(decodedShell.threads.length, 1);
- const sequence = decodedThread.snapshotSequence;
- assert.equal(decodedShell.snapshotSequence, sequence);
- const url = `${base.replace("http:", "ws:")}/ws`;
- const thread = yield* openMeasuredWsClient({ url, cookie: "" });
- const shell = yield* openMeasuredWsClient({ url, cookie: "" });
- const second = yield* openMeasuredWsClient({ url, cookie: "" });
- assert.include(thread.recorder.negotiatedExtensions(), "permessage-deflate");
- const tq = yield* subscribe(thread, "thread", sequence);
- const sq = yield* subscribe(shell, "shell", sequence);
- const ttq = yield* subscribe(second, "thread", sequence);
- const ssq = yield* subscribe(second, "shell", sequence);
- for (const queue of [tq, sq, ttq, ssq])
- assert.equal(yield* synchronized(queue), "replay");
- const threadBefore = thread.recorder.totals();
- const shellBefore = shell.recorder.totals();
- const secondBefore = second.recorder.totals();
- const sqlBefore = counter.count();
- const events = turnEvents(provider, TRANSFER_HISTORY_TURN_COUNT, true);
- const stored = yield* sink.write({ events });
- const last = stored.at(-1)!;
- const threadTerminal = (item: StreamItem) =>
- "sequence" in item && item.sequence >= last.sequence;
- // Shell items carry the shell read when their batch is projected, and unchanged
- // shells are skipped, so a turn split across batches may never yield an item at
- // the last sequence. Wait for the final shell instead.
- const finalShell = yield* projection.getThreadShell(THREAD_ID);
- const shellTerminal = (item: StreamItem) =>
- item.kind === "thread.updated" && NodeUtil.isDeepStrictEqual(item.thread, finalShell);
- for (const queue of [tq, ttq]) yield* collectUntil(queue, threadTerminal);
- for (const queue of [sq, ssq]) yield* collectUntil(queue, shellTerminal);
- const measuredTurnWebSocket = difference(thread.recorder.totals(), threadBefore);
- const measuredTurnShellWebSocket = difference(shell.recorder.totals(), shellBefore);
- const measuredTurnSecondClientWebSocket = difference(
- second.recorder.totals(),
- secondBefore,
- );
- const measuredTurnSqlStatements = counter.count() - sqlBefore;
- const durable = yield* projection.getThreadProjection(THREAD_ID);
- assert.isTrue(
- durable.turnItems.some(
- (item) =>
- item.type === "dynamic_tool" && JSON.stringify(item.output).length > 1_000_000,
+it.live("reports V2 thread HTTP and WebSocket transfer budgets", () =>
+ Effect.gen(function* () {
+ const runs: TransferBudgetRun[] = [];
+ for (const provider of [
+ ProviderDriverKind.make("codex"),
+ ProviderDriverKind.make("claudeAgent"),
+ ]) {
+ const counter = makeSqlStatementCounter();
+ const run = yield* Effect.scoped(
+ Effect.gen(function* () {
+ const sink = yield* EventSink.EventSinkV2;
+ const projection = yield* ProjectionStore.ProjectionStoreV2;
+ yield* sink.write({ events: [threadCreated(provider)] });
+ for (let index = 0; index < TRANSFER_HISTORY_TURN_COUNT; index++)
+ yield* sink.write({ events: turnEvents(provider, index, false) });
+ const context = yield* Effect.context<Layer.Success<typeof layerServices>>();
+ const server = yield* Layer.build(
+ HttpRouter.serve(layerRoutes, { disableListenLog: true }).pipe(
+ Layer.provide(Layer.succeedContext(context)),
+ Layer.provideMerge(
+ NodeHttpServer.layer(NodeHttp.createServer, {
+ host: "127.0.0.1",
+ port: 0,
+ websocket: { perMessageDeflate: true },
+ }),
),
- );
- yield* second.close;
- const reconnectSqlStart = counter.count();
- const resumedThread = yield* openMeasuredWsClient({ url, cookie: "" });
- const resumedShell = yield* openMeasuredWsClient({ url, cookie: "" });
- const rq = yield* subscribe(resumedThread, "thread", sequence);
- const rsq = yield* subscribe(resumedShell, "shell", sequence);
- const threadMode = yield* synchronized(rq);
- const shellMode = yield* synchronized(rsq);
- const reconnectThread = { ...resumedThread.recorder.totals(), mode: threadMode };
- const reconnectShell = { ...resumedShell.recorder.totals(), mode: shellMode };
- assert.equal(threadMode, "snapshot");
- return {
- provider,
- threadSnapshot,
- shellSnapshot,
- measuredTurnWebSocket,
- measuredTurnShellWebSocket,
- measuredTurnSecondClientWebSocket,
- measuredTurnSqlStatements,
- reconnectThread,
- reconnectShell,
- reconnectSqlStatements: counter.count() - reconnectSqlStart,
- } satisfies TransferBudgetRun;
- }).pipe(
- Effect.provide(Layer.fresh(layerServices).pipe(Layer.provideMerge(NodeServices.layer))),
- Effect.withTracer(counter.tracer),
- ),
- );
- runs.push(run);
- }
- const fs = yield* FileSystem.FileSystem;
- const report = formatTransferBudgetReport(runs);
- for (const [path, contents] of [
- [process.env.T3CODE_TRANSFER_BUDGET_REPORT_PATH, report],
- [process.env.T3CODE_TRANSFER_BUDGET_RESULT_PATH, formatTransferBudgetResult(runs)],
- ])
- if (path && contents) yield* fs.writeFileString(path, contents);
- yield* Effect.log(report);
- assert.deepEqual(transferBudgetViolations(runs), []);
- }).pipe(Effect.provide(NodeServices.layer)),
- 30_000,
+ ),
+ );
+ const address = Context.get(server, HttpServer.HttpServer).address;
+ if (!("port" in address)) return yield* Effect.die("Expected TCP server");
+ const base = `http://127.0.0.1:${address.port}`;
+ const threadSnapshot = yield* measureHttpGet({
+ url: `${base}/api/orchestration/threads/${THREAD_ID}`,
+ headers: { [ORCHESTRATION_PROTOCOL_HEADER]: String(ORCHESTRATION_PROTOCOL_VERSION) },
+ });
+ assert.equal(
+ threadSnapshot.status,
+ 200,
+ Buffer.from(threadSnapshot.decodedBody).toString(),
+ );
+ assert.equal(threadSnapshot.contentEncoding, "gzip");
+ const decodedThread = yield* decodeThreadSnapshot(
+ Buffer.from(threadSnapshot.decodedBody).toString(),
+ );
+ assert.equal(decodedThread.projection.messages.length, TRANSFER_HISTORY_TURN_COUNT * 2);
+ assert.equal(decodedThread.projection.turnItems.length, TRANSFER_HISTORY_TURN_COUNT * 6);
+ assert.notInclude(Buffer.from(threadSnapshot.decodedBody).toString(), "digest=");
+ const shellSnapshot = yield* measureHttpGet({
+ url: `${base}/api/orchestration/shell`,
+ headers: { [ORCHESTRATION_PROTOCOL_HEADER]: String(ORCHESTRATION_PROTOCOL_VERSION) },
+ });
+ assert.equal(shellSnapshot.status, 200);
+ const decodedShell = yield* decodeShellSnapshot(
+ Buffer.from(shellSnapshot.decodedBody).toString(),
+ );
+ assert.equal(decodedShell.threads.length, 1);
+ const sequence = decodedThread.snapshotSequence;
+ assert.equal(decodedShell.snapshotSequence, sequence);
+ const url = `${base.replace("http:", "ws:")}/ws`;
+ const thread = yield* openMeasuredWsClient({ url, cookie: "" });
+ const shell = yield* openMeasuredWsClient({ url, cookie: "" });
+ const second = yield* openMeasuredWsClient({ url, cookie: "" });
+ assert.include(thread.recorder.negotiatedExtensions(), "permessage-deflate");
+ const tq = yield* subscribe(thread, "thread", sequence);
+ const sq = yield* subscribe(shell, "shell", sequence);
+ const ttq = yield* subscribe(second, "thread", sequence);
+ const ssq = yield* subscribe(second, "shell", sequence);
+ for (const queue of [tq, sq, ttq, ssq])
+ assert.equal(yield* synchronized(queue), "replay");
+ const threadBefore = thread.recorder.totals();
+ const shellBefore = shell.recorder.totals();
+ const secondBefore = second.recorder.totals();
+ const sqlBefore = counter.count();
+ const events = turnEvents(provider, TRANSFER_HISTORY_TURN_COUNT, true);
+ const stored = yield* sink.write({ events });
+ const last = stored.at(-1)!;
+ const threadTerminal = (item: StreamItem) =>
+ "sequence" in item && item.sequence >= last.sequence;
+ // Shell items carry the shell read when their batch is projected, and unchanged
+ // shells are skipped, so a turn split across batches may never yield an item at
+ // the last sequence. Wait for the final shell instead.
+ const finalShell = yield* projection.getThreadShell(THREAD_ID);
+ const shellTerminal = (item: StreamItem) =>
+ item.kind === "thread.updated" && NodeUtil.isDeepStrictEqual(item.thread, finalShell);
+ for (const queue of [tq, ttq]) yield* collectUntil(queue, threadTerminal);
+ for (const queue of [sq, ssq]) yield* collectUntil(queue, shellTerminal);
+ const measuredTurnWebSocket = difference(thread.recorder.totals(), threadBefore);
+ const measuredTurnShellWebSocket = difference(shell.recorder.totals(), shellBefore);
+ const measuredTurnSecondClientWebSocket = difference(
+ second.recorder.totals(),
+ secondBefore,
+ );
+ const measuredTurnSqlStatements = counter.count() - sqlBefore;
+ const durable = yield* projection.getThreadProjection(THREAD_ID);
+ assert.isTrue(
+ durable.turnItems.some(
+ (item) =>
+ item.type === "dynamic_tool" && JSON.stringify(item.output).length > 1_000_000,
+ ),
+ );
+ yield* second.close;
+ const reconnectSqlStart = counter.count();
+ const resumedThread = yield* openMeasuredWsClient({ url, cookie: "" });
+ const resumedShell = yield* openMeasuredWsClient({ url, cookie: "" });
+ const rq = yield* subscribe(resumedThread, "thread", sequence);
+ const rsq = yield* subscribe(resumedShell, "shell", sequence);
+ const threadMode = yield* synchronized(rq);
+ const shellMode = yield* synchronized(rsq);
+ const reconnectThread = { ...resumedThread.recorder.totals(), mode: threadMode };
+ const reconnectShell = { ...resumedShell.recorder.totals(), mode: shellMode };
+ assert.equal(threadMode, "snapshot");
+ return {
+ provider,
+ threadSnapshot,
+ shellSnapshot,
+ measuredTurnWebSocket,
+ measuredTurnShellWebSocket,
+ measuredTurnSecondClientWebSocket,
+ measuredTurnSqlStatements,
+ reconnectThread,
+ reconnectShell,
+ reconnectSqlStatements: counter.count() - reconnectSqlStart,
+ } satisfies TransferBudgetRun;
+ }).pipe(
+ Effect.provide(Layer.fresh(layerServices).pipe(Layer.provideMerge(NodeServices.layer))),
+ Effect.withTracer(counter.tracer),
+ ),
+ );
+ runs.push(run);
+ }
+ const fs = yield* FileSystem.FileSystem;
+ const report = formatTransferBudgetReport(runs);
+ for (const [path, contents] of [
+ [process.env.T3CODE_TRANSFER_BUDGET_REPORT_PATH, report],
+ [process.env.T3CODE_TRANSFER_BUDGET_RESULT_PATH, formatTransferBudgetResult(runs)],
+ ])
+ if (path && contents) yield* fs.writeFileString(path, contents);
+ yield* Effect.log(report);
+ assert.deepEqual(transferBudgetViolations(runs), []);
+ }).pipe(Effect.provide(NodeServices.layer)),
);
diff --git a/apps/server/src/git/GitManager.test.ts b/apps/server/src/git/GitManager.test.ts
index dff13300ea8..f845f01c64e 100644
--- a/apps/server/src/git/GitManager.test.ts
+++ b/apps/server/src/git/GitManager.test.ts
@@ -2005,141 +2005,135 @@ it.layer(layerGitManagerTest)("GitManager", (it) => {
}),
);
- it.effect(
- "status detects cross-repo PRs from the upstream remote URL owner",
- () =>
- Effect.gen(function* () {
- const repoDir = yield* makeTempDir("t3code-git-manager-");
- yield* initRepo(repoDir);
- const forkDir = yield* createBareRemote();
- yield* runGit(repoDir, ["remote", "add", "fork-seed", forkDir]);
- // Origin is the base repository; a lone remote would be the base itself.
- yield* runGit(repoDir, [
- "remote",
- "add",
- "origin",
- "[email protected]:pingdotgg/codething-mvp.git",
- ]);
- yield* runGit(repoDir, ["checkout", "-b", "statemachine"]);
- NodeFS.writeFileSync(NodePath.join(repoDir, "fork-pr.txt"), "fork pr\n");
- yield* runGit(repoDir, ["add", "fork-pr.txt"]);
- yield* runGit(repoDir, ["commit", "-m", "Fork PR branch"]);
- yield* runGit(repoDir, ["push", "-u", "fork-seed", "statemachine"]);
- yield* runGit(repoDir, ["checkout", "-b", "t3code/pr-488/statemachine"]);
- yield* runGit(repoDir, ["branch", "--set-upstream-to", "fork-seed/statemachine"]);
- yield* configureVisibleRemoteUrlWithLocalRewrite(
- repoDir,
- "fork-seed",
- "[email protected]:jasonLaster/codething-mvp.git",
- forkDir,
- );
+ it.effect("status detects cross-repo PRs from the upstream remote URL owner", () =>
+ Effect.gen(function* () {
+ const repoDir = yield* makeTempDir("t3code-git-manager-");
+ yield* initRepo(repoDir);
+ const forkDir = yield* createBareRemote();
+ yield* runGit(repoDir, ["remote", "add", "fork-seed", forkDir]);
+ // Origin is the base repository; a lone remote would be the base itself.
+ yield* runGit(repoDir, [
+ "remote",
+ "add",
+ "origin",
+ "[email protected]:pingdotgg/codething-mvp.git",
+ ]);
+ yield* runGit(repoDir, ["checkout", "-b", "statemachine"]);
+ NodeFS.writeFileSync(NodePath.join(repoDir, "fork-pr.txt"), "fork pr\n");
+ yield* runGit(repoDir, ["add", "fork-pr.txt"]);
+ yield* runGit(repoDir, ["commit", "-m", "Fork PR branch"]);
+ yield* runGit(repoDir, ["push", "-u", "fork-seed", "statemachine"]);
+ yield* runGit(repoDir, ["checkout", "-b", "t3code/pr-488/statemachine"]);
+ yield* runGit(repoDir, ["branch", "--set-upstream-to", "fork-seed/statemachine"]);
+ yield* configureVisibleRemoteUrlWithLocalRewrite(
+ repoDir,
+ "fork-seed",
+ "[email protected]:jasonLaster/codething-mvp.git",
+ forkDir,
+ );
- const { manager, ghCalls } = yield* makeManager({
- ghScenario: {
- prListSequence: [
- JSON.stringify([
- {
- number: 488,
- title: "Rebase this PR on latest main",
- url: "https://github.com/pingdotgg/codething-mvp/pull/488",
- baseRefName: "main",
- headRefName: "statemachine",
- state: "OPEN",
- updatedAt: "2026-03-10T07:00:00Z",
- isCrossRepository: true,
- headRepository: {
- nameWithOwner: "jasonLaster/codething-mvp",
- },
- headRepositoryOwner: {
- login: "jasonLaster",
- },
+ const { manager, ghCalls } = yield* makeManager({
+ ghScenario: {
+ prListSequence: [
+ JSON.stringify([
+ {
+ number: 488,
+ title: "Rebase this PR on latest main",
+ url: "https://github.com/pingdotgg/codething-mvp/pull/488",
+ baseRefName: "main",
+ headRefName: "statemachine",
+ state: "OPEN",
+ updatedAt: "2026-03-10T07:00:00Z",
+ isCrossRepository: true,
+ headRepository: {
+ nameWithOwner: "jasonLaster/codething-mvp",
},
- ]),
- ],
- },
- });
+ headRepositoryOwner: {
+ login: "jasonLaster",
+ },
+ },
+ ]),
+ ],
+ },
+ });
- const status = yield* manager.status({ cwd: repoDir });
- expect(status.refName).toBe("t3code/pr-488/statemachine");
- expect(status.pr).toEqual({
- number: 488,
- title: "Rebase this PR on latest main",
- url: "https://github.com/pingdotgg/codething-mvp/pull/488",
- baseRef: "main",
- headRef: "statemachine",
- state: "open",
- updatedAt: "2026-03-10T07:00:00.000Z",
- });
- expect(ghCalls).toContain(
- "pr list --head statemachine --state all --limit 100 --json number,title,url,baseRefName,headRefName,state,isDraft,mergedAt,closedAt,updatedAt,isCrossRepository,headRepository,headRepositoryOwner",
- );
- }),
- 20_000,
+ const status = yield* manager.status({ cwd: repoDir });
+ expect(status.refName).toBe("t3code/pr-488/statemachine");
+ expect(status.pr).toEqual({
+ number: 488,
+ title: "Rebase this PR on latest main",
+ url: "https://github.com/pingdotgg/codething-mvp/pull/488",
+ baseRef: "main",
+ headRef: "statemachine",
+ state: "open",
+ updatedAt: "2026-03-10T07:00:00.000Z",
+ });
+ expect(ghCalls).toContain(
+ "pr list --head statemachine --state all --limit 100 --json number,title,url,baseRefName,headRefName,state,isDraft,mergedAt,closedAt,updatedAt,isCrossRepository,headRepository,headRepositoryOwner",
+ );
+ }),
);
- it.effect(
- "status preserves a fork PR whose head is named after the default branch",
- () =>
- Effect.gen(function* () {
- const repoDir = yield* makeTempDir("t3code-git-manager-");
- yield* initRepo(repoDir);
- const originDir = yield* createBareRemote();
- const forkDir = yield* createBareRemote();
- yield* runGit(repoDir, ["remote", "add", "origin", originDir]);
- yield* runGit(repoDir, ["push", "-u", "origin", "main"]);
- yield* runGit(repoDir, ["remote", "set-head", "origin", "main"]);
- yield* runGit(repoDir, ["remote", "add", "fork-seed", forkDir]);
- yield* runGit(repoDir, ["push", "fork-seed", "main"]);
- yield* runGit(repoDir, ["checkout", "-b", "t3code/pr-777/main"]);
- yield* runGit(repoDir, ["branch", "--set-upstream-to", "fork-seed/main"]);
- yield* configureVisibleRemoteUrlWithLocalRewrite(
- repoDir,
- "fork-seed",
- "[email protected]:contributor/codething-mvp.git",
- forkDir,
- );
+ it.effect("status preserves a fork PR whose head is named after the default branch", () =>
+ Effect.gen(function* () {
+ const repoDir = yield* makeTempDir("t3code-git-manager-");
+ yield* initRepo(repoDir);
+ const originDir = yield* createBareRemote();
+ const forkDir = yield* createBareRemote();
+ yield* runGit(repoDir, ["remote", "add", "origin", originDir]);
+ yield* runGit(repoDir, ["push", "-u", "origin", "main"]);
+ yield* runGit(repoDir, ["remote", "set-head", "origin", "main"]);
+ yield* runGit(repoDir, ["remote", "add", "fork-seed", forkDir]);
+ yield* runGit(repoDir, ["push", "fork-seed", "main"]);
+ yield* runGit(repoDir, ["checkout", "-b", "t3code/pr-777/main"]);
+ yield* runGit(repoDir, ["branch", "--set-upstream-to", "fork-seed/main"]);
+ yield* configureVisibleRemoteUrlWithLocalRewrite(
+ repoDir,
+ "fork-seed",
+ "[email protected]:contributor/codething-mvp.git",
+ forkDir,
+ );
- const { manager, ghCalls } = yield* makeManager({
- ghScenario: {
- prListByHeadSelector: {
- main: JSON.stringify([
- {
- number: 777,
- title: "Fork PR from main",
- url: "https://github.com/pingdotgg/codething-mvp/pull/777",
- baseRefName: "main",
- headRefName: "main",
- state: "OPEN",
- updatedAt: "2026-03-10T07:00:00Z",
- isCrossRepository: true,
- headRepository: {
- nameWithOwner: "contributor/codething-mvp",
- },
- headRepositoryOwner: {
- login: "contributor",
- },
+ const { manager, ghCalls } = yield* makeManager({
+ ghScenario: {
+ prListByHeadSelector: {
+ main: JSON.stringify([
+ {
+ number: 777,
+ title: "Fork PR from main",
+ url: "https://github.com/pingdotgg/codething-mvp/pull/777",
+ baseRefName: "main",
+ headRefName: "main",
+ state: "OPEN",
+ updatedAt: "2026-03-10T07:00:00Z",
+ isCrossRepository: true,
+ headRepository: {
+ nameWithOwner: "contributor/codething-mvp",
},
- ]),
- },
+ headRepositoryOwner: {
+ login: "contributor",
+ },
+ },
+ ]),
},
- });
+ },
+ });
- const status = yield* manager.status({ cwd: repoDir });
- expect(status.refName).toBe("t3code/pr-777/main");
- expect(status.pr).toEqual({
- number: 777,
- title: "Fork PR from main",
- url: "https://github.com/pingdotgg/codething-mvp/pull/777",
- baseRef: "main",
- headRef: "main",
- state: "open",
- updatedAt: "2026-03-10T07:00:00.000Z",
- });
- expect(ghCalls).toContain(
- "pr list --head main --state all --limit 100 --json number,title,url,baseRefName,headRefName,state,isDraft,mergedAt,closedAt,updatedAt,isCrossRepository,headRepository,headRepositoryOwner",
- );
- }),
- 20_000,
+ const status = yield* manager.status({ cwd: repoDir });
+ expect(status.refName).toBe("t3code/pr-777/main");
+ expect(status.pr).toEqual({
+ number: 777,
+ title: "Fork PR from main",
+ url: "https://github.com/pingdotgg/codething-mvp/pull/777",
+ baseRef: "main",
+ headRef: "main",
+ state: "open",
+ updatedAt: "2026-03-10T07:00:00.000Z",
+ });
+ expect(ghCalls).toContain(
+ "pr list --head main --state all --limit 100 --json number,title,url,baseRefName,headRefName,state,isDraft,mergedAt,closedAt,updatedAt,isCrossRepository,headRepository,headRepositoryOwner",
+ );
+ }),
);
it.effect(
@@ -2226,7 +2220,6 @@ it.layer(layerGitManagerTest)("GitManager", (it) => {
),
).toBe(false);
}),
- 20_000,
);
it.effect("status hides merged PRs on the default branch", () =>
diff --git a/apps/server/src/htmlRender/HtmlRender.test.ts b/apps/server/src/htmlRender/HtmlRender.test.ts
index 19f51714f39..c317e6881e6 100644
--- a/apps/server/src/htmlRender/HtmlRender.test.ts
+++ b/apps/server/src/htmlRender/HtmlRender.test.ts
@@ -287,89 +287,83 @@ describe("HtmlRender", () => {
}),
);
- it.live(
- "keeps every local file but the page itself out of the browser",
- (ctx) =>
- Effect.gen(function* () {
- const executable = (yield* HostProcess.Environment)[TEST_BROWSER_ENV];
- if (!executable) return ctx.skip(`Set ${TEST_BROWSER_ENV} to run this test.`);
- yield* Effect.gen(function* () {
- const fileSystem = yield* FileSystem.FileSystem;
- const path = yield* Path.Path;
- const htmlRender = yield* HtmlRender.HtmlRender;
- const directory = yield* fileSystem.makeTempDirectoryScoped({ prefix: "t3-html-files-" });
- const secret = path.join(directory, "secret.js");
- yield* fileSystem.writeFileString(secret, 'window.secret = "abc123";');
- const secretUrl = NodeURL.pathToFileURL(secret).href;
+ it.live("keeps every local file but the page itself out of the browser", (ctx) =>
+ Effect.gen(function* () {
+ const executable = (yield* HostProcess.Environment)[TEST_BROWSER_ENV];
+ if (!executable) return ctx.skip(`Set ${TEST_BROWSER_ENV} to run this test.`);
+ yield* Effect.gen(function* () {
+ const fileSystem = yield* FileSystem.FileSystem;
+ const path = yield* Path.Path;
+ const htmlRender = yield* HtmlRender.HtmlRender;
+ const directory = yield* fileSystem.makeTempDirectoryScoped({ prefix: "t3-html-files-" });
+ const secret = path.join(directory, "secret.js");
+ yield* fileSystem.writeFileString(secret, 'window.secret = "abc123";');
+ const secretUrl = NodeURL.pathToFileURL(secret).href;
- const preview = yield* htmlRender.preview({
- html: [
- `<script src="${secretUrl}"></script>`,
- `<iframe src="${secretUrl}" onload="console.log('frame loaded')"></iframe>`,
- '<script>addEventListener("load", () => console.log("secret:", window.secret ?? "none"));</script>',
- ].join(""),
- });
+ const preview = yield* htmlRender.preview({
+ html: [
+ `<script src="${secretUrl}"></script>`,
+ `<iframe src="${secretUrl}" onload="console.log('frame loaded')"></iframe>`,
+ '<script>addEventListener("load", () => console.log("secret:", window.secret ?? "none"));</script>',
+ ].join(""),
+ });
- const texts = preview.consoleMessages.map((message) => message.text);
- expect(texts).toContain("secret: none");
- expect(texts.join(" ")).not.toContain("abc123");
- }).pipe(Effect.scoped, Effect.provide(layerHtmlRender(executable)));
- }),
- 30_000,
+ const texts = preview.consoleMessages.map((message) => message.text);
+ expect(texts).toContain("secret: none");
+ expect(texts.join(" ")).not.toContain("abc123");
+ }).pipe(Effect.scoped, Effect.provide(layerHtmlRender(executable)));
+ }),
);
- it.live(
- "keeps the page off this machine's local network",
- (ctx) =>
- Effect.gen(function* () {
- const executable = (yield* HostProcess.Environment)[TEST_BROWSER_ENV];
- if (!executable) return ctx.skip(`Set ${TEST_BROWSER_ENV} to run this test.`);
- const requests: Array<string> = [];
- const server = yield* Effect.acquireRelease(
- Effect.callback<NodeHttp.Server>((resume) => {
- const listening = NodeHttp.createServer((request, response) => {
- requests.push(`${request.url} ${request.headers["sec-purpose"] ?? ""}`);
- response.end("<p>LOCAL</p>");
- });
- listening.listen(0, "127.0.0.1", () => resume(Effect.succeed(listening)));
+ it.live("keeps the page off this machine's local network", (ctx) =>
+ Effect.gen(function* () {
+ const executable = (yield* HostProcess.Environment)[TEST_BROWSER_ENV];
+ if (!executable) return ctx.skip(`Set ${TEST_BROWSER_ENV} to run this test.`);
+ const requests: Array<string> = [];
+ const server = yield* Effect.acquireRelease(
+ Effect.callback<NodeHttp.Server>((resume) => {
+ const listening = NodeHttp.createServer((request, response) => {
+ requests.push(`${request.url} ${request.headers["sec-purpose"] ?? ""}`);
+ response.end("<p>LOCAL</p>");
+ });
+ listening.listen(0, "127.0.0.1", () => resume(Effect.succeed(listening)));
+ }),
+ (listening) =>
+ Effect.callback<void>((resume) => {
+ listening.close(() => resume(Effect.void));
}),
- (listening) =>
- Effect.callback<void>((resume) => {
- listening.close(() => resume(Effect.void));
- }),
- );
- const datagrams: Array<string> = [];
- const udp = yield* Effect.acquireRelease(
- Effect.callback<NodeDgram.Socket>((resume) => {
- const socket = NodeDgram.createSocket("udp4");
- socket.on("message", (message) => datagrams.push(message.toString("hex")));
- socket.bind(0, "127.0.0.1", () => resume(Effect.succeed(socket)));
+ );
+ const datagrams: Array<string> = [];
+ const udp = yield* Effect.acquireRelease(
+ Effect.callback<NodeDgram.Socket>((resume) => {
+ const socket = NodeDgram.createSocket("udp4");
+ socket.on("message", (message) => datagrams.push(message.toString("hex")));
+ socket.bind(0, "127.0.0.1", () => resume(Effect.succeed(socket)));
+ }),
+ (socket) =>
+ Effect.callback<void>((resume) => {
+ socket.close(() => resume(Effect.void));
}),
- (socket) =>
- Effect.callback<void>((resume) => {
- socket.close(() => resume(Effect.void));
- }),
- );
- const address = server.address();
- const origin = `http://127.0.0.1:${typeof address === "object" && address ? address.port : 0}`;
- const stun = `stun:127.0.0.1:${udp.address().port}`;
- yield* Effect.gen(function* () {
- const htmlRender = yield* HtmlRender.HtmlRender;
- yield* htmlRender.preview({
- html: [
- `<img src="${origin}/x.png"><iframe src="${origin}/"></iframe>`,
- `<script type="speculationrules">{"prefetch":[{"source":"list","urls":["${origin}/prefetch"]}]}</script>`,
- `<script>fetch("${origin}/").catch(() => {}); new WebSocket("ws${origin.slice(4)}/socket");`,
- `try { const peer = new RTCPeerConnection({ iceServers: [{ urls: "${stun}" }] });`,
- `peer.createDataChannel("x"); peer.createOffer().then((offer) => peer.setLocalDescription(offer));`,
- `} catch {}`,
- `window.open("${origin}/popup"); location.href = "${origin}/navigate";</script>`,
- ].join(""),
- });
- }).pipe(Effect.provide(layerHtmlRender(executable)));
- expect(requests).toEqual([]);
- expect(datagrams).toEqual([]);
- }).pipe(Effect.scoped),
- 30_000,
+ );
+ const address = server.address();
+ const origin = `http://127.0.0.1:${typeof address === "object" && address ? address.port : 0}`;
+ const stun = `stun:127.0.0.1:${udp.address().port}`;
+ yield* Effect.gen(function* () {
+ const htmlRender = yield* HtmlRender.HtmlRender;
+ yield* htmlRender.preview({
+ html: [
+ `<img src="${origin}/x.png"><iframe src="${origin}/"></iframe>`,
+ `<script type="speculationrules">{"prefetch":[{"source":"list","urls":["${origin}/prefetch"]}]}</script>`,
+ `<script>fetch("${origin}/").catch(() => {}); new WebSocket("ws${origin.slice(4)}/socket");`,
+ `try { const peer = new RTCPeerConnection({ iceServers: [{ urls: "${stun}" }] });`,
+ `peer.createDataChannel("x"); peer.createOffer().then((offer) => peer.setLocalDescription(offer));`,
+ `} catch {}`,
+ `window.open("${origin}/popup"); location.href = "${origin}/navigate";</script>`,
+ ].join(""),
+ });
+ }).pipe(Effect.provide(layerHtmlRender(executable)));
+ expect(requests).toEqual([]);
+ expect(datagrams).toEqual([]);
+ }).pipe(Effect.scoped),
);
});
diff --git a/apps/server/src/httpResponseErrorGuard.test.ts b/apps/server/src/httpResponseErrorGuard.test.ts
index ea7b0ef31c3..ae23fc37a08 100644
--- a/apps/server/src/httpResponseErrorGuard.test.ts
+++ b/apps/server/src/httpResponseErrorGuard.test.ts
@@ -163,5 +163,5 @@ describe("rejectRequestsUntilServing", () => {
expect(servingUpgrade.statusCode).toBe(101);
expect(servingUpgrade.headers["retry-after"]).toBeUndefined();
expect(writeErrors).toEqual([]);
- }, 5_000);
+ });
});
diff --git a/apps/web/src/reactCompilerCoverage.test.ts b/apps/web/src/reactCompilerCoverage.test.ts
index 4fd53c355f1..1d43c9e38b0 100644
--- a/apps/web/src/reactCompilerCoverage.test.ts
+++ b/apps/web/src/reactCompilerCoverage.test.ts
@@ -30,4 +30,4 @@ describe("React Compiler coverage", () => {
const bailouts = result.errors.map((error) => error.codeframe ?? error.message);
expect(bailouts).toEqual([]);
});
-}, 120_000);
+});
diff --git a/oxlint-plugin-t3code/index.ts b/oxlint-plugin-t3code/index.ts
index c7c457be112..8ace0797349 100644
--- a/oxlint-plugin-t3code/index.ts
+++ b/oxlint-plugin-t3code/index.ts
@@ -16,6 +16,7 @@ import noOutsetStateIndicators from "./rules/no-outset-state-indicators.ts";
import noRawMcpRegistration from "./rules/no-raw-mcp-registration.ts";
import noRawResizeObserver from "./rules/no-raw-resize-observer.ts";
import noTestInLoop from "./rules/no-test-in-loop.ts";
+import noTestTimeoutOrUnreasonedSkip from "./rules/no-test-timeout-or-unreasoned-skip.ts";
import noRpcPermissionBypass from "./rules/no-rpc-permission-bypass.ts";
import noUnscopedHas from "./rules/no-unscoped-has.ts";
import preferCatchTags from "./rules/prefer-catch-tags.ts";
@@ -45,6 +46,7 @@ export default definePlugin({
"no-raw-mcp-registration": noRawMcpRegistration,
"no-raw-resize-observer": noRawResizeObserver,
"no-test-in-loop": noTestInLoop,
+ "no-test-timeout-or-unreasoned-skip": noTestTimeoutOrUnreasonedSkip,
"no-rpc-permission-bypass": noRpcPermissionBypass,
"no-unscoped-has": noUnscopedHas,
"prefer-catch-tags": preferCatchTags,
diff --git a/oxlint-plugin-t3code/rules/no-test-timeout-or-unreasoned-skip.test.ts b/oxlint-plugin-t3code/rules/no-test-timeout-or-unreasoned-skip.test.ts
new file mode 100644
index 00000000000..b1ab8583759
--- /dev/null
+++ b/oxlint-plugin-t3code/rules/no-test-timeout-or-unreasoned-skip.test.ts
@@ -0,0 +1,193 @@
+import { assert, describe } from "@effect/vitest";
+
+import { createOxlintRuleHarness } from "../test/utils.ts";
+
+const RULE = "t3code/no-test-timeout-or-unreasoned-skip";
+const rule = createOxlintRuleHarness(RULE, { filename: "fixture.test.ts" });
+
+const assertTimeoutMessage = (output: string) =>
+ assert.match(output, /project timeout is the ceiling/);
+const assertSkipMessage = (output: string) => assert.match(output, /quarantine: #1234/);
+
+describe(RULE, () => {
+ rule.valid(
+ "allows tests without overrides, conditional skips, and waitFor timeouts",
+ `
+ import { describe, it, vi } from "vitest";
+
+ describe.skipIf(process.env.CI)("suite", () => {
+ it.runIf(true)("runs", async () => {
+ await vi.waitFor(() => {}, { timeout: 10_000 });
+ });
+ it.each([1, 2])("handles %s", (value) => {});
+ });
+ vi.setConfig({ restoreMocks: true });
+ `,
+ );
+
+ rule.valid(
+ "allows a skip with a quarantine issue or a GitHub issue URL",
+ `
+ import { describe, it } from "vitest";
+
+ // quarantine: #1234 flakes on Windows until the pty fix lands
+ it.skip("pending", () => {});
+
+ // https://github.com/pingdotgg/t3code/issues/42
+ describe.only("focused", () => {});
+ `,
+ );
+
+ rule.invalid(
+ "reports a numeric timeout on it.effect",
+ `
+ import { it } from "@effect/vitest";
+ import * as Effect from "effect/Effect";
+
+ it.effect("slow", () => Effect.void, 20_000);
+ `,
+ assertTimeoutMessage,
+ );
+
+ rule.invalid(
+ "reports a timeout through .each and .skipIf chains",
+ `
+ import { it } from "@effect/vitest";
+ import * as Effect from "effect/Effect";
+
+ it.live.skipIf(false)("slow", () => Effect.void, 5_000);
+ it.effect.each([1])("case %s", () => Effect.void, { timeout: 1_000 });
+ `,
+ (output) => {
+ assertTimeoutMessage(output);
+ assert.equal(output.match(/no-test-timeout-or-unreasoned-skip/g)?.length, 2);
+ },
+ );
+
+ rule.invalid(
+ "reports retry options, options-first timeouts, and hook timeouts",
+ `
+ import { beforeAll, describe, it } from "vitest";
+
+ describe("suite", () => {
+ beforeAll(() => {}, 60_000);
+ it("flaky", () => {}, { retry: 3 });
+ it("slow", { timeout: 30_000 }, () => {});
+ });
+ `,
+ (output) => {
+ assertTimeoutMessage(output);
+ assert.equal(output.match(/no-test-timeout-or-unreasoned-skip/g)?.length, 3);
+ },
+ );
+
+ rule.invalid(
+ "reports vi.setConfig timeouts",
+ `
+ import { vi } from "vitest";
+
+ vi.setConfig({ testTimeout: 30_000 });
+ `,
+ assertTimeoutMessage,
+ );
+
+ rule.invalid(
+ "reports a skip whose comment has no issue",
+ `
+ import { it } from "@effect/vitest";
+ import * as Effect from "effect/Effect";
+
+ // flaky, will fix later
+ it.effect.skip("pending", () => Effect.void);
+ `,
+ assertSkipMessage,
+ );
+
+ rule.invalid(
+ "reports todo, only, and the x/f aliases",
+ `
+ import { describe, it, test } from "vitest";
+
+ test.todo("later");
+ describe.only("focused", () => {});
+ xit("disabled", () => {});
+ fdescribe("focused", () => {});
+ `,
+ (output) => {
+ assertSkipMessage(output);
+ assert.equal(output.match(/no-test-timeout-or-unreasoned-skip/g)?.length, 4);
+ },
+ );
+ rule.invalid(
+ "flags an options-object timeout when the callback is a reference",
+ `
+ import { it } from "vitest";
+ const run = async () => {};
+ it("slow", { timeout: 30_000 }, run);
+ `,
+ assertTimeoutMessage,
+ );
+
+ rule.valid(
+ "allows a computed skip option, which is a platform gate like skipIf",
+ `
+ import { it } from "vitest";
+ const windowsHost = process.platform === "win32";
+ it.each([{ name: "a" }])("x $name", { skip: windowsHost }, () => {});
+ `,
+ );
+
+ rule.invalid(
+ "flags the suite alias and option-object skips",
+ `
+ import { suite, test } from "vitest";
+ suite.skip("later", () => {});
+ `,
+ assertSkipMessage,
+ );
+
+ rule.invalid(
+ "flags a skip option without a quarantine issue",
+ `
+ import { test } from "vitest";
+ test("later", { skip: true }, () => {});
+ `,
+ assertSkipMessage,
+ );
+
+ rule.invalid(
+ "flags a bracket-access skip without a quarantine issue",
+ `
+ import { it } from "vitest";
+ it["skip"]("later", () => {});
+ `,
+ assertSkipMessage,
+ );
+});
+
+createOxlintRuleHarness(RULE, { filename: "Provider.live.test.ts" }).invalid(
+ "still flags an option-object skip in a live file",
+ `
+ import { it } from "vitest";
+ it("later", { skip: true }, () => {});
+ `,
+ assertSkipMessage,
+);
+
+createOxlintRuleHarness(RULE, { filename: "Provider.live.test.ts" }).valid(
+ "allows timeouts in opt-in live provider suites",
+ `
+ import { it } from "@effect/vitest";
+ import * as Effect from "effect/Effect";
+
+ it.live("real turn", () => Effect.void, 360_000);
+ `,
+);
+
+createOxlintRuleHarness(RULE).valid(
+ "ignores non-test files",
+ `
+ const it = (_name: string, _fn: () => void, _ms: number) => {};
+ it("x", () => {}, 1_000);
+ `,
+);
diff --git a/oxlint-plugin-t3code/rules/no-test-timeout-or-unreasoned-skip.ts b/oxlint-plugin-t3code/rules/no-test-timeout-or-unreasoned-skip.ts
new file mode 100644
index 00000000000..fe471ce75f3
--- /dev/null
+++ b/oxlint-plugin-t3code/rules/no-test-timeout-or-unreasoned-skip.ts
@@ -0,0 +1,161 @@
+import { defineRule, type ESTree } from "@oxlint/plugins";
+import * as Option from "effect/Option";
+
+import { getPropertyName, unwrapExpression } from "../utils.ts";
+
+const TEST_FILE_PATTERN = /\.(?:test|spec)\.[cm]?[jt]sx?$/u;
+// Opt-in suites that drive real provider agents through whole turns; minutes are the
+// expected cost there, not a hidden wait.
+const LIVE_TEST_FILE_PATTERN = /\.live\.(?:test|spec)\.[cm]?[jt]sx?$/u;
+const TEST_FUNCTIONS = new Set(["describe", "it", "suite", "test"]);
+const HOOK_FUNCTIONS = new Set(["afterAll", "afterEach", "beforeAll", "beforeEach"]);
+const FOCUS_OR_SKIP_MODIFIERS = new Set(["only", "skip", "todo"]);
+const FOCUS_OR_SKIP_FUNCTIONS = new Set(["fdescribe", "fit", "xdescribe", "xit", "xtest"]);
+const TIMEOUT_OPTIONS = new Set(["retry", "timeout"]);
+const SET_CONFIG_OPTIONS = new Set(["hookTimeout", "retry", "testTimeout"]);
+const QUARANTINE_PATTERN =
+ /quarantine:\s*#\d+|https:\/\/github\.com\/[^\s/]+\/[^\s/]+\/issues\/\d+/u;
+
+const TIMEOUT_MESSAGE =
+ "Per-test timeouts and retries hide waits that should be event-driven; the project timeout is the ceiling. Remove the override and await the milestone.";
+const SKIP_MESSAGE =
+ "A skipped test needs a tracking issue in the comment above it: `// quarantine: #1234 <why>`.";
+
+// Walks `it.effect.each(cases)` / `describe.skipIf(x)` / `it.layer(L)` down to the
+// identifier that registers the test.
+const chainRoot = (node: unknown): Option.Option<string> => {
+ const expression = unwrapExpression(node);
+ if (Option.isNone(expression)) return Option.none();
+ const value = expression.value;
+ if (value.type === "Identifier") return Option.some(value.name);
+ if (value.type === "MemberExpression") return chainRoot(value.object);
+ if (value.type === "CallExpression") return chainRoot(value.callee);
+ return Option.none();
+};
+
+const isTestChain = (node: unknown) =>
+ Option.exists(chainRoot(node), (name) => TEST_FUNCTIONS.has(name));
+
+const hasEnabledOption = (node: unknown, names: ReadonlySet<string>) => {
+ const expression = unwrapExpression(node);
+ if (Option.isNone(expression) || expression.value.type !== "ObjectExpression") return false;
+ return expression.value.properties.some(
+ (property) =>
+ property.type === "Property" &&
+ Option.exists(getPropertyName(property.key), (name) => names.has(name)) &&
+ Option.exists(
+ unwrapExpression(property.value),
+ (value) => value.type === "Literal" && value.value === true,
+ ),
+ );
+};
+
+const hasOption = (node: unknown, names: ReadonlySet<string>) => {
+ const expression = unwrapExpression(node);
+ if (Option.isNone(expression) || expression.value.type !== "ObjectExpression") return false;
+ return expression.value.properties.some(
+ (property) =>
+ property.type === "Property" &&
+ Option.exists(getPropertyName(property.key), (name) => names.has(name)),
+ );
+};
+
+const isNumericLiteral = (node: unknown) =>
+ Option.exists(
+ unwrapExpression(node),
+ (expression) => expression.type === "Literal" && typeof expression.value === "number",
+ );
+
+const isStringLiteral = (node: unknown) =>
+ Option.exists(
+ unwrapExpression(node),
+ (expression) => expression.type === "Literal" && typeof expression.value === "string",
+ );
+
+const enclosingStatement = (node: ESTree.Node): ESTree.Node => {
+ let current: ESTree.Node = node;
+ while (current.parent && !/(?:Statement|Declaration)$/u.test(current.type)) {
+ current = current.parent;
+ }
+ return current;
+};
+
+export default defineRule({
+ meta: {
+ type: "problem",
+ docs: {
+ description:
+ "Disallow per-test timeouts and retries, and require a tracking issue for skipped or focused tests.",
+ },
+ },
+ create(context) {
+ if (!TEST_FILE_PATTERN.test(context.filename)) return {};
+ const checkTimeouts = !LIVE_TEST_FILE_PATTERN.test(context.filename);
+
+ const reportUnlessQuarantined = (node: ESTree.Node) => {
+ const comments = context.sourceCode.getCommentsBefore(enclosingStatement(node));
+ if (comments.some((comment) => QUARANTINE_PATTERN.test(comment.value))) return;
+ context.report({ node, message: SKIP_MESSAGE });
+ };
+
+ return {
+ CallExpression(node) {
+ const callee = unwrapExpression(node.callee);
+ if (Option.isNone(callee)) return;
+
+ if (
+ callee.value.type === "MemberExpression" &&
+ Option.exists(chainRoot(callee.value.object), (name) => name === "vi") &&
+ Option.exists(getPropertyName(callee.value.property), (name) => name === "setConfig")
+ ) {
+ if (checkTimeouts && hasOption(node.arguments[0], SET_CONFIG_OPTIONS)) {
+ context.report({ node, message: TIMEOUT_MESSAGE });
+ }
+ return;
+ }
+
+ if (callee.value.type === "Identifier" && HOOK_FUNCTIONS.has(callee.value.name)) {
+ if (checkTimeouts && isNumericLiteral(node.arguments[1])) {
+ context.report({ node, message: TIMEOUT_MESSAGE });
+ }
+ return;
+ }
+
+ if (!isTestChain(callee.value)) return;
+ const [, second, third] = node.arguments;
+ // `test(name, { timeout }, fn)` is the options-first spelling of the same override.
+ if (
+ checkTimeouts &&
+ (isNumericLiteral(third) ||
+ hasOption(third, TIMEOUT_OPTIONS) ||
+ hasOption(second, TIMEOUT_OPTIONS))
+ ) {
+ context.report({ node, message: TIMEOUT_MESSAGE });
+ }
+ // `test(name, { skip: true }, fn)` is the options spelling of `test.skip`. A computed value
+ // such as `{ skip: windowsHost }` is a platform gate, the same as `skipIf`, and stays allowed.
+ if (
+ hasEnabledOption(second, FOCUS_OR_SKIP_MODIFIERS) ||
+ hasEnabledOption(third, FOCUS_OR_SKIP_MODIFIERS)
+ ) {
+ reportUnlessQuarantined(node);
+ }
+ },
+ Identifier(node) {
+ if (!FOCUS_OR_SKIP_FUNCTIONS.has(node.name)) return;
+ const parent = node.parent;
+ if (parent?.type !== "CallExpression" || parent.callee !== node) return;
+ reportUnlessQuarantined(node);
+ },
+ MemberExpression(node) {
+ if (!Option.exists(getPropertyName(node.property), (n) => FOCUS_OR_SKIP_MODIFIERS.has(n))) {
+ return;
+ }
+ // `it["skip"](...)` is the same registration; only a dynamic key is unknowable here.
+ if (node.computed && !isStringLiteral(node.property)) return;
+ if (!isTestChain(node.object)) return;
+ reportUnlessQuarantined(node);
+ },
+ };
+ },
+});
diff --git a/packages/provider-opencode/src/server/v2/OpenCode2Server.test.ts b/packages/provider-opencode/src/server/v2/OpenCode2Server.test.ts
index fd11990db51..d1e9693fb67 100644
--- a/packages/provider-opencode/src/server/v2/OpenCode2Server.test.ts
+++ b/packages/provider-opencode/src/server/v2/OpenCode2Server.test.ts
@@ -177,47 +177,44 @@ server.listen(0, "127.0.0.1", () => {
`;
describe("OpenCode2Server spawned server", () => {
- it.live(
- "is ready once /api/info accepts the generated password",
- () =>
- Effect.gen(function* () {
- const fs = yield* FileSystem.FileSystem;
- const path = yield* Path.Path;
- const platform = yield* HostProcess.Platform;
- const directory = yield* fs.makeTempDirectoryScoped({ prefix: "t3-opencode2-fake-" });
- const isWindows = platform === "win32";
- const binaryPath = path.join(directory, isWindows ? "opencode.cmd" : "opencode");
- const scriptPath = path.join(directory, "opencode.mjs");
- yield* fs.writeFileString(scriptPath, FAKE_SERVER);
- yield* fs.writeFileString(
- binaryPath,
- isWindows
- ? `@echo off\r\n"${yield* HostProcess.ExecutablePath}" "${scriptPath}" %*\r\n`
- : `#!/bin/sh\nexec "${yield* HostProcess.ExecutablePath}" "${scriptPath}" "$@"\n`,
- );
- if (!isWindows) yield* fs.chmod(binaryPath, 0o755);
+ it.live("is ready once /api/info accepts the generated password", () =>
+ Effect.gen(function* () {
+ const fs = yield* FileSystem.FileSystem;
+ const path = yield* Path.Path;
+ const platform = yield* HostProcess.Platform;
+ const directory = yield* fs.makeTempDirectoryScoped({ prefix: "t3-opencode2-fake-" });
+ const isWindows = platform === "win32";
+ const binaryPath = path.join(directory, isWindows ? "opencode.cmd" : "opencode");
+ const scriptPath = path.join(directory, "opencode.mjs");
+ yield* fs.writeFileString(scriptPath, FAKE_SERVER);
+ yield* fs.writeFileString(
+ binaryPath,
+ isWindows
+ ? `@echo off\r\n"${yield* HostProcess.ExecutablePath}" "${scriptPath}" %*\r\n`
+ : `#!/bin/sh\nexec "${yield* HostProcess.ExecutablePath}" "${scriptPath}" "$@"\n`,
+ );
+ if (!isWindows) yield* fs.chmod(binaryPath, 0o755);
- const server = yield* OpenCode2Server.make({
- binaryPath,
- serverUrl: "",
- serverPassword: "",
- directory,
- environment: { ...(yield* HostProcess.Environment), OPENCODE_SERVER_PASSWORD: "ambient" },
- });
- const first = yield* server.withConnection((connection) => Effect.succeed(connection));
- const second = yield* server.withConnection((connection) => Effect.succeed(connection));
- assert.strictEqual(first.version, "2.0.18");
- assert.strictEqual(first.external, false);
- assert.strictEqual(second.client, first.client);
- }).pipe(
- Effect.scoped,
- Effect.provide(
- Layer.mergeAll(
- OpenCode2Client.layer,
- OpenCodeRuntime.layer.pipe(Layer.provide(OpenCodeServerLedger.layerTest)),
- ).pipe(Layer.provideMerge(Layer.mergeAll(NodeServices.layer, FetchHttpClient.layer))),
- ),
+ const server = yield* OpenCode2Server.make({
+ binaryPath,
+ serverUrl: "",
+ serverPassword: "",
+ directory,
+ environment: { ...(yield* HostProcess.Environment), OPENCODE_SERVER_PASSWORD: "ambient" },
+ });
+ const first = yield* server.withConnection((connection) => Effect.succeed(connection));
+ const second = yield* server.withConnection((connection) => Effect.succeed(connection));
+ assert.strictEqual(first.version, "2.0.18");
+ assert.strictEqual(first.external, false);
+ assert.strictEqual(second.client, first.client);
+ }).pipe(
+ Effect.scoped,
+ Effect.provide(
+ Layer.mergeAll(
+ OpenCode2Client.layer,
+ OpenCodeRuntime.layer.pipe(Layer.provide(OpenCodeServerLedger.layerTest)),
+ ).pipe(Layer.provideMerge(Layer.mergeAll(NodeServices.layer, FetchHttpClient.layer))),
),
- 15_000,
+ ),
);
});
diff --git a/vite.config.ts b/vite.config.ts
index b6d286e307f..f93afdbc4e3 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -66,6 +66,25 @@ export default defineConfig({
],
hookTimeout: 60_000,
testTimeout: 60_000,
+ allowOnly: !process.env.CI,
+ // Flaky tests are fixed, not retried.
+ retry: 0,
+ fakeTimers: {
+ toFake: [
+ "setTimeout",
+ "clearTimeout",
+ "setInterval",
+ "clearInterval",
+ "setImmediate",
+ "clearImmediate",
+ "Date",
+ "performance",
+ "requestAnimationFrame",
+ "cancelAnimationFrame",
+ "requestIdleCallback",
+ "cancelIdleCallback",
+ ],
+ },
setupFiles: [
NodeURL.fileURLToPath(
new URL("./packages/shared/src/testing/longTempDir.ts", import.meta.url),
@@ -170,6 +189,7 @@ export default defineConfig({
"t3code/no-native-title-tooltip": "error",
"t3code/no-raw-mcp-registration": "error",
"t3code/no-test-in-loop": "error",
+ "t3code/no-test-timeout-or-unreasoned-skip": "error",
"t3code/no-rpc-permission-bypass": ["error", { allowRawClientAccess: true }],
"t3code/no-unscoped-has": "error",
"t3code/namespace-node-imports": "error",