@milkenjoyer/toolchain 0.20.0 → 0.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/README.md +2 -0
  2. package/TESTING.md +26 -0
  3. package/dist/ci-budget-B2AuZ3xa.mjs +80 -0
  4. package/dist/ci-budget-cli.d.mts +2 -0
  5. package/dist/ci-budget-cli.mjs +31 -0
  6. package/dist/ci-budget.d.mts +22 -0
  7. package/dist/ci-budget.mjs +1 -0
  8. package/dist/ci-result.d.mts +1 -0
  9. package/dist/ci-result.mjs +12 -0
  10. package/dist/{compatible-DIYO9MZf.d.mts → compatible-BKEJ_p20.d.mts} +1 -1
  11. package/dist/{compatible-D54mCSlT.mjs → compatible-CRaMYpBM.mjs} +2 -2
  12. package/dist/compatible.d.mts +1 -1
  13. package/dist/compatible.mjs +1 -1
  14. package/dist/conformance.mjs +1 -1
  15. package/dist/{effect-plugin-BsrW5_nI.mjs → effect-plugin-roghk4W1.mjs} +2 -3
  16. package/dist/effect-plugin.mjs +1 -1
  17. package/dist/exceptions-D0yZUk8P.mjs +145 -0
  18. package/dist/exceptions.mjs +1 -1
  19. package/dist/foldkit-plugin.mjs +2 -2
  20. package/dist/formal.d.mts +1 -1
  21. package/dist/formal.mjs +5 -5
  22. package/dist/{guard-fFg_0NIp.mjs → guard-n0LC_buo.mjs} +6 -6
  23. package/dist/guard.d.mts +1 -1
  24. package/dist/guard.mjs +1 -1
  25. package/dist/hooks.d.mts +1 -1
  26. package/dist/hooks.mjs +2 -2
  27. package/dist/{lint-BJ6SmGk1.mjs → lint-Bx4NP_kA.mjs} +5 -5
  28. package/dist/lint.mjs +1 -1
  29. package/dist/{plugin-CwxhPtui.mjs → plugin-DUUAfi92.mjs} +326 -30
  30. package/dist/plugin.d.mts +5 -0
  31. package/dist/plugin.mjs +1 -1
  32. package/dist/proof.mjs +3 -3
  33. package/dist/renovate-ci-BdVmECgm.mjs +73 -0
  34. package/dist/renovate-ci.d.mts +10 -0
  35. package/dist/renovate-ci.mjs +1 -0
  36. package/dist/{rules-vHmNoAU0.mjs → rules-5qwzfDWJ.mjs} +3 -1
  37. package/dist/rules.d.mts +2 -0
  38. package/dist/rules.mjs +1 -1
  39. package/dist/standard.mjs +6 -6
  40. package/dist/starts.mjs +4 -2
  41. package/dist/verdict.d.mts +1 -1
  42. package/dist/verdict.mjs +2 -2
  43. package/dist/{verification-FgQFU1YN.d.mts → verification-fnhfrxmy.d.mts} +1 -1
  44. package/dist/verification.d.mts +1 -1
  45. package/dist/verification.mjs +1 -1
  46. package/dist/versions.mjs +1 -1
  47. package/package.json +13 -1
  48. package/renovate.json +29 -3
  49. package/src/ci-budget-cli.ts +39 -0
  50. package/src/ci-budget.ts +116 -0
  51. package/src/ci-result.ts +12 -0
  52. package/src/effect-plugin.ts +0 -1
  53. package/src/exceptions.ts +132 -0
  54. package/src/plugin.ts +10 -0
  55. package/src/renovate-ci.ts +96 -0
  56. package/src/rules/no-mock-call-mirrors.ts +121 -0
  57. package/src/rules/no-test-internal-imports.ts +102 -0
  58. package/src/rules/no-test-timeouts.ts +83 -0
  59. package/src/rules/no-test-waits.ts +113 -0
  60. package/src/rules/require-test-quarantine.ts +36 -0
  61. package/src/rules/test-api.ts +57 -0
  62. package/src/rules/test-hygiene.test.ts +241 -0
  63. package/src/rules/test-package.ts +32 -0
  64. package/src/rules.ts +2 -0
  65. package/src/shared/member-path.ts +7 -0
  66. package/src/starts/policy.ts +5 -1
  67. package/dist/exceptions-Dybl9xpc.mjs +0 -11
  68. package/dist/{specs-file-NsQF4V7X.mjs → specs-file-Ck9ZOt46.mjs} +1 -1
  69. package/dist/{syntax-CGEOffZK.mjs → syntax-B3n7lDYJ.mjs} +1 -1
  70. package/dist/{verification-oAc1Q6I9.mjs → verification-D4Sn2fh5.mjs} +4 -4
  71. package/dist/{versions-DpRzgSR_.mjs → versions-KbYa8kbF.mjs} +1 -1
@@ -1,11 +1,15 @@
1
- import { i as unwrapExpression, n as memberPropertyName, r as propertyName, t as isStringLiteral } from "./syntax-CGEOffZK.mjs";
1
+ import { i as unwrapExpression, n as memberPropertyName, r as propertyName, t as isStringLiteral } from "./syntax-B3n7lDYJ.mjs";
2
+ import { createRequire } from "node:module";
3
+ import * as Effect from "effect/Effect";
4
+ import * as Schema from "effect/Schema";
2
5
  import * as Arr from "effect/Array";
3
6
  import { dual } from "effect/Function";
4
7
  import * as HashSet from "effect/HashSet";
5
8
  import * as Option from "effect/Option";
6
9
  import * as Str from "effect/String";
7
- import * as Effect from "effect/Effect";
10
+ import { existsSync, readFileSync } from "node:fs";
8
11
  import { Comment, Diagnostic, Plugin, Rule, RuleContext } from "effect-oxlint";
12
+ import { dirname, join, resolve } from "node:path";
9
13
  import * as HashMap from "effect/HashMap";
10
14
  // src/rules/no-comments.ts
