The best way to control Claude Code, Codex and more from any computer or phone
test(lint): ban per-test timeouts and unreasoned skips (#22560)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Julius Marminge committed
Oct 20, 2026 at 18:05 UTC
b280e7d385fc52edc54a33da4c830452a03dfa13
12 files changed
+756
-394
AGENTS.md
+9
-1
@@ -99,7 +99,15 @@ An empty database is a bad test. Seed your worktree's `.t3` with a copy of real
99
- 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.
100
- **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.
101
- Backend behavior changes ship with focused tests for that behavior.
102
-- 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.
102
+- 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:
103
+ - `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.
104
+ - No `yieldNow` or `sleep` polling loops. Await the `Deferred`, take from the `Queue`, or drain the worker.
105
+ - No per-test timeout argument or `retry`. The project timeout is the ceiling, and flaky tests are fixed, not retried.
106
+ - No `performance.now()` or `Date.now()` deltas. Assert on events and counts, not elapsed time.
107
+ - Browser tests assert through `expect.element` or `vi.waitFor`, never `requestAnimationFrame` or `transitionend`.
108
+ - `vi.mock` factories must not spread a real module that pulls in Shiki or the diff workers.
109
+ - `it.skip` and friends need a tracking issue on the line above: `// quarantine: #1234 <why>`.
110
+ - 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`.
111
- 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.
112
- 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.
113
- 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.
apps/mobile/src/reactCompilerCoverage.test.ts
+1
-1
@@ -145,4 +145,4 @@ describe("React Compiler coverage", () => {
145
it("lists only files that exist", () => {
146
expect(Object.keys(KNOWN_BAILOUTS).filter((file) => !sourceFiles.includes(file))).toEqual([]);
147
});
148
-}, 300_000);
148
+});
apps/server/integration/transferBudgetV2.integration.test.ts
+139
-145
@@ -219,150 +219,144 @@ const synchronized = (queue: Queue.Queue<StreamItem>) =>
219
),
220
);
221
222
-it.live(
223
- "reports V2 thread HTTP and WebSocket transfer budgets",
224
- () =>
225
- Effect.gen(function* () {
226
- const runs: TransferBudgetRun[] = [];
227
- for (const provider of [
228
- ProviderDriverKind.make("codex"),
229
- ProviderDriverKind.make("claudeAgent"),
230
- ]) {
231
- const counter = makeSqlStatementCounter();
232
- const run = yield* Effect.scoped(
233
- Effect.gen(function* () {
234
- const sink = yield* EventSink.EventSinkV2;
235
- const projection = yield* ProjectionStore.ProjectionStoreV2;
236
- yield* sink.write({ events: [threadCreated(provider)] });
237
- for (let index = 0; index < TRANSFER_HISTORY_TURN_COUNT; index++)
238
- yield* sink.write({ events: turnEvents(provider, index, false) });
239
- const context = yield* Effect.context<Layer.Success<typeof layerServices>>();
240
- const server = yield* Layer.build(
241
- HttpRouter.serve(layerRoutes, { disableListenLog: true }).pipe(
242
- Layer.provide(Layer.succeedContext(context)),
243
- Layer.provideMerge(
244
- NodeHttpServer.layer(NodeHttp.createServer, {
245
- host: "127.0.0.1",
246
- port: 0,
247
- websocket: { perMessageDeflate: true },
248
- }),
249
- ),
250
- ),
251
- );
252
- const address = Context.get(server, HttpServer.HttpServer).address;
253
- if (!("port" in address)) return yield* Effect.die("Expected TCP server");
254
- const base = `http://127.0.0.1:${address.port}`;
255
- const threadSnapshot = yield* measureHttpGet({
256
- url: `${base}/api/orchestration/threads/${THREAD_ID}`,
257
- headers: { [ORCHESTRATION_PROTOCOL_HEADER]: String(ORCHESTRATION_PROTOCOL_VERSION) },
258
- });
259
- assert.equal(
260
- threadSnapshot.status,
261
- 200,
262
- Buffer.from(threadSnapshot.decodedBody).toString(),
263
- );
264
- assert.equal(threadSnapshot.contentEncoding, "gzip");
265
- const decodedThread = yield* decodeThreadSnapshot(
266
- Buffer.from(threadSnapshot.decodedBody).toString(),
267
- );
268
- assert.equal(decodedThread.projection.messages.length, TRANSFER_HISTORY_TURN_COUNT * 2);
269
- assert.equal(
270
- decodedThread.projection.turnItems.length,
271
- TRANSFER_HISTORY_TURN_COUNT * 6,
272
- );
273
- assert.notInclude(Buffer.from(threadSnapshot.decodedBody).toString(), "digest=");
274
- const shellSnapshot = yield* measureHttpGet({
275
- url: `${base}/api/orchestration/shell`,
276
- headers: { [ORCHESTRATION_PROTOCOL_HEADER]: String(ORCHESTRATION_PROTOCOL_VERSION) },
277
- });
278
- assert.equal(shellSnapshot.status, 200);
279
- const decodedShell = yield* decodeShellSnapshot(
280
- Buffer.from(shellSnapshot.decodedBody).toString(),
281
- );
282
- assert.equal(decodedShell.threads.length, 1);
283
- const sequence = decodedThread.snapshotSequence;
284
- assert.equal(decodedShell.snapshotSequence, sequence);
285
- const url = `${base.replace("http:", "ws:")}/ws`;
286
- const thread = yield* openMeasuredWsClient({ url, cookie: "" });
287
- const shell = yield* openMeasuredWsClient({ url, cookie: "" });
288
- const second = yield* openMeasuredWsClient({ url, cookie: "" });
289
- assert.include(thread.recorder.negotiatedExtensions(), "permessage-deflate");
290
- const tq = yield* subscribe(thread, "thread", sequence);
291
- const sq = yield* subscribe(shell, "shell", sequence);
292
- const ttq = yield* subscribe(second, "thread", sequence);
293
- const ssq = yield* subscribe(second, "shell", sequence);
294
- for (const queue of [tq, sq, ttq, ssq])
295
- assert.equal(yield* synchronized(queue), "replay");
296
- const threadBefore = thread.recorder.totals();
297
- const shellBefore = shell.recorder.totals();
298
- const secondBefore = second.recorder.totals();
299
- const sqlBefore = counter.count();
300
- const events = turnEvents(provider, TRANSFER_HISTORY_TURN_COUNT, true);
301
- const stored = yield* sink.write({ events });
302
- const last = stored.at(-1)!;
303
- const threadTerminal = (item: StreamItem) =>
304
- "sequence" in item && item.sequence >= last.sequence;
305
- // Shell items carry the shell read when their batch is projected, and unchanged
306
- // shells are skipped, so a turn split across batches may never yield an item at
307
- // the last sequence. Wait for the final shell instead.
308
- const finalShell = yield* projection.getThreadShell(THREAD_ID);
309
- const shellTerminal = (item: StreamItem) =>
310
- item.kind === "thread.updated" && NodeUtil.isDeepStrictEqual(item.thread, finalShell);
311
- for (const queue of [tq, ttq]) yield* collectUntil(queue, threadTerminal);
312
- for (const queue of [sq, ssq]) yield* collectUntil(queue, shellTerminal);
313
- const measuredTurnWebSocket = difference(thread.recorder.totals(), threadBefore);
314
- const measuredTurnShellWebSocket = difference(shell.recorder.totals(), shellBefore);
315
- const measuredTurnSecondClientWebSocket = difference(
316
- second.recorder.totals(),
317
- secondBefore,
318
- );
319
- const measuredTurnSqlStatements = counter.count() - sqlBefore;
320
- const durable = yield* projection.getThreadProjection(THREAD_ID);
321
- assert.isTrue(
322
- durable.turnItems.some(
323
- (item) =>
324
- item.type === "dynamic_tool" && JSON.stringify(item.output).length > 1_000_000,
222
+it.live("reports V2 thread HTTP and WebSocket transfer budgets", () =>
223
+ Effect.gen(function* () {
224
+ const runs: TransferBudgetRun[] = [];
225
+ for (const provider of [
226
+ ProviderDriverKind.make("codex"),
227
+ ProviderDriverKind.make("claudeAgent"),
228
+ ]) {
229
+ const counter = makeSqlStatementCounter();
230
+ const run = yield* Effect.scoped(
231
+ Effect.gen(function* () {
232
+ const sink = yield* EventSink.EventSinkV2;
233
+ const projection = yield* ProjectionStore.ProjectionStoreV2;
234
+ yield* sink.write({ events: [threadCreated(provider)] });
235
+ for (let index = 0; index < TRANSFER_HISTORY_TURN_COUNT; index++)
236
+ yield* sink.write({ events: turnEvents(provider, index, false) });
237
+ const context = yield* Effect.context<Layer.Success<typeof layerServices>>();
238
+ const server = yield* Layer.build(
239
+ HttpRouter.serve(layerRoutes, { disableListenLog: true }).pipe(
240
+ Layer.provide(Layer.succeedContext(context)),
241
+ Layer.provideMerge(
242
+ NodeHttpServer.layer(NodeHttp.createServer, {
243
+ host: "127.0.0.1",
244
+ port: 0,
245
+ websocket: { perMessageDeflate: true },
246
+ }),
247
),
326
- );
327
- yield* second.close;
328
- const reconnectSqlStart = counter.count();
329
- const resumedThread = yield* openMeasuredWsClient({ url, cookie: "" });
330
- const resumedShell = yield* openMeasuredWsClient({ url, cookie: "" });
331
- const rq = yield* subscribe(resumedThread, "thread", sequence);
332
- const rsq = yield* subscribe(resumedShell, "shell", sequence);
333
- const threadMode = yield* synchronized(rq);
334
- const shellMode = yield* synchronized(rsq);
335
- const reconnectThread = { ...resumedThread.recorder.totals(), mode: threadMode };
336
- const reconnectShell = { ...resumedShell.recorder.totals(), mode: shellMode };
337
- assert.equal(threadMode, "snapshot");
338
- return {
339
- provider,
340
- threadSnapshot,
341
- shellSnapshot,
342
- measuredTurnWebSocket,
343
- measuredTurnShellWebSocket,
344
- measuredTurnSecondClientWebSocket,
345
- measuredTurnSqlStatements,
346
- reconnectThread,
347
- reconnectShell,
348
- reconnectSqlStatements: counter.count() - reconnectSqlStart,
349
- } satisfies TransferBudgetRun;
350
- }).pipe(
351
- Effect.provide(Layer.fresh(layerServices).pipe(Layer.provideMerge(NodeServices.layer))),
352
- Effect.withTracer(counter.tracer),
353
- ),
354
- );
355
- runs.push(run);
356
- }
357
- const fs = yield* FileSystem.FileSystem;
358
- const report = formatTransferBudgetReport(runs);
359
- for (const [path, contents] of [
360
- [process.env.T3CODE_TRANSFER_BUDGET_REPORT_PATH, report],
361
- [process.env.T3CODE_TRANSFER_BUDGET_RESULT_PATH, formatTransferBudgetResult(runs)],
362
- ])
363
- if (path && contents) yield* fs.writeFileString(path, contents);
364
- yield* Effect.log(report);
365
- assert.deepEqual(transferBudgetViolations(runs), []);
366
- }).pipe(Effect.provide(NodeServices.layer)),
367
- 30_000,
248
+ ),
249
+ );
250
+ const address = Context.get(server, HttpServer.HttpServer).address;
251
+ if (!("port" in address)) return yield* Effect.die("Expected TCP server");
252
+ const base = `http://127.0.0.1:${address.port}`;
253
+ const threadSnapshot = yield* measureHttpGet({
254
+ url: `${base}/api/orchestration/threads/${THREAD_ID}`,
255
+ headers: { [ORCHESTRATION_PROTOCOL_HEADER]: String(ORCHESTRATION_PROTOCOL_VERSION) },
256
+ });
257
+ assert.equal(
258
+ threadSnapshot.status,
259
+ 200,
260
+ Buffer.from(threadSnapshot.decodedBody).toString(),
261
+ );
262
+ assert.equal(threadSnapshot.contentEncoding, "gzip");
263
+ const decodedThread = yield* decodeThreadSnapshot(
264
+ Buffer.from(threadSnapshot.decodedBody).toString(),
265
+ );
266
+ assert.equal(decodedThread.projection.messages.length, TRANSFER_HISTORY_TURN_COUNT * 2);
267
+ assert.equal(decodedThread.projection.turnItems.length, TRANSFER_HISTORY_TURN_COUNT * 6);
268
+ assert.notInclude(Buffer.from(threadSnapshot.decodedBody).toString(), "digest=");
269
+ const shellSnapshot = yield* measureHttpGet({
270
+ url: `${base}/api/orchestration/shell`,
271
+ headers: { [ORCHESTRATION_PROTOCOL_HEADER]: String(ORCHESTRATION_PROTOCOL_VERSION) },
272
+ });
273
+ assert.equal(shellSnapshot.status, 200);
274
+ const decodedShell = yield* decodeShellSnapshot(
275
+ Buffer.from(shellSnapshot.decodedBody).toString(),
276
+ );
277
+ assert.equal(decodedShell.threads.length, 1);
278
+ const sequence = decodedThread.snapshotSequence;
279
+ assert.equal(decodedShell.snapshotSequence, sequence);
280
+ const url = `${base.replace("http:", "ws:")}/ws`;
281
+ const thread = yield* openMeasuredWsClient({ url, cookie: "" });
282
+ const shell = yield* openMeasuredWsClient({ url, cookie: "" });
283
+ const second = yield* openMeasuredWsClient({ url, cookie: "" });
284
+ assert.include(thread.recorder.negotiatedExtensions(), "permessage-deflate");
285
+ const tq = yield* subscribe(thread, "thread", sequence);
286
+ const sq = yield* subscribe(shell, "shell", sequence);
287
+ const ttq = yield* subscribe(second, "thread", sequence);
288
+ const ssq = yield* subscribe(second, "shell", sequence);
289
+ for (const queue of [tq, sq, ttq, ssq])
290
+ assert.equal(yield* synchronized(queue), "replay");
291
+ const threadBefore = thread.recorder.totals();
292
+ const shellBefore = shell.recorder.totals();
293
+ const secondBefore = second.recorder.totals();
294
+ const sqlBefore = counter.count();
295
+ const events = turnEvents(provider, TRANSFER_HISTORY_TURN_COUNT, true);
296
+ const stored = yield* sink.write({ events });
297
+ const last = stored.at(-1)!;
298
+ const threadTerminal = (item: StreamItem) =>
299
+ "sequence" in item && item.sequence >= last.sequence;
300
+ // Shell items carry the shell read when their batch is projected, and unchanged
301
+ // shells are skipped, so a turn split across batches may never yield an item at
302
+ // the last sequence. Wait for the final shell instead.
303
+ const finalShell = yield* projection.getThreadShell(THREAD_ID);
304
+ const shellTerminal = (item: StreamItem) =>
305
+ item.kind === "thread.updated" && NodeUtil.isDeepStrictEqual(item.thread, finalShell);
306
+ for (const queue of [tq, ttq]) yield* collectUntil(queue, threadTerminal);
307
+ for (const queue of [sq, ssq]) yield* collectUntil(queue, shellTerminal);
308
+ const measuredTurnWebSocket = difference(thread.recorder.totals(), threadBefore);
309
+ const measuredTurnShellWebSocket = difference(shell.recorder.totals(), shellBefore);
310
+ const measuredTurnSecondClientWebSocket = difference(
311
+ second.recorder.totals(),
312
+ secondBefore,
313
+ );
314
+ const measuredTurnSqlStatements = counter.count() - sqlBefore;
315
+ const durable = yield* projection.getThreadProjection(THREAD_ID);
316
+ assert.isTrue(
317
+ durable.turnItems.some(
318
+ (item) =>
319
+ item.type === "dynamic_tool" && JSON.stringify(item.output).length > 1_000_000,
320
+ ),
321
+ );
322
+ yield* second.close;
323
+ const reconnectSqlStart = counter.count();
324
+ const resumedThread = yield* openMeasuredWsClient({ url, cookie: "" });
325
+ const resumedShell = yield* openMeasuredWsClient({ url, cookie: "" });
326
+ const rq = yield* subscribe(resumedThread, "thread", sequence);
327
+ const rsq = yield* subscribe(resumedShell, "shell", sequence);
328
+ const threadMode = yield* synchronized(rq);
329
+ const shellMode = yield* synchronized(rsq);
330
+ const reconnectThread = { ...resumedThread.recorder.totals(), mode: threadMode };
331
+ const reconnectShell = { ...resumedShell.recorder.totals(), mode: shellMode };
332
+ assert.equal(threadMode, "snapshot");
333
+ return {
334
+ provider,
335
+ threadSnapshot,
336
+ shellSnapshot,
337
+ measuredTurnWebSocket,
338
+ measuredTurnShellWebSocket,
339
+ measuredTurnSecondClientWebSocket,
340
+ measuredTurnSqlStatements,
341
+ reconnectThread,
342
+ reconnectShell,
343
+ reconnectSqlStatements: counter.count() - reconnectSqlStart,
344
+ } satisfies TransferBudgetRun;
345
+ }).pipe(
346
+ Effect.provide(Layer.fresh(layerServices).pipe(Layer.provideMerge(NodeServices.layer))),
347
+ Effect.withTracer(counter.tracer),
348
+ ),
349
+ );
350
+ runs.push(run);
351
+ }
352
+ const fs = yield* FileSystem.FileSystem;
353
+ const report = formatTransferBudgetReport(runs);
354
+ for (const [path, contents] of [
355
+ [process.env.T3CODE_TRANSFER_BUDGET_REPORT_PATH, report],
356
+ [process.env.T3CODE_TRANSFER_BUDGET_RESULT_PATH, formatTransferBudgetResult(runs)],
357
+ ])
358
+ if (path && contents) yield* fs.writeFileString(path, contents);
359
+ yield* Effect.log(report);
360
+ assert.deepEqual(transferBudgetViolations(runs), []);
361
+ }).pipe(Effect.provide(NodeServices.layer)),
362
);
apps/server/src/git/GitManager.test.ts
+120
-127
@@ -2005,141 +2005,135 @@ it.layer(layerGitManagerTest)("GitManager", (it) => {
2005
}),
2006
);
2007
2008
- it.effect(
2009
- "status detects cross-repo PRs from the upstream remote URL owner",
2010
- () =>
2011
- Effect.gen(function* () {
2012
- const repoDir = yield* makeTempDir("t3code-git-manager-");
2013
- yield* initRepo(repoDir);
2014
- const forkDir = yield* createBareRemote();
2015
- yield* runGit(repoDir, ["remote", "add", "fork-seed", forkDir]);
2016
- // Origin is the base repository; a lone remote would be the base itself.
2017
- yield* runGit(repoDir, [
2018
- "remote",
2019
- "add",
2020
- "origin",
2021
- "git@github.com:pingdotgg/codething-mvp.git",
2022
- ]);
2023
- yield* runGit(repoDir, ["checkout", "-b", "statemachine"]);
2024
- NodeFS.writeFileSync(NodePath.join(repoDir, "fork-pr.txt"), "fork pr\n");
2025
- yield* runGit(repoDir, ["add", "fork-pr.txt"]);
2026
- yield* runGit(repoDir, ["commit", "-m", "Fork PR branch"]);
2027
- yield* runGit(repoDir, ["push", "-u", "fork-seed", "statemachine"]);
2028
- yield* runGit(repoDir, ["checkout", "-b", "t3code/pr-488/statemachine"]);
2029
- yield* runGit(repoDir, ["branch", "--set-upstream-to", "fork-seed/statemachine"]);
2030
- yield* configureVisibleRemoteUrlWithLocalRewrite(
2031
- repoDir,
2032
- "fork-seed",
2033
- "git@github.com:jasonLaster/codething-mvp.git",
2034
- forkDir,
2035
- );
2008
+ it.effect("status detects cross-repo PRs from the upstream remote URL owner", () =>
2009
+ Effect.gen(function* () {
2010
+ const repoDir = yield* makeTempDir("t3code-git-manager-");
2011
+ yield* initRepo(repoDir);
2012
+ const forkDir = yield* createBareRemote();
2013
+ yield* runGit(repoDir, ["remote", "add", "fork-seed", forkDir]);
2014
+ // Origin is the base repository; a lone remote would be the base itself.
2015
+ yield* runGit(repoDir, [
2016
+ "remote",
2017
+ "add",
2018
+ "origin",
2019
+ "git@github.com:pingdotgg/codething-mvp.git",
2020
+ ]);
2021
+ yield* runGit(repoDir, ["checkout", "-b", "statemachine"]);
2022
+ NodeFS.writeFileSync(NodePath.join(repoDir, "fork-pr.txt"), "fork pr\n");
2023
+ yield* runGit(repoDir, ["add", "fork-pr.txt"]);
2024
+ yield* runGit(repoDir, ["commit", "-m", "Fork PR branch"]);
2025
+ yield* runGit(repoDir, ["push", "-u", "fork-seed", "statemachine"]);
2026
+ yield* runGit(repoDir, ["checkout", "-b", "t3code/pr-488/statemachine"]);
2027
+ yield* runGit(repoDir, ["branch", "--set-upstream-to", "fork-seed/statemachine"]);
2028
+ yield* configureVisibleRemoteUrlWithLocalRewrite(
2029
+ repoDir,
2030
+ "fork-seed",
2031
+ "git@github.com:jasonLaster/codething-mvp.git",
2032
+ forkDir,
2033
+ );
2034
2037
- const { manager, ghCalls } = yield* makeManager({
2038
- ghScenario: {
2039
- prListSequence: [
2040
- JSON.stringify([
2041
- {
2042
- number: 488,
2043
- title: "Rebase this PR on latest main",
2044
- url: "https://github.com/pingdotgg/codething-mvp/pull/488",
2045
- baseRefName: "main",
2046
- headRefName: "statemachine",
2047
- state: "OPEN",
2048
- updatedAt: "2026-03-10T07:00:00Z",
2049
- isCrossRepository: true,
2050
- headRepository: {
2051
- nameWithOwner: "jasonLaster/codething-mvp",
2052
- },
2053
- headRepositoryOwner: {
2054
- login: "jasonLaster",
2055
- },
2035
+ const { manager, ghCalls } = yield* makeManager({
2036
+ ghScenario: {
2037
+ prListSequence: [
2038
+ JSON.stringify([
2039
+ {
2040
+ number: 488,
2041
+ title: "Rebase this PR on latest main",
2042
+ url: "https://github.com/pingdotgg/codething-mvp/pull/488",
2043
+ baseRefName: "main",
2044
+ headRefName: "statemachine",
2045
+ state: "OPEN",
2046
+ updatedAt: "2026-03-10T07:00:00Z",
2047
+ isCrossRepository: true,
2048
+ headRepository: {
2049
+ nameWithOwner: "jasonLaster/codething-mvp",
2050
},
2057
- ]),
2058
- ],
2059
- },
2060
- });
2051
+ headRepositoryOwner: {
2052
+ login: "jasonLaster",
2053
+ },
2054
+ },
2055
+ ]),
2056
+ ],
2057
+ },
2058
+ });
2059
2062
- const status = yield* manager.status({ cwd: repoDir });
2063
- expect(status.refName).toBe("t3code/pr-488/statemachine");
2064
- expect(status.pr).toEqual({
2065
- number: 488,
2066
- title: "Rebase this PR on latest main",
2067
- url: "https://github.com/pingdotgg/codething-mvp/pull/488",
2068
- baseRef: "main",
2069
- headRef: "statemachine",
2070
- state: "open",
2071
- updatedAt: "2026-03-10T07:00:00.000Z",
2072
- });
2073
- expect(ghCalls).toContain(
2074
- "pr list --head statemachine --state all --limit 100 --json number,title,url,baseRefName,headRefName,state,isDraft,mergedAt,closedAt,updatedAt,isCrossRepository,headRepository,headRepositoryOwner",
2075
- );
2076
- }),
2077
- 20_000,
2060
+ const status = yield* manager.status({ cwd: repoDir });
2061
+ expect(status.refName).toBe("t3code/pr-488/statemachine");
2062
+ expect(status.pr).toEqual({
2063
+ number: 488,
2064
+ title: "Rebase this PR on latest main",
2065
+ url: "https://github.com/pingdotgg/codething-mvp/pull/488",
2066
+ baseRef: "main",
2067
+ headRef: "statemachine",
2068
+ state: "open",
2069
+ updatedAt: "2026-03-10T07:00:00.000Z",
2070
+ });
2071
+ expect(ghCalls).toContain(
2072
+ "pr list --head statemachine --state all --limit 100 --json number,title,url,baseRefName,headRefName,state,isDraft,mergedAt,closedAt,updatedAt,isCrossRepository,headRepository,headRepositoryOwner",
2073
+ );
2074
+ }),
2075
);
2076
2080
- it.effect(
2081
- "status preserves a fork PR whose head is named after the default branch",
2082
- () =>
2083
- Effect.gen(function* () {
2084
- const repoDir = yield* makeTempDir("t3code-git-manager-");
2085
- yield* initRepo(repoDir);
2086
- const originDir = yield* createBareRemote();
2087
- const forkDir = yield* createBareRemote();
2088
- yield* runGit(repoDir, ["remote", "add", "origin", originDir]);
2089
- yield* runGit(repoDir, ["push", "-u", "origin", "main"]);
2090
- yield* runGit(repoDir, ["remote", "set-head", "origin", "main"]);
2091
- yield* runGit(repoDir, ["remote", "add", "fork-seed", forkDir]);
2092
- yield* runGit(repoDir, ["push", "fork-seed", "main"]);
2093
- yield* runGit(repoDir, ["checkout", "-b", "t3code/pr-777/main"]);
2094
- yield* runGit(repoDir, ["branch", "--set-upstream-to", "fork-seed/main"]);
2095
- yield* configureVisibleRemoteUrlWithLocalRewrite(
2096
- repoDir,
2097
- "fork-seed",
2098
- "git@github.com:contributor/codething-mvp.git",
2099
- forkDir,
2100
- );
2077
+ it.effect("status preserves a fork PR whose head is named after the default branch", () =>
2078
+ Effect.gen(function* () {
2079
+ const repoDir = yield* makeTempDir("t3code-git-manager-");
2080
+ yield* initRepo(repoDir);
2081
+ const originDir = yield* createBareRemote();
2082
+ const forkDir = yield* createBareRemote();
2083
+ yield* runGit(repoDir, ["remote", "add", "origin", originDir]);
2084
+ yield* runGit(repoDir, ["push", "-u", "origin", "main"]);
2085
+ yield* runGit(repoDir, ["remote", "set-head", "origin", "main"]);
2086
+ yield* runGit(repoDir, ["remote", "add", "fork-seed", forkDir]);
2087
+ yield* runGit(repoDir, ["push", "fork-seed", "main"]);
2088
+ yield* runGit(repoDir, ["checkout", "-b", "t3code/pr-777/main"]);
2089
+ yield* runGit(repoDir, ["branch", "--set-upstream-to", "fork-seed/main"]);
2090
+ yield* configureVisibleRemoteUrlWithLocalRewrite(
2091
+ repoDir,
2092
+ "fork-seed",
2093
+ "git@github.com:contributor/codething-mvp.git",
2094
+ forkDir,
2095
+ );
2096
2102
- const { manager, ghCalls } = yield* makeManager({
2103
- ghScenario: {
2104
- prListByHeadSelector: {
2105
- main: JSON.stringify([
2106
- {
2107
- number: 777,
2108
- title: "Fork PR from main",
2109
- url: "https://github.com/pingdotgg/codething-mvp/pull/777",
2110
- baseRefName: "main",
2111
- headRefName: "main",
2112
- state: "OPEN",
2113
- updatedAt: "2026-03-10T07:00:00Z",
2114
- isCrossRepository: true,
2115
- headRepository: {
2116
- nameWithOwner: "contributor/codething-mvp",
2117
- },
2118
- headRepositoryOwner: {
2119
- login: "contributor",
2120
- },
2097
+ const { manager, ghCalls } = yield* makeManager({
2098
+ ghScenario: {
2099
+ prListByHeadSelector: {
2100
+ main: JSON.stringify([
2101
+ {
2102
+ number: 777,
2103
+ title: "Fork PR from main",
2104
+ url: "https://github.com/pingdotgg/codething-mvp/pull/777",
2105
+ baseRefName: "main",
2106
+ headRefName: "main",
2107
+ state: "OPEN",
2108
+ updatedAt: "2026-03-10T07:00:00Z",
2109
+ isCrossRepository: true,
2110
+ headRepository: {
2111
+ nameWithOwner: "contributor/codething-mvp",
2112
},
2122
- ]),
2123
- },
2113
+ headRepositoryOwner: {
2114
+ login: "contributor",
2115
+ },
2116
+ },
2117
+ ]),
2118
},
2125
- });
2119
+ },
2120
+ });
2121
2127
- const status = yield* manager.status({ cwd: repoDir });
2128
- expect(status.refName).toBe("t3code/pr-777/main");
2129
- expect(status.pr).toEqual({
2130
- number: 777,
2131
- title: "Fork PR from main",
2132
- url: "https://github.com/pingdotgg/codething-mvp/pull/777",
2133
- baseRef: "main",
2134
- headRef: "main",
2135
- state: "open",
2136
- updatedAt: "2026-03-10T07:00:00.000Z",
2137
- });
2138
- expect(ghCalls).toContain(
2139
- "pr list --head main --state all --limit 100 --json number,title,url,baseRefName,headRefName,state,isDraft,mergedAt,closedAt,updatedAt,isCrossRepository,headRepository,headRepositoryOwner",
2140
- );
2141
- }),
2142
- 20_000,
2122
+ const status = yield* manager.status({ cwd: repoDir });
2123
+ expect(status.refName).toBe("t3code/pr-777/main");
2124
+ expect(status.pr).toEqual({
2125
+ number: 777,
2126
+ title: "Fork PR from main",
2127
+ url: "https://github.com/pingdotgg/codething-mvp/pull/777",
2128
+ baseRef: "main",
2129
+ headRef: "main",
2130
+ state: "open",
2131
+ updatedAt: "2026-03-10T07:00:00.000Z",
2132
+ });
2133
+ expect(ghCalls).toContain(
2134
+ "pr list --head main --state all --limit 100 --json number,title,url,baseRefName,headRefName,state,isDraft,mergedAt,closedAt,updatedAt,isCrossRepository,headRepository,headRepositoryOwner",
2135
+ );
2136
+ }),
2137
);
2138
2139
it.effect(
@@ -2226,7 +2220,6 @@ it.layer(layerGitManagerTest)("GitManager", (it) => {
2220
),
2221
).toBe(false);
2222
}),
2229
- 20_000,
2223
);
2224
2225
it.effect("status hides merged PRs on the default branch", () =>
apps/server/src/htmlRender/HtmlRender.test.ts
+72
-78
@@ -287,89 +287,83 @@ describe("HtmlRender", () => {
287
}),
288
);
289
290
- it.live(
291
- "keeps every local file but the page itself out of the browser",
292
- (ctx) =>
293
- Effect.gen(function* () {
294
- const executable = (yield* HostProcess.Environment)[TEST_BROWSER_ENV];
295
- if (!executable) return ctx.skip(`Set ${TEST_BROWSER_ENV} to run this test.`);
296
- yield* Effect.gen(function* () {
297
- const fileSystem = yield* FileSystem.FileSystem;
298
- const path = yield* Path.Path;
299
- const htmlRender = yield* HtmlRender.HtmlRender;
300
- const directory = yield* fileSystem.makeTempDirectoryScoped({ prefix: "t3-html-files-" });
301
- const secret = path.join(directory, "secret.js");
302
- yield* fileSystem.writeFileString(secret, 'window.secret = "abc123";');
303
- const secretUrl = NodeURL.pathToFileURL(secret).href;
290
+ it.live("keeps every local file but the page itself out of the browser", (ctx) =>
291
+ Effect.gen(function* () {
292
+ const executable = (yield* HostProcess.Environment)[TEST_BROWSER_ENV];
293
+ if (!executable) return ctx.skip(`Set ${TEST_BROWSER_ENV} to run this test.`);
294
+ yield* Effect.gen(function* () {
295
+ const fileSystem = yield* FileSystem.FileSystem;
296
+ const path = yield* Path.Path;
297
+ const htmlRender = yield* HtmlRender.HtmlRender;
298
+ const directory = yield* fileSystem.makeTempDirectoryScoped({ prefix: "t3-html-files-" });
299
+ const secret = path.join(directory, "secret.js");
300
+ yield* fileSystem.writeFileString(secret, 'window.secret = "abc123";');
301
+ const secretUrl = NodeURL.pathToFileURL(secret).href;
302
305
- const preview = yield* htmlRender.preview({
306
- html: [
307
- `<script src="${secretUrl}"></script>`,
308
- `<iframe src="${secretUrl}" onload="console.log('frame loaded')"></iframe>`,
309
- '<script>addEventListener("load", () => console.log("secret:", window.secret ?? "none"));</script>',
310
- ].join(""),
311
- });
303
+ const preview = yield* htmlRender.preview({
304
+ html: [
305
+ `<script src="${secretUrl}"></script>`,
306
+ `<iframe src="${secretUrl}" onload="console.log('frame loaded')"></iframe>`,
307
+ '<script>addEventListener("load", () => console.log("secret:", window.secret ?? "none"));</script>',
308
+ ].join(""),
309
+ });
310
313
- const texts = preview.consoleMessages.map((message) => message.text);
314
- expect(texts).toContain("secret: none");
315
- expect(texts.join(" ")).not.toContain("abc123");
316
- }).pipe(Effect.scoped, Effect.provide(layerHtmlRender(executable)));
317
- }),
318
- 30_000,
311
+ const texts = preview.consoleMessages.map((message) => message.text);
312
+ expect(texts).toContain("secret: none");
313
+ expect(texts.join(" ")).not.toContain("abc123");
314
+ }).pipe(Effect.scoped, Effect.provide(layerHtmlRender(executable)));
315
+ }),
316
);
317
321
- it.live(
322
- "keeps the page off this machine's local network",
323
- (ctx) =>
324
- Effect.gen(function* () {
325
- const executable = (yield* HostProcess.Environment)[TEST_BROWSER_ENV];
326
- if (!executable) return ctx.skip(`Set ${TEST_BROWSER_ENV} to run this test.`);
327
- const requests: Array<string> = [];
328
- const server = yield* Effect.acquireRelease(
329
- Effect.callback<NodeHttp.Server>((resume) => {
330
- const listening = NodeHttp.createServer((request, response) => {
331
- requests.push(`${request.url} ${request.headers["sec-purpose"] ?? ""}`);
332
- response.end("<p>LOCAL</p>");
333
- });
334
- listening.listen(0, "127.0.0.1", () => resume(Effect.succeed(listening)));
318
+ it.live("keeps the page off this machine's local network", (ctx) =>
319
+ Effect.gen(function* () {
320
+ const executable = (yield* HostProcess.Environment)[TEST_BROWSER_ENV];
321
+ if (!executable) return ctx.skip(`Set ${TEST_BROWSER_ENV} to run this test.`);
322
+ const requests: Array<string> = [];
323
+ const server = yield* Effect.acquireRelease(
324
+ Effect.callback<NodeHttp.Server>((resume) => {
325
+ const listening = NodeHttp.createServer((request, response) => {
326
+ requests.push(`${request.url} ${request.headers["sec-purpose"] ?? ""}`);
327
+ response.end("<p>LOCAL</p>");
328
+ });
329
+ listening.listen(0, "127.0.0.1", () => resume(Effect.succeed(listening)));
330
+ }),
331
+ (listening) =>
332
+ Effect.callback<void>((resume) => {
333
+ listening.close(() => resume(Effect.void));
334
}),
336
- (listening) =>
337
- Effect.callback<void>((resume) => {
338
- listening.close(() => resume(Effect.void));
339
- }),
340
- );
341
- const datagrams: Array<string> = [];
342
- const udp = yield* Effect.acquireRelease(
343
- Effect.callback<NodeDgram.Socket>((resume) => {
344
- const socket = NodeDgram.createSocket("udp4");
345
- socket.on("message", (message) => datagrams.push(message.toString("hex")));
346
- socket.bind(0, "127.0.0.1", () => resume(Effect.succeed(socket)));
335
+ );
336
+ const datagrams: Array<string> = [];
337
+ const udp = yield* Effect.acquireRelease(
338
+ Effect.callback<NodeDgram.Socket>((resume) => {
339
+ const socket = NodeDgram.createSocket("udp4");
340
+ socket.on("message", (message) => datagrams.push(message.toString("hex")));
341
+ socket.bind(0, "127.0.0.1", () => resume(Effect.succeed(socket)));
342
+ }),
343
+ (socket) =>
344
+ Effect.callback<void>((resume) => {
345
+ socket.close(() => resume(Effect.void));
346
}),
348
- (socket) =>
349
- Effect.callback<void>((resume) => {
350
- socket.close(() => resume(Effect.void));
351
- }),
352
- );
353
- const address = server.address();
354
- const origin = `http://127.0.0.1:${typeof address === "object" && address ? address.port : 0}`;
355
- const stun = `stun:127.0.0.1:${udp.address().port}`;
356
- yield* Effect.gen(function* () {
357
- const htmlRender = yield* HtmlRender.HtmlRender;
358
- yield* htmlRender.preview({
359
- html: [
360
- `<img src="${origin}/x.png"><iframe src="${origin}/"></iframe>`,
361
- `<script type="speculationrules">{"prefetch":[{"source":"list","urls":["${origin}/prefetch"]}]}</script>`,
362
- `<script>fetch("${origin}/").catch(() => {}); new WebSocket("ws${origin.slice(4)}/socket");`,
363
- `try { const peer = new RTCPeerConnection({ iceServers: [{ urls: "${stun}" }] });`,
364
- `peer.createDataChannel("x"); peer.createOffer().then((offer) => peer.setLocalDescription(offer));`,
365
- `} catch {}`,
366
- `window.open("${origin}/popup"); location.href = "${origin}/navigate";</script>`,
367
- ].join(""),
368
- });
369
- }).pipe(Effect.provide(layerHtmlRender(executable)));
370
- expect(requests).toEqual([]);
371
- expect(datagrams).toEqual([]);
372
- }).pipe(Effect.scoped),
373
- 30_000,
347
+ );
348
+ const address = server.address();
349
+ const origin = `http://127.0.0.1:${typeof address === "object" && address ? address.port : 0}`;
350
+ const stun = `stun:127.0.0.1:${udp.address().port}`;
351
+ yield* Effect.gen(function* () {
352
+ const htmlRender = yield* HtmlRender.HtmlRender;
353
+ yield* htmlRender.preview({
354
+ html: [
355
+ `<img src="${origin}/x.png"><iframe src="${origin}/"></iframe>`,
356
+ `<script type="speculationrules">{"prefetch":[{"source":"list","urls":["${origin}/prefetch"]}]}</script>`,
357
+ `<script>fetch("${origin}/").catch(() => {}); new WebSocket("ws${origin.slice(4)}/socket");`,
358
+ `try { const peer = new RTCPeerConnection({ iceServers: [{ urls: "${stun}" }] });`,
359
+ `peer.createDataChannel("x"); peer.createOffer().then((offer) => peer.setLocalDescription(offer));`,
360
+ `} catch {}`,
361
+ `window.open("${origin}/popup"); location.href = "${origin}/navigate";</script>`,
362
+ ].join(""),
363
+ });
364
+ }).pipe(Effect.provide(layerHtmlRender(executable)));
365
+ expect(requests).toEqual([]);
366
+ expect(datagrams).toEqual([]);
367
+ }).pipe(Effect.scoped),
368
);
369
});
apps/server/src/httpResponseErrorGuard.test.ts
+1
-1
@@ -163,5 +163,5 @@ describe("rejectRequestsUntilServing", () => {
163
expect(servingUpgrade.statusCode).toBe(101);
164
expect(servingUpgrade.headers["retry-after"]).toBeUndefined();
165
expect(writeErrors).toEqual([]);
166
- }, 5_000);
166
+ });
167
});
apps/web/src/reactCompilerCoverage.test.ts
+1
-1
@@ -30,4 +30,4 @@ describe("React Compiler coverage", () => {
30
const bailouts = result.errors.map((error) => error.codeframe ?? error.message);
31
expect(bailouts).toEqual([]);
32
});
33
-}, 120_000);
33
+});
oxlint-plugin-t3code/index.ts
+2
@@ -16,6 +16,7 @@ import noOutsetStateIndicators from "./rules/no-outset-state-indicators.ts";
16
import noRawMcpRegistration from "./rules/no-raw-mcp-registration.ts";
17
import noRawResizeObserver from "./rules/no-raw-resize-observer.ts";
18
import noTestInLoop from "./rules/no-test-in-loop.ts";
19
+import noTestTimeoutOrUnreasonedSkip from "./rules/no-test-timeout-or-unreasoned-skip.ts";
20
import noRpcPermissionBypass from "./rules/no-rpc-permission-bypass.ts";
21
import noUnscopedHas from "./rules/no-unscoped-has.ts";
22
import preferCatchTags from "./rules/prefer-catch-tags.ts";
@@ -45,6 +46,7 @@ export default definePlugin({
46
"no-raw-mcp-registration": noRawMcpRegistration,
47
"no-raw-resize-observer": noRawResizeObserver,
48
"no-test-in-loop": noTestInLoop,
49
+ "no-test-timeout-or-unreasoned-skip": noTestTimeoutOrUnreasonedSkip,
50
"no-rpc-permission-bypass": noRpcPermissionBypass,
51
"no-unscoped-has": noUnscopedHas,
52
"prefer-catch-tags": preferCatchTags,
oxlint-plugin-t3code/rules/no-test-timeout-or-unreasoned-skip.test.ts
new
+193
@@ -0,0 +1,193 @@
1
+import { assert, describe } from "@effect/vitest";
2
+
3
+import { createOxlintRuleHarness } from "../test/utils.ts";
4
+
5
+const RULE = "t3code/no-test-timeout-or-unreasoned-skip";
6
+const rule = createOxlintRuleHarness(RULE, { filename: "fixture.test.ts" });
7
+
8
+const assertTimeoutMessage = (output: string) =>
9
+ assert.match(output, /project timeout is the ceiling/);
10
+const assertSkipMessage = (output: string) => assert.match(output, /quarantine: #1234/);
11
+
12
+describe(RULE, () => {
13
+ rule.valid(
14
+ "allows tests without overrides, conditional skips, and waitFor timeouts",
15
+ `
16
+ import { describe, it, vi } from "vitest";
17
+
18
+ describe.skipIf(process.env.CI)("suite", () => {
19
+ it.runIf(true)("runs", async () => {
20
+ await vi.waitFor(() => {}, { timeout: 10_000 });
21
+ });
22
+ it.each([1, 2])("handles %s", (value) => {});
23
+ });
24
+ vi.setConfig({ restoreMocks: true });
25
+ `,
26
+ );
27
+
28
+ rule.valid(
29
+ "allows a skip with a quarantine issue or a GitHub issue URL",
30
+ `
31
+ import { describe, it } from "vitest";
32
+
33
+ // quarantine: #1234 flakes on Windows until the pty fix lands
34
+ it.skip("pending", () => {});
35
+
36
+ // https://github.com/pingdotgg/t3code/issues/42
37
+ describe.only("focused", () => {});
38
+ `,
39
+ );
40
+
41
+ rule.invalid(
42
+ "reports a numeric timeout on it.effect",
43
+ `
44
+ import { it } from "@effect/vitest";
45
+ import * as Effect from "effect/Effect";
46
+
47
+ it.effect("slow", () => Effect.void, 20_000);
48
+ `,
49
+ assertTimeoutMessage,
50
+ );
51
+
52
+ rule.invalid(
53
+ "reports a timeout through .each and .skipIf chains",
54
+ `
55
+ import { it } from "@effect/vitest";
56
+ import * as Effect from "effect/Effect";
57
+
58
+ it.live.skipIf(false)("slow", () => Effect.void, 5_000);
59
+ it.effect.each([1])("case %s", () => Effect.void, { timeout: 1_000 });
60
+ `,
61
+ (output) => {
62
+ assertTimeoutMessage(output);
63
+ assert.equal(output.match(/no-test-timeout-or-unreasoned-skip/g)?.length, 2);
64
+ },
65
+ );
66
+
67
+ rule.invalid(
68
+ "reports retry options, options-first timeouts, and hook timeouts",
69
+ `
70
+ import { beforeAll, describe, it } from "vitest";
71
+
72
+ describe("suite", () => {
73
+ beforeAll(() => {}, 60_000);
74
+ it("flaky", () => {}, { retry: 3 });
75
+ it("slow", { timeout: 30_000 }, () => {});
76
+ });
77
+ `,
78
+ (output) => {
79
+ assertTimeoutMessage(output);
80
+ assert.equal(output.match(/no-test-timeout-or-unreasoned-skip/g)?.length, 3);
81
+ },
82
+ );
83
+
84
+ rule.invalid(
85
+ "reports vi.setConfig timeouts",
86
+ `
87
+ import { vi } from "vitest";
88
+
89
+ vi.setConfig({ testTimeout: 30_000 });
90
+ `,
91
+ assertTimeoutMessage,
92
+ );
93
+
94
+ rule.invalid(
95
+ "reports a skip whose comment has no issue",
96
+ `
97
+ import { it } from "@effect/vitest";
98
+ import * as Effect from "effect/Effect";
99
+
100
+ // flaky, will fix later
101
+ it.effect.skip("pending", () => Effect.void);
102
+ `,
103
+ assertSkipMessage,
104
+ );
105
+
106
+ rule.invalid(
107
+ "reports todo, only, and the x/f aliases",
108
+ `
109
+ import { describe, it, test } from "vitest";
110
+
111
+ test.todo("later");
112
+ describe.only("focused", () => {});
113
+ xit("disabled", () => {});
114
+ fdescribe("focused", () => {});
115
+ `,
116
+ (output) => {
117
+ assertSkipMessage(output);
118
+ assert.equal(output.match(/no-test-timeout-or-unreasoned-skip/g)?.length, 4);
119
+ },
120
+ );
121
+ rule.invalid(
122
+ "flags an options-object timeout when the callback is a reference",
123
+ `
124
+ import { it } from "vitest";
125
+ const run = async () => {};
126
+ it("slow", { timeout: 30_000 }, run);
127
+ `,
128
+ assertTimeoutMessage,
129
+ );
130
+
131
+ rule.valid(
132
+ "allows a computed skip option, which is a platform gate like skipIf",
133
+ `
134
+ import { it } from "vitest";
135
+ const windowsHost = process.platform === "win32";
136
+ it.each([{ name: "a" }])("x $name", { skip: windowsHost }, () => {});
137
+ `,
138
+ );
139
+
140
+ rule.invalid(
141
+ "flags the suite alias and option-object skips",
142
+ `
143
+ import { suite, test } from "vitest";
144
+ suite.skip("later", () => {});
145
+ `,
146
+ assertSkipMessage,
147
+ );
148
+
149
+ rule.invalid(
150
+ "flags a skip option without a quarantine issue",
151
+ `
152
+ import { test } from "vitest";
153
+ test("later", { skip: true }, () => {});
154
+ `,
155
+ assertSkipMessage,
156
+ );
157
+
158
+ rule.invalid(
159
+ "flags a bracket-access skip without a quarantine issue",
160
+ `
161
+ import { it } from "vitest";
162
+ it["skip"]("later", () => {});
163
+ `,
164
+ assertSkipMessage,
165
+ );
166
+});
167
+
168
+createOxlintRuleHarness(RULE, { filename: "Provider.live.test.ts" }).invalid(
169
+ "still flags an option-object skip in a live file",
170
+ `
171
+ import { it } from "vitest";
172
+ it("later", { skip: true }, () => {});
173
+ `,
174
+ assertSkipMessage,
175
+);
176
+
177
+createOxlintRuleHarness(RULE, { filename: "Provider.live.test.ts" }).valid(
178
+ "allows timeouts in opt-in live provider suites",
179
+ `
180
+ import { it } from "@effect/vitest";
181
+ import * as Effect from "effect/Effect";
182
+
183
+ it.live("real turn", () => Effect.void, 360_000);
184
+ `,
185
+);
186
+
187
+createOxlintRuleHarness(RULE).valid(
188
+ "ignores non-test files",
189
+ `
190
+ const it = (_name: string, _fn: () => void, _ms: number) => {};
191
+ it("x", () => {}, 1_000);
192
+ `,
193
+);
oxlint-plugin-t3code/rules/no-test-timeout-or-unreasoned-skip.ts
new
+161
@@ -0,0 +1,161 @@
1
+import { defineRule, type ESTree } from "@oxlint/plugins";
2
+import * as Option from "effect/Option";
3
+
4
+import { getPropertyName, unwrapExpression } from "../utils.ts";
5
+
6
+const TEST_FILE_PATTERN = /\.(?:test|spec)\.[cm]?[jt]sx?$/u;
7
+// Opt-in suites that drive real provider agents through whole turns; minutes are the
8
+// expected cost there, not a hidden wait.
9
+const LIVE_TEST_FILE_PATTERN = /\.live\.(?:test|spec)\.[cm]?[jt]sx?$/u;
10
+const TEST_FUNCTIONS = new Set(["describe", "it", "suite", "test"]);
11
+const HOOK_FUNCTIONS = new Set(["afterAll", "afterEach", "beforeAll", "beforeEach"]);
12
+const FOCUS_OR_SKIP_MODIFIERS = new Set(["only", "skip", "todo"]);
13
+const FOCUS_OR_SKIP_FUNCTIONS = new Set(["fdescribe", "fit", "xdescribe", "xit", "xtest"]);
14
+const TIMEOUT_OPTIONS = new Set(["retry", "timeout"]);
15
+const SET_CONFIG_OPTIONS = new Set(["hookTimeout", "retry", "testTimeout"]);
16
+const QUARANTINE_PATTERN =
17
+ /quarantine:\s*#\d+|https:\/\/github\.com\/[^\s/]+\/[^\s/]+\/issues\/\d+/u;
18
+
19
+const TIMEOUT_MESSAGE =
20
+ "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.";
21
+const SKIP_MESSAGE =
22
+ "A skipped test needs a tracking issue in the comment above it: `// quarantine: #1234 <why>`.";
23
+
24
+// Walks `it.effect.each(cases)` / `describe.skipIf(x)` / `it.layer(L)` down to the
25
+// identifier that registers the test.
26
+const chainRoot = (node: unknown): Option.Option<string> => {
27
+ const expression = unwrapExpression(node);
28
+ if (Option.isNone(expression)) return Option.none();
29
+ const value = expression.value;
30
+ if (value.type === "Identifier") return Option.some(value.name);
31
+ if (value.type === "MemberExpression") return chainRoot(value.object);
32
+ if (value.type === "CallExpression") return chainRoot(value.callee);
33
+ return Option.none();
34
+};
35
+
36
+const isTestChain = (node: unknown) =>
37
+ Option.exists(chainRoot(node), (name) => TEST_FUNCTIONS.has(name));
38
+
39
+const hasEnabledOption = (node: unknown, names: ReadonlySet<string>) => {
40
+ const expression = unwrapExpression(node);
41
+ if (Option.isNone(expression) || expression.value.type !== "ObjectExpression") return false;
42
+ return expression.value.properties.some(
43
+ (property) =>
44
+ property.type === "Property" &&
45
+ Option.exists(getPropertyName(property.key), (name) => names.has(name)) &&
46
+ Option.exists(
47
+ unwrapExpression(property.value),
48
+ (value) => value.type === "Literal" && value.value === true,
49
+ ),
50
+ );
51
+};
52
+
53
+const hasOption = (node: unknown, names: ReadonlySet<string>) => {
54
+ const expression = unwrapExpression(node);
55
+ if (Option.isNone(expression) || expression.value.type !== "ObjectExpression") return false;
56
+ return expression.value.properties.some(
57
+ (property) =>
58
+ property.type === "Property" &&
59
+ Option.exists(getPropertyName(property.key), (name) => names.has(name)),
60
+ );
61
+};
62
+
63
+const isNumericLiteral = (node: unknown) =>
64
+ Option.exists(
65
+ unwrapExpression(node),
66
+ (expression) => expression.type === "Literal" && typeof expression.value === "number",
67
+ );
68
+
69
+const isStringLiteral = (node: unknown) =>
70
+ Option.exists(
71
+ unwrapExpression(node),
72
+ (expression) => expression.type === "Literal" && typeof expression.value === "string",
73
+ );
74
+
75
+const enclosingStatement = (node: ESTree.Node): ESTree.Node => {
76
+ let current: ESTree.Node = node;
77
+ while (current.parent && !/(?:Statement|Declaration)$/u.test(current.type)) {
78
+ current = current.parent;
79
+ }
80
+ return current;
81
+};
82
+
83
+export default defineRule({
84
+ meta: {
85
+ type: "problem",
86
+ docs: {
87
+ description:
88
+ "Disallow per-test timeouts and retries, and require a tracking issue for skipped or focused tests.",
89
+ },
90
+ },
91
+ create(context) {
92
+ if (!TEST_FILE_PATTERN.test(context.filename)) return {};
93
+ const checkTimeouts = !LIVE_TEST_FILE_PATTERN.test(context.filename);
94
+
95
+ const reportUnlessQuarantined = (node: ESTree.Node) => {
96
+ const comments = context.sourceCode.getCommentsBefore(enclosingStatement(node));
97
+ if (comments.some((comment) => QUARANTINE_PATTERN.test(comment.value))) return;
98
+ context.report({ node, message: SKIP_MESSAGE });
99
+ };
100
+
101
+ return {
102
+ CallExpression(node) {
103
+ const callee = unwrapExpression(node.callee);
104
+ if (Option.isNone(callee)) return;
105
+
106
+ if (
107
+ callee.value.type === "MemberExpression" &&
108
+ Option.exists(chainRoot(callee.value.object), (name) => name === "vi") &&
109
+ Option.exists(getPropertyName(callee.value.property), (name) => name === "setConfig")
110
+ ) {
111
+ if (checkTimeouts && hasOption(node.arguments[0], SET_CONFIG_OPTIONS)) {
112
+ context.report({ node, message: TIMEOUT_MESSAGE });
113
+ }
114
+ return;
115
+ }
116
+
117
+ if (callee.value.type === "Identifier" && HOOK_FUNCTIONS.has(callee.value.name)) {
118
+ if (checkTimeouts && isNumericLiteral(node.arguments[1])) {
119
+ context.report({ node, message: TIMEOUT_MESSAGE });
120
+ }
121
+ return;
122
+ }
123
+
124
+ if (!isTestChain(callee.value)) return;
125
+ const [, second, third] = node.arguments;
126
+ // `test(name, { timeout }, fn)` is the options-first spelling of the same override.
127
+ if (
128
+ checkTimeouts &&
129
+ (isNumericLiteral(third) ||
130
+ hasOption(third, TIMEOUT_OPTIONS) ||
131
+ hasOption(second, TIMEOUT_OPTIONS))
132
+ ) {
133
+ context.report({ node, message: TIMEOUT_MESSAGE });
134
+ }
135
+ // `test(name, { skip: true }, fn)` is the options spelling of `test.skip`. A computed value
136
+ // such as `{ skip: windowsHost }` is a platform gate, the same as `skipIf`, and stays allowed.
137
+ if (
138
+ hasEnabledOption(second, FOCUS_OR_SKIP_MODIFIERS) ||
139
+ hasEnabledOption(third, FOCUS_OR_SKIP_MODIFIERS)
140
+ ) {
141
+ reportUnlessQuarantined(node);
142
+ }
143
+ },
144
+ Identifier(node) {
145
+ if (!FOCUS_OR_SKIP_FUNCTIONS.has(node.name)) return;
146
+ const parent = node.parent;
147
+ if (parent?.type !== "CallExpression" || parent.callee !== node) return;
148
+ reportUnlessQuarantined(node);
149
+ },
150
+ MemberExpression(node) {
151
+ if (!Option.exists(getPropertyName(node.property), (n) => FOCUS_OR_SKIP_MODIFIERS.has(n))) {
152
+ return;
153
+ }
154
+ // `it["skip"](...)` is the same registration; only a dynamic key is unknowable here.
155
+ if (node.computed && !isStringLiteral(node.property)) return;
156
+ if (!isTestChain(node.object)) return;
157
+ reportUnlessQuarantined(node);
158
+ },
159
+ };
160
+ },
161
+});
packages/provider-opencode/src/server/v2/OpenCode2Server.test.ts
+37
-40
@@ -177,47 +177,44 @@ server.listen(0, "127.0.0.1", () => {
177
`;
178
179
describe("OpenCode2Server spawned server", () => {
180
- it.live(
181
- "is ready once /api/info accepts the generated password",
182
- () =>
183
- Effect.gen(function* () {
184
- const fs = yield* FileSystem.FileSystem;
185
- const path = yield* Path.Path;
186
- const platform = yield* HostProcess.Platform;
187
- const directory = yield* fs.makeTempDirectoryScoped({ prefix: "t3-opencode2-fake-" });
188
- const isWindows = platform === "win32";
189
- const binaryPath = path.join(directory, isWindows ? "opencode.cmd" : "opencode");
190
- const scriptPath = path.join(directory, "opencode.mjs");
191
- yield* fs.writeFileString(scriptPath, FAKE_SERVER);
192
- yield* fs.writeFileString(
193
- binaryPath,
194
- isWindows
195
- ? `@echo off\r\n"${yield* HostProcess.ExecutablePath}" "${scriptPath}" %*\r\n`
196
- : `#!/bin/sh\nexec "${yield* HostProcess.ExecutablePath}" "${scriptPath}" "$@"\n`,
197
- );
198
- if (!isWindows) yield* fs.chmod(binaryPath, 0o755);
180
+ it.live("is ready once /api/info accepts the generated password", () =>
181
+ Effect.gen(function* () {
182
+ const fs = yield* FileSystem.FileSystem;
183
+ const path = yield* Path.Path;
184
+ const platform = yield* HostProcess.Platform;
185
+ const directory = yield* fs.makeTempDirectoryScoped({ prefix: "t3-opencode2-fake-" });
186
+ const isWindows = platform === "win32";
187
+ const binaryPath = path.join(directory, isWindows ? "opencode.cmd" : "opencode");
188
+ const scriptPath = path.join(directory, "opencode.mjs");
189
+ yield* fs.writeFileString(scriptPath, FAKE_SERVER);
190
+ yield* fs.writeFileString(
191
+ binaryPath,
192
+ isWindows
193
+ ? `@echo off\r\n"${yield* HostProcess.ExecutablePath}" "${scriptPath}" %*\r\n`
194
+ : `#!/bin/sh\nexec "${yield* HostProcess.ExecutablePath}" "${scriptPath}" "$@"\n`,
195
+ );
196
+ if (!isWindows) yield* fs.chmod(binaryPath, 0o755);
197
200
- const server = yield* OpenCode2Server.make({
201
- binaryPath,
202
- serverUrl: "",
203
- serverPassword: "",
204
- directory,
205
- environment: { ...(yield* HostProcess.Environment), OPENCODE_SERVER_PASSWORD: "ambient" },
206
- });
207
- const first = yield* server.withConnection((connection) => Effect.succeed(connection));
208
- const second = yield* server.withConnection((connection) => Effect.succeed(connection));
209
- assert.strictEqual(first.version, "2.0.18");
210
- assert.strictEqual(first.external, false);
211
- assert.strictEqual(second.client, first.client);
212
- }).pipe(
213
- Effect.scoped,
214
- Effect.provide(
215
- Layer.mergeAll(
216
- OpenCode2Client.layer,
217
- OpenCodeRuntime.layer.pipe(Layer.provide(OpenCodeServerLedger.layerTest)),
218
- ).pipe(Layer.provideMerge(Layer.mergeAll(NodeServices.layer, FetchHttpClient.layer))),
219
- ),
198
+ const server = yield* OpenCode2Server.make({
199
+ binaryPath,
200
+ serverUrl: "",
201
+ serverPassword: "",
202
+ directory,
203
+ environment: { ...(yield* HostProcess.Environment), OPENCODE_SERVER_PASSWORD: "ambient" },
204
+ });
205
+ const first = yield* server.withConnection((connection) => Effect.succeed(connection));
206
+ const second = yield* server.withConnection((connection) => Effect.succeed(connection));
207
+ assert.strictEqual(first.version, "2.0.18");
208
+ assert.strictEqual(first.external, false);
209
+ assert.strictEqual(second.client, first.client);
210
+ }).pipe(
211
+ Effect.scoped,
212
+ Effect.provide(
213
+ Layer.mergeAll(
214
+ OpenCode2Client.layer,
215
+ OpenCodeRuntime.layer.pipe(Layer.provide(OpenCodeServerLedger.layerTest)),
216
+ ).pipe(Layer.provideMerge(Layer.mergeAll(NodeServices.layer, FetchHttpClient.layer))),
217
),
221
- 15_000,
218
+ ),
219
);
220
});
vite.config.ts
+20
@@ -66,6 +66,25 @@ export default defineConfig({
66
],
67
hookTimeout: 60_000,
68
testTimeout: 60_000,
69
+ allowOnly: !process.env.CI,
70
+ // Flaky tests are fixed, not retried.
71
+ retry: 0,
72
+ fakeTimers: {
73
+ toFake: [
74
+ "setTimeout",
75
+ "clearTimeout",
76
+ "setInterval",
77
+ "clearInterval",
78
+ "setImmediate",
79
+ "clearImmediate",
80
+ "Date",
81
+ "performance",
82
+ "requestAnimationFrame",
83
+ "cancelAnimationFrame",
84
+ "requestIdleCallback",
85
+ "cancelIdleCallback",
86
+ ],
87
+ },
88
setupFiles: [
89
NodeURL.fileURLToPath(
90
new URL("./packages/shared/src/testing/longTempDir.ts", import.meta.url),
@@ -170,6 +189,7 @@ export default defineConfig({
189
"t3code/no-native-title-tooltip": "error",
190
"t3code/no-raw-mcp-registration": "error",
191
"t3code/no-test-in-loop": "error",
192
+ "t3code/no-test-timeout-or-unreasoned-skip": "error",
193
"t3code/no-rpc-permission-bypass": ["error", { allowRawClientAccess: true }],
194
"t3code/no-unscoped-has": "error",
195
"t3code/namespace-node-imports": "error",