test(lint): ban per-test timeouts and unreasoned skips #22560
Mergedjuliusmarmingemerged 6 commits into
main fromrefs/pull/22560/headmerged by juliusmarminge View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
juliusmarminge added labelsmacroscope-review
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
juliusmarminge changed the title
- oxlint-plugin-t3code/rules/no-test-timeout-or-unreasoned-skip.ts lines 133 to 133OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +113,21 @@113+ const [, second, third] = node.arguments;114+ // `test(name, { timeout }, fn)` is the options-first spelling of the same override.115+ if (116+ isNumericLiteral(third) ||117+ hasOption(third, TIMEOUT_OPTIONS) ||118+ (isFunction(third) && hasOption(second, TIMEOUT_OPTIONS))119+ ) {120+ context.report({ node, message: TIMEOUT_MESSAGE });121+ }122+ },123+ Identifier(node) {124+ if (!FOCUS_OR_SKIP_FUNCTIONS.has(node.name)) return;125+ const parent = node.parent;126+ if (parent?.type !== "CallExpression" || parent.callee !== node) return;127+ reportUnlessQuarantined(node);128+ },129+ MemberExpression(node) {130+ if (!Option.exists(getPropertyName(node.property), (n) => FOCUS_OR_SKIP_MODIFIERS.has(n))) {131+ return;132+ }133+ if (node.computed || !isTestChain(node.object)) return;oxlint-plugin-t3code/rules/no-test-timeout-or-unreasoned-skip.ts lines 118 to 118OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +98,21 @@98+ ) {99+ if (hasOption(node.arguments[0], SET_CONFIG_OPTIONS)) {100+ context.report({ node, message: TIMEOUT_MESSAGE });101+ }102+ return;103+ }104+105+ if (callee.value.type === "Identifier" && HOOK_FUNCTIONS.has(callee.value.name)) {106+ if (isNumericLiteral(node.arguments[1])) {107+ context.report({ node, message: TIMEOUT_MESSAGE });108+ }109+ return;110+ }111+112+ if (!isTestChain(callee.value)) return;113+ const [, second, third] = node.arguments;114+ // `test(name, { timeout }, fn)` is the options-first spelling of the same override.115+ if (116+ isNumericLiteral(third) ||117+ hasOption(third, TIMEOUT_OPTIONS) ||118+ (isFunction(third) && hasOption(second, TIMEOUT_OPTIONS))
- apps/mobile/src/reactCompilerCoverage.test.ts line 148Resolvedby coderabbitai[bot](GitHub profile, opens in a new tab)@@ -145,4 +145,4 @@145145 it("lists only files that exist", () => {146146 expect(Object.keys(KNOWN_BAILOUTS).filter((file) => !sourceFiles.includes(file))).toEqual([]);147147 });148-}, 300_000);148+});
- oxlint-plugin-t3code/rules/no-test-timeout-or-unreasoned-skip.ts line 10OutdatedResolvedby coderabbitai[bot](GitHub profile, opens in a new tab)@@ -0,0 +1,10 @@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 the8+// 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", "test"]);oxlint-plugin-t3code/rules/no-test-timeout-or-unreasoned-skip.ts line 117OutdatedResolvedby coderabbitai[bot](GitHub profile, opens in a new tab)@@ -0,0 +97,21 @@97+ ) {98+ if (hasOption(node.arguments[0], SET_CONFIG_OPTIONS)) {99+ context.report({ node, message: TIMEOUT_MESSAGE });100+ }101+ return;102+ }103+104+ if (callee.value.type === "Identifier" && HOOK_FUNCTIONS.has(callee.value.name)) {105+ if (isNumericLiteral(node.arguments[1])) {106+ context.report({ node, message: TIMEOUT_MESSAGE });107+ }108+ return;109+ }110+111+ if (!isTestChain(callee.value)) return;112+ const [, second, third] = node.arguments;113+ // `test(name, { timeout }, fn)` is the options-first spelling of the same override.114+ if (115+ isNumericLiteral(third) ||116+ hasOption(third, TIMEOUT_OPTIONS) ||117+ hasOption(second, TIMEOUT_OPTIONS)
- oxlint-plugin-t3code/rules/no-test-timeout-or-unreasoned-skip.ts line 89OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +69,21 @@69+export default defineRule({70+ meta: {71+ type: "problem",72+ docs: {73+ description:74+ "Disallow per-test timeouts and retries, and require a tracking issue for skipped or focused tests.",75+ },76+ },77+ create(context) {78+ if (!TEST_FILE_PATTERN.test(context.filename)) return {};79+ const checkTimeouts = !LIVE_TEST_FILE_PATTERN.test(context.filename);80+81+ const reportUnlessQuarantined = (node: ESTree.Node) => {82+ const comments = context.sourceCode.getCommentsBefore(enclosingStatement(node));83+ if (comments.some((comment) => QUARANTINE_PATTERN.test(comment.value))) return;84+ context.report({ node, message: SKIP_MESSAGE });85+ };86+87+ return {88+ CallExpression(node) {89+ if (!checkTimeouts) return;
- oxlint-plugin-t3code/rules/no-test-timeout-or-unreasoned-skip.ts lines 63 to 67Resolvedby juliusmarminge@@ -0,0 +47,21 @@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+ );oxlint-plugin-t3code/rules/no-test-timeout-or-unreasoned-skip.ts line 103OutdatedResolvedby juliusmarminge@@ -0,0 +83,21 @@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+ if (!checkTimeouts) return;
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes
juliusmarminge merged thisb280e7d
juliusmarminge closed this
Sign in to join this conversation.
Thread transfer impact#
✅ Thread transfer remains within every enforced ceiling.
Baseline:
8cd561e· PR result:c925428· Source CI: successScenario and decoded snapshot size
10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.