[quality] test.yml runs vitest coverage but never publishes the report — add lcov/json-summary artifact and job summary

Đã đóng Phù hợp với người mới
#209 6 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
78/100
Loại issue
Tính năng
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
github-actions, javascript
Lĩnh vực
ci-cd, testing-qa

Hướng nghiên cứu

Bắt đầu với .github/workflows/test.yml ở dòng 19 và kiểm tra step npm run test:coverage hiện có cùng các reporters trong vitest.config.mjs. Chạy lệnh coverage cục bộ để xác nhận các output coverage/ dự kiến, sau đó xác minh trong một lần chạy workflow main rằng các tệp lcov và json-summary được tải lên và bảng coverage xuất hiện trong phần tóm tắt của job build-test.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

agent/quality hive/covered-by-pr hive/hosted-available-lke648397-260827-5q9t kind/cleanup needs-decision quality testing

Finding

.github/workflows/test.yml:19 runs npm run test:coverage on every push and PR, and vitest.config.mjs gates it with thresholds (85/83/91/85). But the report is never published: reporters are text + text-summary only, so the numbers exist solely in the job log. Nothing is uploaded as an artifact, written to the job summary, or sent to a coverage service.

Consequences:

  • A PR that drops coverage from 96% to 86% passes green with no visible signal — the threshold gate only fires ~10 points below the current floor (the raise in #202 narrows but does not close that window).
  • No coverage trend across main; the "did this PR add or remove coverage" question requires opening the raw log of both runs.
  • Coverage-gap analysis (this lane's and any maintainer's) has to be regenerated locally each time rather than read from CI.

Evidence, main @ 187c5e3 (run 35910387179, green): npm ci && npm run test:coverage → All files | 96.35 stmts | 94.55 branch | 99.14 funcs | 96.16 lines. The prow / prow check on PRs dogfoods the built action but emits no coverage data, so there is no end-to-end coverage source to publish either — this is purely a unit-coverage reporting gap.

Recommendation

Emit machine-readable coverage from the existing step and publish it as an artifact plus a job-summary table. Uses CLI reporter overrides so vitest.config.mjs is untouched (that file is currently held by #202).

Exact replacement for .github/workflows/test.yml — replace line 19 ( - run: npm run test:coverage) with:

      - run: >-
          npm run test:coverage --
          --coverage.reporter=text
          --coverage.reporter=text-summary
          --coverage.reporter=lcov
          --coverage.reporter=json-summary
      - name: Coverage summary
        if: always()
        run: |
          [ -f coverage/coverage-summary.json ] || exit 0
          node -e '
            const t = require("./coverage/coverage-summary.json").total;
            const row = k => `| ${k} | ${t[k].pct}% | ${t[k].covered}/${t[k].total} |`;
            console.log("### Coverage (`vitest --coverage`)\n\n| Metric | % | Covered |\n|---|---|---|");
            for (const k of ["statements","branches","functions","lines"]) console.log(row(k));
          ' >> "$GITHUB_STEP_SUMMARY"
      - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
        if: always()
        with:
          name: coverage-${{ github.sha }}
          path: coverage/
          retention-days: 14

Notes for the maintainer applying this:

  • --coverage.reporter= is repeatable and replaces the config's reporter array for that invocation, so text and text-summary are restated to keep the existing log output.
  • coverage/ is already git-ignored (git check-ignore coverage → match), so the later git status --porcelain dist/ drift check is unaffected.
  • The lcov output is what a service such as Codecov consumes if the project ever wants one; no service is proposed here.
  • Pin the upload-artifact SHA against the current v4 release before applying; the SHA above is v4.6.2 at time of filing.

Why no PR: the change is entirely inside .github/workflows/. This agent's App token is minted at the contributor tier without the Workflows permission, so GitHub rejects any push touching that directory. It needs a human or an ISSUES_PRS_MERGE-tier agent to land. No part of the fix lies outside .github/workflows/ (adding reporters to vitest.config.mjs would work too, but that file is occupied by #202, and the CLI override above makes it unnecessary).

Completion criteria

  • test.yml emits lcov + json-summary coverage and uploads coverage/ as an artifact
  • Coverage table appears in the build-test job summary on a main run

Priority

  • Impact: low — coverage is high today; this is visibility, not a correctness gap
  • Effort: low

Filed by quality agent (hold-gated mode)

🐝 Hive Agent: quality | Instance: hosted-available-lke648397-260827-5q9t | SHA: unknown

— hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88

Ngôn ngữ chính
TypeScript
Star
135
Fork
24
Merge trung bình
1 ngày 6 giờ
Pull request đã merge (30 ngày)
232

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của cncf/prow-github-actions

Tất cả issue của cncf/prow-github-actions

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.