11
15
  const noCommentsRule = Rule.define({
@@ -26,34 +30,6 @@ const noCommentsRule = Rule.define({
26
30
  }),
27
31
  name: "no-comments"
28
32
  });
29
- // src/rules/no-process-env.ts
30
- const passesEnvironment = (node) => {
31
- const parent = node.parent;
32
- return parent.type === "SpreadElement" || (parent.type === "CallExpression" || parent.type === "NewExpression") && parent.arguments.includes(node) || parent.type === "VariableDeclarator" && parent.init === node && parent.id.type === "ObjectPattern" && Arr.some(parent.id.properties, (property) => property.type === "RestElement");
33
- };
34
- const isGlobalProcess = (source, node) => {
35
- const lookup = (scope) => {
36
- const variable = scope.set.get(node.name);
37
- if (variable !== void 0 && variable.defs.length > 0) return false;
38
- return scope.upper === null ? true : lookup(scope.upper);
39
- };
40
- return lookup(source.getScope(node));
41
- };
42
- const noProcessEnvRule = Rule.define({
43
- name: "no-process-env",
44
- meta: Rule.meta({
45
- type: "suggestion",
46
- description: "Read configuration through Effect Config",
47
- messages: { config: "Read configuration through Effect Config. Passing the whole environment through is allowed." }
48
- }),
49
- *create() {
50
- const context = yield* RuleContext;
51
- return { MemberExpression: (node) => node.type === "MemberExpression" && node.object.type === "Identifier" && node.object.name === "process" && isGlobalProcess(context.sourceCode, node.object) && Option.contains(memberPropertyName(node), "env") && !passesEnvironment(node) ? context.report(Diagnostic.fromId({
52
- node,
53
- messageId: "config"
54
- })) : Effect.void };
55
- }
56
- });
57
33
  // src/shared/member-path.ts
