From 417283ece8273579ce22a0262ff78fc54ac14b39 Mon Sep 17 00:00:00 2001 From: Lucas Tonon Date: Sat, 18 Jul 2026 23:23:06 -0300 Subject: [PATCH 1/2] ci: add pytest-cov coverage measurement and gate to backend-test Adds pytest-cov to backend/requirements.txt and runs the suite with --cov=. --cov-report=xml --cov-report=term-missing, uploading the coverage.xml as a build artifact. Sets --cov-fail-under=60 as a floor (measured baseline is ~66%), catching future regressions in untested modules while leaving headroom. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01Wp66uSq9saSpRq9Bbmjxj4 --- .github/workflows/ci.yml | 12 +++++++++++- backend/requirements.txt | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 12338cb..cdcc835 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,7 +40,17 @@ jobs: python-version: "3.11" cache: pip - run: pip install -r requirements.txt - - run: pytest tests/ -v --tb=short + - run: | + pytest tests/ -v --tb=short \ + --cov=. \ + --cov-report=xml \ + --cov-report=term-missing \ + --cov-fail-under=60 + - uses: actions/upload-artifact@v4 + if: always() + with: + name: backend-coverage + path: backend/coverage.xml backend-security: name: Backend Security Scan diff --git a/backend/requirements.txt b/backend/requirements.txt index 37850d1..4f260ed 100644 --- a/backend/requirements.txt +++ b/backend/requirements.txt @@ -26,6 +26,7 @@ nbformat>=5.10.0 jupyter_client>=8.6.0 pytest>=9.0.0 pytest-asyncio>=1.3.0 +pytest-cov>=6.0.0 httpx>=0.28.0 # Paper + web search backends From cd5851184a53a5fd8a865f96eac92d16d00cb30f Mon Sep 17 00:00:00 2001 From: Lucas Tonon Date: Mon, 20 Jul 2026 09:56:30 -0300 Subject: [PATCH 2/2] fix(review): address Greptile findings on #149 - Scope coverage to production code: add backend/.coveragerc omitting tests/ so test modules (always ~100% covered) no longer inflate the total. Adjust the gate 60 -> 50 to match real production coverage (51.27% measured; with tests included it was 65.81%). - Dismissed the artifact-name finding: Actions artifacts are scoped per workflow run, and this job uploads backend-coverage once per run, so concurrent runs cannot conflict. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01Wp66uSq9saSpRq9Bbmjxj4 --- .github/workflows/ci.yml | 5 ++++- backend/.coveragerc | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 backend/.coveragerc diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cdcc835..09e7ef8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,12 +40,15 @@ jobs: python-version: "3.11" cache: pip - run: pip install -r requirements.txt + # Coverage is scoped to production code: backend/.coveragerc omits + # tests/ so the gate reflects untested application code (with tests + # included the total was ~66%; production-only it is ~51%). - run: | pytest tests/ -v --tb=short \ --cov=. \ --cov-report=xml \ --cov-report=term-missing \ - --cov-fail-under=60 + --cov-fail-under=50 - uses: actions/upload-artifact@v4 if: always() with: diff --git a/backend/.coveragerc b/backend/.coveragerc new file mode 100644 index 0000000..a7cba45 --- /dev/null +++ b/backend/.coveragerc @@ -0,0 +1,3 @@ +[run] +omit = + tests/*