From 5817ebb288612f5aa364398ec1d5e70006888203 Mon Sep 17 00:00:00 2001 From: morluto <76467478+morluto@users.noreply.github.com> Date: Mon, 23 Nov 2026 01:11:58 -0500 Subject: [PATCH] fix(ci): close static-check cache gaps and prune stale settings (#14017) * fix(ci): close static-check cache gaps and prune stale settings * chore(ci): remove unused Actionlint runner label --- .github/actionlint.yaml | 2 - .jscpd.json | 4 -- .oxlintrc.json | 6 --- scripts/ci/scopes.mjs | 2 - scripts/verify/clients/qwen-evidence.mjs | 2 +- .../boundary/filesystem/ciChangeScope.test.ts | 26 ++++++---- .../filesystem/staticTaskCache.test.ts | 52 +++++++++++++++++-- turbo.json | 15 +++--- 8 files changed, 76 insertions(+), 33 deletions(-) diff --git a/.github/actionlint.yaml b/.github/actionlint.yaml index 465de2b613..a5260baa80 100644 --- a/.github/actionlint.yaml +++ b/.github/actionlint.yaml @@ -2,5 +2,3 @@ self-hosted-runner: labels: - hopper - ghidra-12-1-2 - # Hosted label introduced after the pinned actionlint release. - - macos-15-intel diff --git a/.jscpd.json b/.jscpd.json index bae10139fa..f36e0efeca 100644 --- a/.jscpd.json +++ b/.jscpd.json @@ -4,11 +4,7 @@ "ignore": [ "node_modules/**", "dist/**", - "docs/**", - ".codex/**", - ".devin/**", "tests/fixtures/**", - "third_party/**", "tests/conformance/**/*.c", "tests/conformance/**/*.m", "tests/conformance/**/*.swift", diff --git a/.oxlintrc.json b/.oxlintrc.json index 4c5a08a340..14ce36269a 100644 --- a/.oxlintrc.json +++ b/.oxlintrc.json @@ -221,12 +221,6 @@ { "files": ["tests/**/*.test.ts", "src/**/*.test.ts"], "rules": { - "vitest/valid-expect": [ - "warn", - { - "maxArgs": 2 - } - ], "vitest/valid-expect-in-promise": "error", "vitest/no-focused-tests": "error" } diff --git a/scripts/ci/scopes.mjs b/scripts/ci/scopes.mjs index c68c89a271..56084abf2d 100644 --- a/scripts/ci/scopes.mjs +++ b/scripts/ci/scopes.mjs @@ -109,7 +109,6 @@ const PATH_SCOPES = { "tests/boundary/providers/GdbSession*.test.ts", "tests/boundary/providers/GdbCommandQueue.test.ts", "tests/boundary/providers/gdbTestHelpers.ts", - "tests/boundary/providers/RizinDebugSessionCoverage.part*.test.ts", "tests/boundary/providers/RizinDebugSession*.test.ts", "tests/boundary/providers/RizinInferiorTty.test.ts", "tests/boundary/providers/RizinDecoderInputs.test.ts", @@ -120,7 +119,6 @@ const PATH_SCOPES = { "tests/boundary/cli/reverseEngineeringCommands.test.ts", "tests/boundary/mcp/cutter*.test.ts", "tests/boundary/mcp/gdb*.test.ts", - "tests/boundary/mcp/debuggerCancellationMcp.test.ts", "tests/boundary/mcp/rizinDebuggerCancellationMcp.test.ts", "tests/boundary/mcp/rizinPendingOutput.test.ts", "tests/boundary/mcp/reverseEngineeringPartialMcp.test.ts", diff --git a/scripts/verify/clients/qwen-evidence.mjs b/scripts/verify/clients/qwen-evidence.mjs index 391048034d..820ff299f5 100644 --- a/scripts/verify/clients/qwen-evidence.mjs +++ b/scripts/verify/clients/qwen-evidence.mjs @@ -2,7 +2,7 @@ import assert from "node:assert/strict"; import { createHash } from "node:crypto"; import { realpath } from "node:fs/promises"; import { isAbsolute } from "node:path"; -import { isPathWithinRoot } from "../../../dist/domain/localPath.js"; +import { isPathWithinRoot } from "#dist/domain/localPath.js"; /** * @param {readonly {role?: string, tool_call_id?: string, content?: unknown}[]} messages diff --git a/tests/boundary/filesystem/ciChangeScope.test.ts b/tests/boundary/filesystem/ciChangeScope.test.ts index f2dbb25078..e161861758 100644 --- a/tests/boundary/filesystem/ciChangeScope.test.ts +++ b/tests/boundary/filesystem/ciChangeScope.test.ts @@ -1,4 +1,5 @@ import { + access, chmod, cp, mkdir, @@ -711,14 +712,20 @@ it.each([ }, ); -const reverseToolsVitestConfig = await readFile( - new URL("../../../vitest.reverse-tools.config.ts", import.meta.url), - "utf8", -); -const reverseToolsVitestInputs = [ - ...reverseToolsVitestConfig.matchAll(/"((?:\.\/)?(?:src|tests)\/[^"]+)"/gu), -].flatMap((match) => - match[1] === undefined ? [] : [match[1].replace(/^\.\//u, "")], +const reverseToolsVitestInputs = ( + await Promise.all( + [ + "vitest.reverse-tools.config.ts", + "vitest.reverse-tools-semantics.config.ts", + ].map((name) => + readFile(new URL(`../../../${name}`, import.meta.url), "utf8"), + ), + ) +).flatMap((source) => + Array.from( + source.matchAll(/"((?:\.\/)?(?:src|tests)\/[^"]+)"/gu), + ([, path]) => path!.replace(/^\.\//u, ""), + ), ); const reverseToolsMutationConfig = JSON.parse( await readFile( @@ -736,8 +743,9 @@ const reverseToolsInputs = [ ]; it.each(reverseToolsInputs)( - "selects the reverse-tool quality gate for configured input %s", + "keeps configured reverse-tool input %s on disk and in the quality gate", async (path) => { + await access(new URL(`../../../${path}`, import.meta.url)); expect(await classifyPaths([path])).toMatchObject({ code: true, reverse_tools: true, diff --git a/tests/boundary/filesystem/staticTaskCache.test.ts b/tests/boundary/filesystem/staticTaskCache.test.ts index 178a471dbb..9672f8f24c 100644 --- a/tests/boundary/filesystem/staticTaskCache.test.ts +++ b/tests/boundary/filesystem/staticTaskCache.test.ts @@ -379,6 +379,20 @@ it.each([ diagnostic: "TS2322", invalidatesCompile: false, }, + { + label: "imported TypeScript script", + path: "scripts/helper.mts", + content: "export const scriptHelper = 2;\n", + diagnostic: "TS2322", + invalidatesCompile: false, + }, + { + label: "imported JavaScript test helper", + path: "tests/helper.mjs", + content: "export const testHelper = 2;\n", + diagnostic: "TS2322", + invalidatesCompile: false, + }, { label: "GitHub action source", path: ".github/actions/helper.ts", @@ -467,6 +481,18 @@ it.each([ join(root, "scripts/api.d.mts"), 'import type { Scope } from "#compiler-scope";\nexport type ApiScope = Scope;\n', ); + await writeFile( + join(root, "scripts/helper.mts"), + "export const scriptHelper = 1;\n", + ); + await writeFile( + join(root, "tests/helper.mjs"), + "export const testHelper = 1;\n", + ); + await writeFile( + join(root, "tests/use-helpers.ts"), + 'import { scriptHelper } from "../scripts/helper.mjs";\nimport { testHelper } from "./helper.mjs";\nexport const checkedScript: 1 = scriptHelper;\nexport const checkedTest: 1 = testHelper;\n', + ); await writeFile( join(root, "tests/use-script.ts"), 'import type { ApiScope } from "../scripts/api.mjs";\nimport type { TestValue } from "./types.cjs";\nimport type { ScriptValue } from "../scripts/value.cjs";\nexport const scope: ApiScope = "root";\nexport const testValue: TestValue = "root";\nexport const scriptValue: ScriptValue = "root";\n', @@ -560,13 +586,21 @@ it("invalidates checker task hashes for Node, ignore, and VitePress config chang await writeFile(join(root, ".npmrc"), "engine-strict=true\n"); await writeFile(join(root, ".gitignore"), ".cache/\n"); await writeFile(join(root, ".jscpd.json"), "{}\n"); - await writeFile(join(root, "docs/.vitepress/config.ts"), "export {};\n"); + const vitePressEntry = 'export { value } from "./documentation.js";\n'; + const ownedHelpers = ["docs/.vitepress/documentation.ts", "tests/helper.mjs"]; + const initialHelper = "export const value = 1;\n"; + await writeFile(join(root, "docs/.vitepress/config.ts"), vitePressEntry); + for (const helper of ownedHelpers) + await writeFile(join(root, helper), initialHelper); await writeFile( join(root, "vitest.config.ts"), 'import { CiTestSequencer } from "./tests/ciTestSequencer.js";\nexport const sequencer = CiTestSequencer;\n', ); await writeFile(join(root, "src/input.ts"), "export {};\n"); - await writeFile(join(root, "tests/input.ts"), "export {};\n"); + await writeFile( + join(root, "tests/input.ts"), + 'export { value } from "./helper.mjs";\n', + ); const initial = new Map(); for (const task of ["jscpd", "knip", "metadata:check", "scan:todos"]) @@ -612,7 +646,19 @@ it("invalidates checker task hashes for Node, ignore, and VitePress config chang taskHash(root, "knip", cache), "knip must hash its configured VitePress entry", ).not.toBe(initial.get("knip")); - await writeFile(join(root, "docs/.vitepress/config.ts"), "export {};\n"); + await writeFile(join(root, "docs/.vitepress/config.ts"), vitePressEntry); + + for (const helper of ownedHelpers) { + await writeFile(join(root, helper), "export const value = 2;\n"); + expect(taskHash(root, "knip", cache), helper).not.toBe(initial.get("knip")); + await writeFile(join(root, helper), initialHelper); + } + await mkdir(join(root, "docs/.vitepress/dist"), { recursive: true }); + await writeFile( + join(root, "docs/.vitepress/dist/bundle.js"), + "export const value = 1;\n", + ); + expect(taskHash(root, "knip", cache)).toBe(initial.get("knip")); await writeFile(join(root, "vitest.config.ts"), "export {};\n"); expect( diff --git a/turbo.json b/turbo.json index 067df72f3e..f00d3a958b 100644 --- a/turbo.json +++ b/turbo.json @@ -42,14 +42,13 @@ "scripts/run-typescript.mjs", "src/**/*.{cts,mts,ts,tsx}", "src/**/package.json", - "tests/**/*.{cts,mts,ts,tsx}", + "tests/**/*.{cjs,cts,js,jsx,mjs,mts,ts,tsx}", "tests/**/package.json", "tsconfig.json", "tsconfig.build.json", "tsconfig.scripts.json", "vitest*.config.ts", - "scripts/**/*.d.{cts,mts,ts}", - "scripts/**/*.mjs", + "scripts/**/*.{cjs,cts,js,jsx,mjs,mts,ts,tsx}", "scripts/**/package.json", ".github/actions/**/*.{cts,mts,ts,tsx}", ".github/**/package.json", @@ -109,15 +108,19 @@ "package.json", "package-lock.json", "scripts/**/*.{cjs,cts,js,jsx,mjs,mts,ts,tsx}", - "src/**/*.ts", - "tests/**/*.ts", + "src/**/*.{cjs,cts,js,jsx,mjs,mts,ts,tsx}", + "tests/**/*.{cjs,cts,js,jsx,mjs,mts,ts,tsx}", + "{src,tests,scripts}/**/package.json", ".github/actions/**/*.{cjs,cts,js,jsx,mjs,mts,ts,tsx}", ".github/**/package.json", ".github/workflows/*.{yml,yaml}", ".github/**/action.{yml,yaml}", "tsconfig.json", "tsconfig.build.json", - "docs/.vitepress/config.ts", + "docs/.vitepress/**/*.{cjs,cts,js,jsx,mjs,mts,ts,tsx}", + "docs/.vitepress/**/package.json", + "!docs/.vitepress/cache/**", + "!docs/.vitepress/dist/**", "*.{cjs,cts,js,jsx,mjs,mts,ts,tsx}" ] },