58
34
  const resolveBinding = (sourceCode, node) => {
59
35
  const findBinding = (scope) => Option.flatMap(scope, (current) => Option.orElse(Option.fromUndefinedOr(current.set.get(node.name)), () => findBinding(Option.fromNullishOr(current.upper))));
@@ -83,6 +59,10 @@ const importedPath = dual(2, (sourceCode, node) => Option.gen(function* () {
83
59
  source: declaration.source.value,
84
60
  members: path.members
85
61
  };
62
+ if (specifier.type === "ImportDefaultSpecifier") return {
63
+ source: declaration.source.value,
64
+ members: ["default", ...path.members]
65
+ };
86
66
  if (specifier.type !== "ImportSpecifier") return yield* Option.none();
87
67
  const imported = specifier.imported.type === "Identifier" ? specifier.imported.name : specifier.imported.value;
88
68
  return {
@@ -90,6 +70,289 @@ const importedPath = dual(2, (sourceCode, node) => Option.gen(function* () {
90
70
  members: [imported, ...path.members]
91
71
  };
92
72
  }));
73
+ // src/rules/test-api.ts
74
+ const isTestFile = (filename) => /(?:\.(?:test|spec|fake)\.[cm]?[jt]sx?$|\/(?:tests?|__tests__)\/)/u.test(filename);
75
+ const testPath = (source, node) => Option.match(importedPath(source, node), {
76
+ onNone: () => {
77
+ const names = source.getText(node).split(".");
78
+ return [
79
+ "it",
80
+ "test",
81
+ "describe",
82
+ "beforeEach",
83
+ "afterEach",
84
+ "beforeAll",
85
+ "afterAll",
86
+ "vi",
87
+ "vitest",
88
+ "expect"
89
+ ].includes(names[0] ?? "") ? names : [];
90
+ },
91
+ onSome: ({ source: module, members }) => [
92
+ "@effect/vitest",
93
+ "vitest",
94
+ "vite-plus/test",
95
+ "bun:test",
96
+ "node:test"
97
+ ].includes(module) ? members : []
98
+ });
99
+ const isTestCall = (source, node) => [
100
+ "it",
101
+ "test",
102
+ "describe",
103
+ "beforeEach",
104
+ "afterEach",
105
+ "beforeAll",
106
+ "afterAll"
107
+ ].includes(testPath(source, node)[0] ?? "");
108
+ // src/rules/test-package.ts
109
+ const Manifest = Schema.fromJsonString(Schema.Struct({
110
+ name: Schema.optionalKey(Schema.String),
111
+ scripts: Schema.optionalKey(Schema.Record(Schema.String, Schema.String)),
112
+ exports: Schema.optionalKey(Schema.Unknown)
113
+ }));
114
+ const manifestAt = (folder) => {
115
+ const file = join(folder, "package.json");
116
+ if (!existsSync(file)) return Option.none();
117
+ return Schema.decodeOption(Manifest)(readFileSync(file, "utf8"));
118
+ };
119
+ const packageAt = (folder) => {
120
+ const manifest = manifestAt(folder);
121
+ if (Option.isSome(manifest)) return Option.some({
122
+ root: folder,
123
+ manifest: manifest.value
124
+ });
125
+ const parent = dirname(folder);
126
+ return parent === folder ? Option.none() : packageAt(parent);
127
+ };
128
+ // src/rules/no-mock-call-mirrors.ts
129
+ const noMockCallMirrorsRule = Rule.define({
130
+ *create() {
131
+ const context = yield* RuleContext;
132
+ if (!isTestFile(context.filename)) return {};
133
+ const own = packageAt(dirname(context.filename));
134
+ const require = createRequire(context.filename);
135
+ const local = (source) => {
136
+ if (/^(?:\.|#)/u.test(source) || Option.exists(own, ({ manifest }) => manifest.name !== void 0 && (source === manifest.name || source.startsWith(`${manifest.name}/`)))) return true;
137
+ try {
138
+ const resolved = require.resolve(source);
139
+ return resolved.startsWith("/") && !resolved.includes("/node_modules/");
140
+ } catch {
141
+ return false;
142
+ }
143
+ };
144
+ const mocked = /* @__PURE__ */ new Set();
145
+ const assertions = [];
146
+ const sourceOf = (node) => {
147
+ const value = unwrapExpression(node);
148
+ if (value.type === "CallExpression" && ["mocked", "expect"].includes(Option.getOrElse(lastName(value.callee), () => ""))) {
149
+ const [first] = value.arguments;
150
+ return first === void 0 ? Option.none() : sourceOf(first);
151
+ }
152
+ return Option.map(importedPath(context.sourceCode, value), ({ source }) => source);
153
+ };
154
+ return {
155
+ CallExpression: (node) => {
156
+ if (node.type !== "CallExpression") return Effect.void;
157
+ const path = testPath(context.sourceCode, node.callee);
158
+ const [first] = node.arguments;
159
+ if (["vi", "vitest"].includes(path[0] ?? "") && ["mock", "doMock"].includes(path[1] ?? "") && first !== void 0 && isStringLiteral(first)) mocked.add(first.value);
160
+ const callee = unwrapExpression(node.callee);
161
+ if (callee.type === "MemberExpression" && Option.getOrElse(memberPropertyName(callee), () => "").startsWith("toHaveBeenCalled")) {
162
+ let object = unwrapExpression(callee.object);
163
+ while (object.type === "MemberExpression") object = unwrapExpression(object.object);
164
+ if (object.type === "CallExpression" && testPath(context.sourceCode, object.callee)[0] === "expect") {
165
+ const [subject] = object.arguments;
166
+ if (subject !== void 0) Option.match(sourceOf(subject), {
167
+ onNone: () => void 0,
168
+ onSome: (source) => assertions.push({
169
+ node,
170
+ source
171
+ })
172
+ });
173
+ }
174
+ }
175
+ return Effect.void;
176
+ },
177
+ "Program:exit": () => Effect.forEach(assertions.filter(({ source }) => mocked.has(source) && local(source)), ({ node }) => context.report(Diagnostic.fromId({
178
+ node,
179
+ messageId: "behavior"
180
+ })), {
181
+ discard: true,
182
+ concurrency: 1
183
+ })
184
+ };
185
+ },
186
+ meta: Rule.meta({
187
+ description: "Local module mocks are not asserted through their call history",
188
+ messages: { behavior: "Run the real local module and assert its observable result. Delete the local vi.mock and the toHaveBeenCalled mirror." },
189
+ type: "problem"
190
+ }),
191
+ name: "no-mock-call-mirrors"
192
+ });
193
+ // src/rules/no-process-env.ts
194
+ const passesEnvironment = (node) => {
195
+ const parent = node.parent;
196
+ return parent.type === "SpreadElement" || (parent.type === "CallExpression" || parent.type === "NewExpression") && parent.arguments.includes(node) || parent.type === "VariableDeclarator" && parent.init === node && parent.id.type === "ObjectPattern" && Arr.some(parent.id.properties, (property) => property.type === "RestElement");
197
+ };
198
+ const isGlobalProcess = (source, node) => {
199
+ const lookup = (scope) => {
200
+ const variable = scope.set.get(node.name);
201
+ if (variable !== void 0 && variable.defs.length > 0) return false;
202
+ return scope.upper === null ? true : lookup(scope.upper);
203
+ };
204
+ return lookup(source.getScope(node));
205
+ };
206
+ const noProcessEnvRule = Rule.define({
207
+ name: "no-process-env",
208
+ meta: Rule.meta({
209
+ type: "suggestion",
210
+ description: "Read configuration through Effect Config",
211
+ messages: { config: "Read configuration through Effect Config. Passing the whole environment through is allowed." }
212
+ }),
213
+ *create() {
214
+ const context = yield* RuleContext;
215
+ return { MemberExpression: (node) => node.type === "MemberExpression" && node.object.type === "Identifier" && node.object.name === "process" && isGlobalProcess(context.sourceCode, node.object) && Option.contains(memberPropertyName(node), "env") && !passesEnvironment(node) ? context.report(Diagnostic.fromId({
216
+ node,
217
+ messageId: "config"
218
+ })) : Effect.void };
219
+ }
220
+ });
221
+ // src/rules/no-test-internal-imports.ts
222
+ const publicSubpath = (exports, subpath) => {
223
+ if (exports === void 0) return subpath === ".";
224
+ if (typeof exports === "string" || exports === null || Array.isArray(exports)) return subpath === "." && exports !== null;
225
+ if (typeof exports !== "object") return false;
226
+ if (!Object.keys(exports).some((key) => key.startsWith("."))) return subpath === ".";
227
+ const entries = Object.entries(exports);
228
+ const exact = entries.find(([key]) => key === subpath);
229
+ if (exact !== void 0) return exact[1] !== null;
230
+ const matched = entries.filter(([key]) => key.includes("*")).toSorted(([a], [b]) => {
231
+ const prefix = b.indexOf("*") - a.indexOf("*");
232
+ return prefix === 0 ? b.length - a.length : prefix;
233
+ }).find(([key]) => {
234
+ const [prefix, suffix] = key.split("*");
235
+ return subpath.startsWith(prefix ?? "") && subpath.endsWith(suffix ?? "");
236
+ });
237
+ return matched !== void 0 && matched[1] !== null;
238
+ };
239
+ const noTestInternalImportsRule = Rule.define({
240
+ *create() {
241
+ const context = yield* RuleContext;
242
+ if (!isTestFile(context.filename)) return {};
243
+ const folder = dirname(context.filename);
244
+ const own = packageAt(folder);
245
+ const internal = (source) => {
246
+ if (source.startsWith(".")) {
247
+ const target = resolve(folder, source);
248
+ if (dirname(target) === folder || /\/(?:tests?|__tests__)\//u.test(target)) return false;
249
+ return true;
250
+ }
251
+ const parts = source.split("/");
252
+ const name = source.startsWith("@") ? parts.slice(0, 2).join("/") : parts[0] ?? "";
253
+ const subpath = source === name ? "." : `.${source.slice(name.length)}`;
254
+ if (source.startsWith("#")) return true;
255
+ if (Option.exists(own, ({ manifest }) => manifest.name === name && !publicSubpath(manifest.exports, subpath))) return true;
256
+ let directory = folder;
257
+ while (dirname(directory) !== directory) {
258
+ const dependency = manifestAt(join(directory, "node_modules", name));
259
+ if (Option.isSome(dependency)) return !publicSubpath(dependency.value.exports, subpath);
260
+ directory = dirname(directory);
261
+ }
262
+ return /(?:^|\/)(?:src|internal)\//u.test(source);
263
+ };
264
+ const check = (node) => isStringLiteral(node) && internal(node.value) ? context.report(Diagnostic.fromId({
265
+ node,
266
+ messageId: "public"
267
+ })) : Effect.void;
268
+ return {
269
+ ImportDeclaration: (node) => node.type === "ImportDeclaration" ? check(node.source) : Effect.void,
270
+ ImportExpression: (node) => node.type === "ImportExpression" ? check(node.source) : Effect.void,
271
+ CallExpression: (node) => node.type === "CallExpression" && node.callee.type === "Identifier" && node.callee.name === "require" && node.arguments[0] !== void 0 ? check(node.arguments[0]) : Effect.void
272
+ };
273
+ },
274
+ meta: Rule.meta({
275
+ description: "Tests use public package exports unless colocated with their subject",
276
+ messages: { public: "Import the package's public entry point or exported subpath. Move this test beside its subject if it needs internal files." },
277
+ type: "problem"
278
+ }),
279
+ name: "no-test-internal-imports"
280
+ });
281
+ // src/rules/no-test-timeouts.ts
282
+ const noTestTimeoutsRule = Rule.define({
283
+ *create() {
284
+ const context = yield* RuleContext;
285
+ const test = isTestFile(context.filename);
286
+ const config = /(?:vitest|vite)\.config\.[cm]?[jt]s$/u.test(context.filename);
287
+ const report = (node) => context.report(Diagnostic.fromId({
288
+ node,
289
+ messageId: "remove"
290
+ }));
291
+ return {
292
+ Program: (node) => (test || config) && Option.exists(packageAt(dirname(context.filename)), ({ manifest }) => Object.values(manifest.scripts ?? {}).some((command) => /(?:^|\s)--retry(?:[=\s]|$)/u.test(command))) ? report(node) : Effect.void,
293
+ CallExpression: (node) => {
294
+ if (!test || node.type !== "CallExpression") return Effect.void;
295
+ const path = testPath(context.sourceCode, node.callee);
296
+ const overrides = node.arguments.some((argument) => argument.type === "ObjectExpression" && argument.properties.some((property) => property.type === "Property" && [
297
+ "timeout",
298
+ "testTimeout",
299
+ "hookTimeout",
300
+ "retry"
301
+ ].some((name) => Option.contains(propertyName(property), name))));
302
+ return isTestCall(context.sourceCode, node.callee) && (node.arguments.length > 2 || path.includes("retry") || overrides) || path.includes("setTimeout") || path.includes("setConfig") && overrides ? report(node) : Effect.void;
303
+ },
304
+ Property: (node) => config && node.type === "Property" && [
305
+ "timeout",
306
+ "testTimeout",
307
+ "hookTimeout",
308
+ "retry"
309
+ ].some((name) => Option.contains(propertyName(node), name)) ? report(node) : Effect.void,
310
+ Literal: (node) => (test || config) && node.type === "Literal" && typeof node.value === "string" && !(node.parent.type === "Property" && Option.contains(propertyName(node.parent), "code")) && /(?:^|\s)--retry(?:[=\s]|$)/u.test(node.value) ? report(node) : Effect.void
311
+ };
312
+ },
313
+ meta: Rule.meta({
314
+ description: "Tests use runner defaults without retries or timeout overrides",
315
+ messages: { remove: "Remove the test timeout or retry override. Fix the slow or flaky test and use the runner defaults." },
316
+ type: "problem"
317
+ }),
318
+ name: "no-test-timeouts"
319
+ });
320
+ // src/rules/no-test-waits.ts
321
+ const wallClock = /^(?:(?:globalThis\.)?(?:Date|performance)\s*(?:\.now|\[\s*["']now["']\s*\])|process\.hrtime(?:\.bigint)?)$/u;
322
+ const waits = /^(?:sleep|delay|setTimeout|setInterval|waitFor|waitUntil|waitForTimeout|waitForFunction|waitForNextUpdate|requestAnimationFrame|nextFrame|waitForFrame|poll|eventually|repeat|retry)$/u;
323
+ const noTestWaitsRule = Rule.define({
324
+ *create() {
325
+ const context = yield* RuleContext;
326
+ const report = (node) => context.report(Diagnostic.fromId({
327
+ node,
328
+ messageId: "synchronize"
329
+ }));
330
+ if (!isTestFile(context.filename)) return {};
331
+ return {
332
+ CallExpression: (node) => {
333
+ if (node.type !== "CallExpression") return Effect.void;
334
+ const callee = unwrapExpression(node.callee);
335
+ const name = Option.getOrElse(callee.type === "MemberExpression" ? memberPropertyName(callee) : lastName(callee), () => "");
336
+ const imported = importedPath(context.sourceCode, node.callee);
337
+ const path = testPath(context.sourceCode, node.callee);
338
+ const clock = context.sourceCode.getText(node.callee);
339
+ return waits.test(name) || path.includes("poll") || wallClock.test(clock) || Option.exists(imported, ({ source, members }) => source === "node:perf_hooks" && members.includes("now") || source === "node:process" && members.includes("hrtime") || waits.test(members.at(-1) ?? "") || members.includes("currentTimeMillis") || members.includes("currentTimeNanos")) ? report(node) : Effect.void;
340
+ },
341
+ MemberExpression: (node) => Option.exists(importedPath(context.sourceCode, node), ({ members }) => members.includes("currentTimeMillis") || members.includes("currentTimeNanos")) ? report(node) : Effect.void,
342
+ Identifier: (node) => node.type === "Identifier" && node.parent.type !== "ImportSpecifier" && Option.exists(importedPath(context.sourceCode, node), ({ members }) => members.includes("currentTimeMillis") || members.includes("currentTimeNanos")) ? report(node) : Effect.void,
343
+ NewExpression: (node) => node.type === "NewExpression" && (node.callee.type === "Identifier" && node.callee.name === "Date" && node.arguments.length === 0 || node.arguments.some((argument) => Option.exists(lastName(argument), (name) => waits.test(name)))) ? report(node) : Effect.void,
344
+ WhileStatement: (node) => node.type === "WhileStatement" && (node.test.type === "CallExpression" || node.test.type === "UnaryExpression" || node.test.type === "Literal" || /\bawait\b/u.test(context.sourceCode.getText(node.body))) ? report(node) : Effect.void,
345
+ DoWhileStatement: (node) => node.type === "DoWhileStatement" && (node.test.type === "CallExpression" || /\bawait\b/u.test(context.sourceCode.getText(node.body))) ? report(node) : Effect.void,
346
+ ForStatement: (node) => node.type === "ForStatement" && /\b(?:await|sleep|poll|retry|waitFor)\b/u.test(context.sourceCode.getText(node.body)) ? report(node) : Effect.void
347
+ };
348
+ },
349
+ meta: Rule.meta({
350
+ description: "Tests synchronize on observable completion rather than time or polling",
351
+ messages: { synchronize: "Remove the sleep, polling loop, wall-clock measurement or frame wait. Await the operation's completion or drive a controlled test clock." },
352
+ type: "problem"
353
+ }),
354
+ name: "no-test-waits"
355
+ });
93
356
  // src/shared/foldkit-api.ts
94
357
  const NAMESPACES = HashMap.make(["foldkit", []], ["foldkit/command", ["Command"]], ["foldkit/html", ["Html"]], ["foldkit/message", ["Message"]], ["foldkit/scene", ["Scene"]], ["foldkit/schema", ["Schema"]], ["foldkit/test", []]);
95
358
  const isFoldkitCall = (sourceCode, node, ...wanted) => Option.exists(importedPath(sourceCode, node.callee), (path) => Option.exists(HashMap.get(NAMESPACES, path.source), (prefix) => {
@@ -278,10 +541,43 @@ const requirePastTenseMessagesRule = Rule.define({
278
541
  }),
279
542
  name: "require-past-tense-messages"
280
543
  });
544
+ // src/rules/require-test-quarantine.ts
545
+ const requireTestQuarantineRule = Rule.define({
546
+ *create() {
547
+ const context = yield* RuleContext;
548
+ if (!isTestFile(context.filename)) return {};
549
+ const lines = context.sourceCode.text.split(/\r?\n/u);
550
+ return { CallExpression: (node) => {
551
+ if (node.type !== "CallExpression") return Effect.void;
552
+ const path = testPath(context.sourceCode, node.callee);
553
+ const skipped = [
554
+ "it",
555
+ "test",
556
+ "describe"
557
+ ].includes(path[0] ?? "") && path.some((name) => ["skip", "todo"].includes(name));
558
+ const line = node.loc.start.line;
559
+ return skipped && !/\bquarantine: #[1-9]\d*\b/u.test(lines[line - 2] ?? "") ? context.report(Diagnostic.fromId({
560
+ node,
561
+ messageId: "link"
562
+ })) : Effect.void;
563
+ } };
564
+ },
565
+ meta: Rule.meta({
566
+ description: "Skipped tests name their quarantine issue on the preceding line",
567
+ messages: { link: "Restore this test or put a void \"quarantine: #N\" statement on the line immediately above it, linking the issue that owns its repair." },
568
+ type: "problem"
569
+ }),
570
+ name: "require-test-quarantine"
571
+ });
281
572
  // src/plugin.ts
282
573
  const plugin = Plugin.define({
283
574
  name: "birbprophet",
284
575
  rules: {
576
+ "no-test-internal-imports": noTestInternalImportsRule,
577
+ "no-mock-call-mirrors": noMockCallMirrorsRule,
578
+ "require-test-quarantine": requireTestQuarantineRule,
579
+ "no-test-waits": noTestWaitsRule,
580
+ "no-test-timeouts": noTestTimeoutsRule,
285
581
  "no-comments": noCommentsRule,
286
582
  "no-process-env": noProcessEnvRule,
287
583
  "prefer-accessible-scene-locators": preferAccessibleSceneLocatorsRule,
package/dist/plugin.d.mts CHANGED
@@ -1,5 +1,10 @@
1
1
  import { Plugin } from "effect-oxlint";
2
2
  declare const plugin: Plugin.DefinedPlugin<{
3
+ readonly "no-test-internal-imports": import("effect-oxlint").CreateRule;
4
+ readonly "no-mock-call-mirrors": import("effect-oxlint").CreateRule;
5
+ readonly "require-test-quarantine": import("effect-oxlint").CreateRule;
6
+ readonly "no-test-waits": import("effect-oxlint").CreateRule;
7
+ readonly "no-test-timeouts": import("effect-oxlint").CreateRule;
3
8
  readonly "no-comments": import("effect-oxlint").CreateRule;
4
9
  readonly "no-process-env": import("effect-oxlint").CreateRule;
5
10
  readonly "prefer-accessible-scene-locators": import("effect-oxlint").CreateRule;
package/dist/plugin.mjs CHANGED
@@ -1 +1 @@
1
- export { t as default } from "./plugin-CwxhPtui.mjs";
1
+ export { t as default } from "./plugin-DUUAfi92.mjs";
package/dist/proof.mjs CHANGED
@@ -1,8 +1,9 @@
1
1
  #!/usr/bin/env bun
2
- import * as Data from "effect/Data";
3
- import * as Schema from "effect/Schema";
4
2
  import * as Config from "effect/Config";
5
3
  import * as Effect from "effect/Effect";
4
+ import * as Redacted from "effect/Redacted";
5
+ import * as Schema from "effect/Schema";
6
+ import * as Data from "effect/Data";
6
7
  import { NodeServices } from "@effect/platform-node";
7
8
  import * as Cause from "effect/Cause";
8
9
  import * as Exit from "effect/Exit";
@@ -12,7 +13,6 @@ import { FileSystem } from "effect/FileSystem";
12
13
  import { Path } from "effect/Path";
13
14
  import { Octokit } from "@octokit/rest";
14
15
  import { Base64 } from "effect/encoding";
15
- import * as Redacted from "effect/Redacted";
16
16
  // src/proof.ts
17
17
  var ProofError = class extends Data.TaggedError("ProofError") {};
18
18
  const kinds = /* @__PURE__ */ new Map([
@@ -0,0 +1,73 @@
1
+ import * as Schema from "effect/Schema";
2
+ import { parse } from "yaml";
3
+ // src/renovate-ci.ts
4
+ const headRequest = "github.event.action == 'labeled' && github.event.label.name == format('ready:{0}', github.event.pull_request.head.sha)";
5
+ const renovateRequest = "github.event.action != 'labeled' && github.event.pull_request.user.login == 'renovate[bot]' && github.event.pull_request.head.repo.full_name == github.repository";
6
+ const readyRequest = `github.event_name == 'push' || (github.event.pull_request.draft == false && !startsWith(github.head_ref, 'probe/') && ((${headRequest}) || (${renovateRequest})))`;
7
+ const budgetRequest = `github.event_name == 'pull_request' && github.event.pull_request.draft == false && (${renovateRequest})`;
8
+ const checksRequest = `always() && (${readyRequest}) && (needs.budget.result == 'success' || needs.budget.result == 'skipped')`;
9
+ const resultRequest = `always() && (${readyRequest})`;
10
+ const readyGroup = `\${{ github.workflow }}-\${{ github.event_name == 'pull_request' && !((${headRequest}) || (${renovateRequest})) && format('label-{0}-{1}', github.event.pull_request.number, github.event.label.name) || github.event.pull_request.number || github.ref }}`;
11
+ const readyCancellation = `\${{ github.event_name == 'pull_request' && ((${headRequest}) || (${renovateRequest})) }}`;
12
+ const readyRunName = `\${{ github.event_name == 'push' && format('ready {0} at {1}', github.ref_name, github.sha) || ((${headRequest}) || (${renovateRequest})) && format('ready #{0} at {1}', github.event.pull_request.number, github.event.pull_request.head.sha) || format('label {0} on #{1}', github.event.label.name, github.event.pull_request.number) }}`;
13
+ const BudgetStep = Schema.Struct({
14
+ if: Schema.optionalKey(Schema.Never),
15
+ "continue-on-error": Schema.optionalKey(Schema.Literal(false)),
16
+ run: Schema.Literal("vp exec ci-budget"),
17
+ env: Schema.Struct({ BOAT_API_KEY: Schema.Literal(`\${{ secrets.BOAT_CI_READ_KEY }}`) })
18
+ });
19
+ const ResultStep = Schema.Struct({
20
+ if: Schema.optionalKey(Schema.Never),
21
+ "continue-on-error": Schema.optionalKey(Schema.Literal(false)),
22
+ run: Schema.Literal("vp exec ci-result"),
23
+ env: Schema.Struct({ CI_RESULT: Schema.Literal(`\${{ needs.checks.result }}`) })
24
+ });
25
+ const Workflow = Schema.Struct({
26
+ on: Schema.Struct({
27
+ push: Schema.Struct({ branches: Schema.Array(Schema.String) }),
28
+ pull_request: Schema.Struct({ types: Schema.Array(Schema.String) })
29
+ }),
30
+ concurrency: Schema.Struct({
31
+ group: Schema.Literal(readyGroup),
32
+ "cancel-in-progress": Schema.Literal(readyCancellation)
33
+ }),
34
+ jobs: Schema.Struct({
35
+ budget: Schema.Struct({
36
+ "continue-on-error": Schema.optionalKey(Schema.Literal(false)),
37
+ if: Schema.Literal(budgetRequest),
38
+ "runs-on": Schema.Literal("ubuntu-24.04"),
39
+ steps: Schema.Array(Schema.Unknown)
40
+ }),
41
+ checks: Schema.Struct({
42
+ "continue-on-error": Schema.optionalKey(Schema.Literal(false)),
43
+ needs: Schema.Literal("budget"),
44
+ if: Schema.Literal(checksRequest)
45
+ }),
46
+ ready: Schema.Struct({
47
+ "continue-on-error": Schema.optionalKey(Schema.Literal(false)),
48
+ needs: Schema.Array(Schema.String),
49
+ if: Schema.Literal(resultRequest),
50
+ "runs-on": Schema.Literal("ubuntu-24.04"),
51
+ steps: Schema.Array(Schema.Unknown)
52
+ })
53
+ })
54
+ });
55
+ const Layout = Schema.Struct({
56
+ on: Schema.Record(Schema.String, Schema.Unknown),
57
+ jobs: Schema.Record(Schema.String, Schema.Unknown)
58
+ });
59
+ const MainOnlyJob = Schema.Struct({ if: Schema.Literal("github.event_name == 'push'") });
60
+ const isRenovateCi = (text) => {
61
+ const parsed = parse(text);
62
+ const decoded = Schema.decodeUnknownOption(Workflow)(parsed);
63
+ if (decoded._tag === "None") return false;
64
+ const layout = Schema.decodeUnknownSync(Layout)(parsed);
65
+ const push = Schema.decodeUnknownSync(Schema.Record(Schema.String, Schema.Unknown))(layout.on.push);
66
+ const workflow = decoded.value;
67
+ return Object.keys(layout.on).toSorted().join(",") === "pull_request,push" && Object.keys(push).join(",") === "branches" && workflow.on.push.branches.join(",") === "main" && Object.entries(layout.jobs).every(([name, job]) => [
68
+ "budget",
69
+ "checks",
70
+ "ready"
71
+ ].includes(name) || Schema.is(MainOnlyJob)(job)) && workflow.on.pull_request.types.join(",") === "labeled,opened,synchronize,reopened,ready_for_review" && workflow.jobs.ready.needs.join(",") === "budget,checks" && workflow.jobs.budget.steps.some(Schema.is(BudgetStep)) && workflow.jobs.ready.steps.some(Schema.is(ResultStep));
72
+ };
73
+ export { readyCancellation as a, readyRunName as c, isRenovateCi as i, renovateRequest as l, checksRequest as n, readyGroup as o, headRequest as r, readyRequest as s, budgetRequest as t, resultRequest as u };
@@ -0,0 +1,10 @@
1
+ export declare const headRequest = "github.event.action == 'labeled' && github.event.label.name == format('ready:{0}', github.event.pull_request.head.sha)";
2
+ export declare const renovateRequest = "github.event.action != 'labeled' && github.event.pull_request.user.login == 'renovate[bot]' && github.event.pull_request.head.repo.full_name == github.repository";
3
+ export declare const readyRequest = "github.event_name == 'push' || (github.event.pull_request.draft == false && !startsWith(github.head_ref, 'probe/') && ((github.event.action == 'labeled' && github.event.label.name == format('ready:{0}', github.event.pull_request.head.sha)) || (github.event.action != 'labeled' && github.event.pull_request.user.login == 'renovate[bot]' && github.event.pull_request.head.repo.full_name == github.repository)))";
4
+ export declare const budgetRequest = "github.event_name == 'pull_request' && github.event.pull_request.draft == false && (github.event.action != 'labeled' && github.event.pull_request.user.login == 'renovate[bot]' && github.event.pull_request.head.repo.full_name == github.repository)";
5
+ export declare const checksRequest = "always() && (github.event_name == 'push' || (github.event.pull_request.draft == false && !startsWith(github.head_ref, 'probe/') && ((github.event.action == 'labeled' && github.event.label.name == format('ready:{0}', github.event.pull_request.head.sha)) || (github.event.action != 'labeled' && github.event.pull_request.user.login == 'renovate[bot]' && github.event.pull_request.head.repo.full_name == github.repository)))) && (needs.budget.result == 'success' || needs.budget.result == 'skipped')";
6
+ export declare const resultRequest = "always() && (github.event_name == 'push' || (github.event.pull_request.draft == false && !startsWith(github.head_ref, 'probe/') && ((github.event.action == 'labeled' && github.event.label.name == format('ready:{0}', github.event.pull_request.head.sha)) || (github.event.action != 'labeled' && github.event.pull_request.user.login == 'renovate[bot]' && github.event.pull_request.head.repo.full_name == github.repository))))";
7
+ export declare const readyGroup = "${{ github.workflow }}-${{ github.event_name == 'pull_request' && !((github.event.action == 'labeled' && github.event.label.name == format('ready:{0}', github.event.pull_request.head.sha)) || (github.event.action != 'labeled' && github.event.pull_request.user.login == 'renovate[bot]' && github.event.pull_request.head.repo.full_name == github.repository)) && format('label-{0}-{1}', github.event.pull_request.number, github.event.label.name) || github.event.pull_request.number || github.ref }}";
8
+ export declare const readyCancellation = "${{ github.event_name == 'pull_request' && ((github.event.action == 'labeled' && github.event.label.name == format('ready:{0}', github.event.pull_request.head.sha)) || (github.event.action != 'labeled' && github.event.pull_request.user.login == 'renovate[bot]' && github.event.pull_request.head.repo.full_name == github.repository)) }}";
9
+ export declare const readyRunName = "${{ github.event_name == 'push' && format('ready {0} at {1}', github.ref_name, github.sha) || ((github.event.action == 'labeled' && github.event.label.name == format('ready:{0}', github.event.pull_request.head.sha)) || (github.event.action != 'labeled' && github.event.pull_request.user.login == 'renovate[bot]' && github.event.pull_request.head.repo.full_name == github.repository)) && format('ready #{0} at {1}', github.event.pull_request.number, github.event.pull_request.head.sha) || format('label {0} on #{1}', github.event.label.name, github.event.pull_request.number) }}";
10
+ export declare const isRenovateCi: (text: string) => boolean;
@@ -0,0 +1 @@
1
+ export { t as budgetRequest, n as checksRequest, r as headRequest, i as isRenovateCi, a as readyCancellation, o as readyGroup, s as readyRequest, c as readyRunName, l as renovateRequest, u as resultRequest } from "./renovate-ci-BdVmECgm.mjs";
@@ -108,10 +108,12 @@ const staticRules = {
108
108
  "unicorn/prefer-module": "error",
109
109
  "unicorn/prefer-number-properties": "error",
110
110
  "vitest/expect-expect": "off",
111
+ "vitest/no-disabled-tests": "off",
111
112
  "vitest/no-identical-title": "error",
112
113
  "vitest/no-import-node-test": "error",
113
114
  "vitest/no-standalone-expect": "off",
114
115
  "vitest/valid-expect": ["error", { maxArgs: 2 }],
115
- "vitest/valid-title": ["error", { allowArguments: true }]
116
+ "vitest/valid-title": ["error", { allowArguments: true }],
117
+ "vitest/warn-todo": "off"
116
118
  };
117
119
  export { staticRules as t };
package/dist/rules.d.mts CHANGED
@@ -103,6 +103,7 @@ export declare const staticRules: {
103
103
  "unicorn/prefer-module": "error";
104
104
  "unicorn/prefer-number-properties": "error";
105
105
  "vitest/expect-expect": "off";
106
+ "vitest/no-disabled-tests": "off";
106
107
  "vitest/no-identical-title": "error";
107
108
  "vitest/no-import-node-test": "error";
108
109
  "vitest/no-standalone-expect": "off";
@@ -112,4 +113,5 @@ export declare const staticRules: {
112
113
  "vitest/valid-title": ["error", {
113
114
  allowArguments: boolean;
114
115
  }];
116
+ "vitest/warn-todo": "off";
115
117
  };
package/dist/rules.mjs CHANGED
@@ -1 +1 @@
1
- export { t as staticRules } from "./rules-vHmNoAU0.mjs";
1
+ export { t as staticRules } from "./rules-5qwzfDWJ.mjs";
package/dist/standard.mjs CHANGED
@@ -1,17 +1,17 @@
1
1
  #!/usr/bin/env bun
2
- import { f as versionOf } from "./versions-DpRzgSR_.mjs";
3
- import { a as ruleFindings, c as exactFindings, l as manifestRanges, s as PLAIN, u as resolveCatalog } from "./guard-fFg_0NIp.mjs";
2
+ import { f as versionOf } from "./versions-KbYa8kbF.mjs";
3
+ import { a as ruleFindings, c as exactFindings, l as manifestRanges, s as PLAIN, u as resolveCatalog } from "./guard-n0LC_buo.mjs";
4
4
  import { t as fmt } from "./fmt-C6autuPP.mjs";
5
- import { n as criticalFindings, t as decode } from "./specs-file-NsQF4V7X.mjs";
5
+ import { n as criticalFindings, t as decode } from "./specs-file-Ck9ZOt46.mjs";
6
+ import * as Console from "effect/Console";
7
+ import * as Effect from "effect/Effect";
8
+ import * as Schema from "effect/Schema";
6
9
  import * as Arr from "effect/Array";
7
10
  import * as Option from "effect/Option";
8
11
  import * as R from "effect/Record";
9
- import * as Schema from "effect/Schema";
10
- import * as Effect from "effect/Effect";
11
12
  import { posix } from "node:path";
12
13
  import { NodeServices } from "@effect/platform-node";
13
14
  import * as Cause from "effect/Cause";
14
- import * as Console from "effect/Console";
15
15
  import * as Exit from "effect/Exit";
16
16
  import { ChildProcess } from "effect/process";
17
17
  import * as Stream from "effect/Stream";
package/dist/starts.mjs CHANGED
@@ -1,3 +1,4 @@
1
+ import { i as isRenovateCi } from "./renovate-ci-BdVmECgm.mjs";
1
2
  import * as Schema from "effect/Schema";
2
3
  import { parse } from "yaml";
3
4
  // src/starts/policy.ts
@@ -51,7 +52,8 @@ const boatJobFindings = (files) => {
51
52
  for (const [path, text] of files) try {
52
53
  workflows.push({
53
54
  path,
54
- workflow: Schema.decodeUnknownSync(Workflow)(parse(text))
55
+ workflow: Schema.decodeUnknownSync(Workflow)(parse(text)),
56
+ renovate: isRenovateCi(text)
55
57
  });
56
58
  } catch {
57
59
  findings.push(`${path}: workflow unread`);
@@ -122,7 +124,7 @@ const boatJobFindings = (files) => {
122
124
  };
123
125
  for (const entry of workflows) {
124
126
  const total = count(entry, [], true);
125
- if (total > 0 && startsOnPr(entry.workflow.on)) findings.push(`${entry.path}: a pull_request or PR-branch push starts ${total} Boat jobs; PR ready starts on request`);
127
+ if (total > 0 && startsOnPr(entry.workflow.on) && !entry.renovate) findings.push(`${entry.path}: a pull_request or PR-branch push starts ${total} Boat jobs; PR ready starts on request`);
126
128
  if (total > 2) findings.push(`${entry.path}: closure starts ${total} Boat jobs, limit 2`);
127
129
  }
128
130
  return [...new Set(findings)];
@@ -1,3 +1,3 @@
1
- import { i as VerificationError } from "./verification-FgQFU1YN.mjs";
1
+ import { i as VerificationError } from "./verification-fnhfrxmy.mjs";
2
2
  import * as Effect from "effect/Effect";
3
3
  export declare const checkVerdict: Effect.Effect<number, import("effect/Config").ConfigError | import("effect/PlatformError").PlatformError | import("effect/Schema").SchemaError | VerificationError, import("effect/FileSystem").FileSystem>;
package/dist/verdict.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env bun
2
- import { a as readPullRequest, i as github, n as autoPass } from "./verification-oAc1Q6I9.mjs";
2
+ import { a as readPullRequest, i as github, n as autoPass } from "./verification-D4Sn2fh5.mjs";
3
+ import * as Console from "effect/Console";
3
4
  import * as Effect from "effect/Effect";
4
5
  import { NodeServices } from "@effect/platform-node";
5
6
  import * as Cause from "effect/Cause";
6
- import * as Console from "effect/Console";
7
7
  import * as Exit from "effect/Exit";
8
8
  // src/verdict.ts
9
9
  const checkVerdict = Effect.gen(function* () {
@@ -1,6 +1,6 @@
1
- import * as Schema from "effect/Schema";
2
1
  import * as Config from "effect/Config";
3
2
  import * as Effect from "effect/Effect";
3
+ import * as Schema from "effect/Schema";
4
4
  import * as Cause from "effect/Cause";
5
5
  import { FileSystem } from "effect/FileSystem";
6
6
  import { Octokit } from "@octokit/rest";
@@ -1,2 +1,2 @@
1
- import { a as autoPass, c as readPullRequest, i as VerificationError, l as verdict, n as PullRequestContext, o as checkVerification, r as Verdict, s as github, t as PullRequest } from "./verification-FgQFU1YN.mjs";
1
+ import { a as autoPass, c as readPullRequest, i as VerificationError, l as verdict, n as PullRequestContext, o as checkVerification, r as Verdict, s as github, t as PullRequest } from "./verification-fnhfrxmy.mjs";
2
2
  export { PullRequest, PullRequestContext, Verdict, VerificationError, autoPass, checkVerification, github, readPullRequest, verdict };