Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Coverage

on:
pull_request:

jobs:
coverage:
name: Run Tests and Upload Coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6

- uses: actions/setup-go@v6
with:
go-version-file: go.mod

- name: Run tests with coverage
run: go list ./... | grep -v -e /test -e /e2e | xargs go test -race -coverprofile=coverage.out -covermode=atomic
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

xargs without -r will run go test against the current directory if all packages are filtered.

If grep -v -e /test -e /e2e produces empty output (e.g., in a repo where all packages match the excluded paths), xargs go test ... receives no stdin and runs go test -race -coverprofile=coverage.out -covermode=atomic with no arguments — testing only the root package instead of failing clearly.

🔧 Proposed fix
-        run: go list ./... | grep -v -e /test -e /e2e | xargs go test -race -coverprofile=coverage.out -covermode=atomic
+        run: go list ./... | grep -v -e /test -e /e2e | xargs -r go test -race -coverprofile=coverage.out -covermode=atomic
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
run: go list ./... | grep -v -e /test -e /e2e | xargs go test -race -coverprofile=coverage.out -covermode=atomic
run: go list ./... | grep -v -e /test -e /e2e | xargs -r go test -race -coverprofile=coverage.out -covermode=atomic
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/coverage.yml at line 18, The workflow run command uses
xargs without the "no-run-if-empty" option, so if the package list is empty it
will run "go test" against the repo root; update the run command string to pass
xargs the option to not run when stdin is empty (e.g., add "-r" or
"--no-run-if-empty" to the xargs invocation in the run: line so the pipeline
fails/short-circuits instead of unintentionally testing the root package).


- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
fail_ci_if_error: true
verbose: true
dry_run: true
Comment on lines +20 to +25
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Add token input to Codecov action; add a push trigger for baseline coverage.

Two related gaps:

  1. Missing token: For private repositories, codecov/codecov-action requires token: ${{ secrets.CODECOV_TOKEN }}. Without it, uploads will fail silently or with auth errors, and fail_ci_if_error: true will break CI.

  2. No baseline uploads: The workflow only fires on pull_request. The project.default: target: auto in codecov.yml compares against the base commit's coverage, but if coverage is never uploaded on pushes to the default branch, there is no baseline to compare against. Add a push trigger (restricted to the default branch) so merged commits populate Codecov's history.

🛡️ Proposed fix
 on:
   pull_request:
+  push:
+    branches:
+      - main

 ...

       - name: Upload coverage to Codecov
         uses: codecov/codecov-action@v5
         with:
+          token: ${{ secrets.CODECOV_TOKEN }}
           fail_ci_if_error: true
           verbose: true
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/coverage.yml around lines 20 - 25, Add the missing Codecov
token input and a push trigger for baseline uploads: update the codecov step
that uses codecov/codecov-action@v5 to include token: ${{ secrets.CODECOV_TOKEN
}} alongside existing inputs (fail_ci_if_error, verbose, dry_run) so private
repo uploads authenticate, and modify the workflow triggers to also run on push
to the default branch (so baseline coverage is uploaded on merges) in addition
to pull_request.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

dry_run: true prevents any coverage data from ever being uploaded — remove it.

With dry_run: true, the codecov/codecov-action processes coverage locally but never sends anything to Codecov. This completely defeats the purpose of this PR. Combined with informational: false on both checks in codecov.yml, this also means every PR will have permanently-pending (or missing) Codecov status checks that can block merges.

🐛 Proposed fix
       - name: Upload coverage to Codecov
         uses: codecov/codecov-action@v5
         with:
           fail_ci_if_error: true
           verbose: true
-          dry_run: true
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
dry_run: true
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
fail_ci_if_error: true
verbose: true
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/coverage.yml at line 25, The workflow is configured with
the codecov action using dry_run: true which prevents any coverage from being
uploaded; remove or set dry_run to false in the codecov/codecov-action step so
the action actually sends coverage to Codecov, and then verify codecov.yml’s
informational settings (the informational: false entries) are adjusted if you
want status checks to report — ensure the step that calls the Codecov action no
longer includes dry_run and that the action runs with the proper token and
environment to upload results.

17 changes: 17 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
coverage:
status:
project:
default:
target: auto
threshold: 1%
informational: false

patch:
default:
target: 70%
threshold: 0%
informational: false
only_pulls: true

ignore:
- "**/e2e/**"
Loading