From 32cbddc1db2708846f1c96085883bdabd2fad0a9 Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Tue, 27 Oct 2026 02:15:52 -0700 Subject: [PATCH] ci: fix E2E coverage packaging (lcov duplicate functions) on cloud/1.56 ## Summary `upload-e2e-coverage / package` fails on every PR to `cloud/1.57`: lcov 2.4 aborts the shard merge with `(inconsistent) duplicate function 'inner_clicked'` (LiteGraph has several same-named closures in one file). `main` (in #17623) and `core/1.57` already pass `--ignore-errors inconsistent,corrupt` to that merge. This brings the same two lines to `cloud/1.57`. Function coverage is not published; line data is kept. ## Changes - `scripts/cicd/package-e2e-coverage.sh`: the file now matches `core/1.57` byte for byte. ## Evidence Failing on the `cloud/1.57` backport of #21320: `lcov: ERROR: (corrupt) unable to read trace file ... duplicate function 'inner_clicked' starts on line "src/lib/litegraph/src/LGraphCanvas.ts":1431`. The same backport to `core/1.57` (#21869) passed this job. CI-only. No app code changes. Related: #21840 (the same fix for `main`, now redundant there). (cherry picked from commit a81f8a0d1002b3e50c0d60c79e228b02e3e49b13) --- .github/workflows/ci-tests-e2e.yaml | 2 +- scripts/cicd/package-e2e-coverage.sh | 9 +++++++- scripts/cicd/package-e2e-coverage.test.ts | 26 +++++++++++++++++++++++ 3 files changed, 35 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-tests-e2e.yaml b/.github/workflows/ci-tests-e2e.yaml index 9d3371d453d..f56f946ddb6 100644 --- a/.github/workflows/ci-tests-e2e.yaml +++ b/.github/workflows/ci-tests-e2e.yaml @@ -438,7 +438,7 @@ jobs: }} uses: ./.github/workflows/ci-tests-e2e-coverage-package.yaml with: - source_sha: ${{ github.event.pull_request.head.sha || github.sha }} + source_sha: ${{ github.sha }} # A shard that died partway still uploads a tracefile, and one that # produced none fails its own upload, so the matrix verdict is what # makes the merge trustworthy for trend reporting. diff --git a/scripts/cicd/package-e2e-coverage.sh b/scripts/cicd/package-e2e-coverage.sh index 63f7e9556f9..6a2b41ddbca 100755 --- a/scripts/cicd/package-e2e-coverage.sh +++ b/scripts/cicd/package-e2e-coverage.sh @@ -64,7 +64,14 @@ ADD_ARGS=() for file in "${COVERAGE_FILES[@]}"; do ADD_ARGS+=(-a "$file") done -lcov "${ADD_ARGS[@]}" -o "$COVERAGE_DIR/coverage.lcov" +# Istanbul can emit the same nested function name at different source lines in +# one tracefile (for example LiteGraph's inner_clicked callbacks). Function +# coverage is not published below, so retain the valid line data instead of +# failing the whole coverage package on lcov's function-metadata consistency +# check. `corrupt` is paired with `inconsistent` because lcov reports both for +# this single condition. +lcov "${ADD_ARGS[@]}" -o "$COVERAGE_DIR/coverage.lcov" \ + --ignore-errors inconsistent,corrupt MERGED_SF=$(grep -c '^SF:' "$COVERAGE_DIR/coverage.lcov" || true) MERGED_LH=$(awk -F: '/^LH:/{s+=$2}END{print s+0}' "$COVERAGE_DIR/coverage.lcov") diff --git a/scripts/cicd/package-e2e-coverage.test.ts b/scripts/cicd/package-e2e-coverage.test.ts index 4f1bb8094d4..e8a468ff75b 100644 --- a/scripts/cicd/package-e2e-coverage.test.ts +++ b/scripts/cicd/package-e2e-coverage.test.ts @@ -83,6 +83,10 @@ set -euo pipefail if [[ "$1" == "--remove" ]]; then exit 0 fi +if [[ " $* " != *" --ignore-errors inconsistent,corrupt "* ]]; then + echo 'missing function-metadata error allowance' >&2 + exit 64 +fi inputs=() output='' while [[ $# -gt 0 ]]; do @@ -193,6 +197,18 @@ describe('package-e2e-coverage.sh', () => { expect(result.output).not.toContain('::warning::') }) + it('preserves line coverage when function metadata is inconsistent', () => { + using fixture = coverageFixture() + fixture.writeShard('e2e-coverage-shard-1', coverage('src')) + + const result = fixture.run(true) + + expect(result.status).toBe(0) + expect( + readFileSync(join(fixture.output, 'coverage.lcov'), 'utf8') + ).toContain('SF:src/file 0.ts') + }) + // Preserves #15342: a flaky shard must not discard every other shard's real // coverage. It stays published for Codecov and the PR comment, but flagged. it('publishes a run with a whitespace path but flags a red matrix', () => { @@ -302,6 +318,16 @@ describe('completeness gate wiring', () => { ) }) + it('packages coverage against the revision exercised by the workflow', () => { + const job = field( + readWorkflow('.github/workflows/ci-tests-e2e.yaml'), + 'jobs', + 'upload-e2e-coverage' + ) + + expect(field(job, 'with', 'source_sha')).toBe('${{ github.sha }}') + }) + it('gates the saved E2E baseline on a whole merge', () => { const steps = jobSteps( readWorkflow('.github/workflows/coverage-slack-notify.yaml')