From a22deec38d49ea38b3723d589c250ff8d2b298f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Pr=C5=AF=C5=A1a?= <87543374+Patai5@users.noreply.github.com> Date: Mon, 30 Nov 2026 07:39:49 -0800 Subject: [PATCH 1/5] ci: skip Claude for failures that open issues already cover --- .../actions/failure-signatures/action.yaml | 52 +++ .github/scripts/failure-signatures.mjs | 7 + .github/workflows/_check_code.yaml | 2 +- ...form-tests-claude-investigate-and-fix.yaml | 46 ++- .husky/pre-commit | 4 +- .prettierignore | 3 +- CONTRIBUTING.md | 4 +- docs/workflows.md | 34 +- package.json | 2 +- .../github-scripts/failure-signatures.test.ts | 339 ++++++++++++++++++ workflow-scripts-src/failure-signatures.ts | 262 ++++++++++++++ 11 files changed, 727 insertions(+), 28 deletions(-) create mode 100644 .github/actions/failure-signatures/action.yaml create mode 100644 .github/scripts/failure-signatures.mjs create mode 100644 test/unit/github-scripts/failure-signatures.test.ts create mode 100644 workflow-scripts-src/failure-signatures.ts diff --git a/.github/actions/failure-signatures/action.yaml b/.github/actions/failure-signatures/action.yaml new file mode 100644 index 0000000..f5e0504 --- /dev/null +++ b/.github/actions/failure-signatures/action.yaml @@ -0,0 +1,52 @@ +name: Match failures to known issues +description: >- + `match` matches the run's failing tests to open issues by failure signature, `record` records the signatures that + matched nothing on the issue that now covers them. See workflow-scripts-src/failure-signatures.ts. +inputs: + mode: + description: '`match` or `record`' + required: true + new-issue-number: + description: The issue the investigation opened, if any, for `record`. + required: false + default: '' +outputs: + all-known: + description: '`true` when every failure matches an open issue' + value: ${{ steps.script.outputs.all-known }} + note: + description: When only some failures match, which issues cover them and which failing tests are left + value: ${{ steps.script.outputs.note }} + +# The script ships with this action as a bundle (npm run bundle), so nothing is checked out or installed. +runs: + using: 'composite' + steps: + - name: Run the script + id: script + uses: actions/github-script@v9 + env: + MODE: ${{ inputs.mode }} + NEW_ISSUE_NUMBER: ${{ inputs.new-issue-number }} + MATCHES_PATH: ${{ runner.temp }}/failure-signatures.json + SCRIPT_PATH: ${{ github.action_path }}/../../scripts/failure-signatures.mjs + with: + script: | + const { matchKnownFailures, recordSignatures } = await import(process.env.SCRIPT_PATH); + const workspace = process.env.GITHUB_WORKSPACE; + const params = { github, context, core, matchesPath: process.env.MATCHES_PATH }; + if (process.env.MODE === 'match') { + await matchKnownFailures({ + ...params, + reportPath: `${workspace}/vitest-results/test-report.json`, + duplicatesPath: `${workspace}/duplicate-of.txt`, + }); + } else if (process.env.MODE === 'record') { + await recordSignatures({ + ...params, + dedupePath: `${workspace}/dedupe.json`, + newIssueNumber: Number(process.env.NEW_ISSUE_NUMBER) || undefined, + }); + } else { + throw new Error(`Unsupported mode '${process.env.MODE}'. Use 'match' or 'record'.`); + } diff --git a/.github/scripts/failure-signatures.mjs b/.github/scripts/failure-signatures.mjs new file mode 100644 index 0000000..245c623 --- /dev/null +++ b/.github/scripts/failure-signatures.mjs @@ -0,0 +1,7 @@ +import{createRequire as __createRequire}from'node:module';const require=__createRequire(import.meta.url); +import{createHash as A}from"node:crypto";import{appendFile as M,readFile as E,writeFile as _}from"node:fs/promises";import{stripVTControlCharacters as k}from"node:util";var S="platform-test-signatures",R=new RegExp(``),T=16,F=new RegExp(`^[\\da-f]{${T}}$`),x=200,B=["OWNER","MEMBER","COLLABORATOR"],C="(outside any test)";function v(e){return k(e).replace(/https?:\/\/\S+/g,"").replace(/\d{4}-\d{2}-\d{2}[T ][\d:.]+Z?/g,"