Skip to content

Commit b170185

Browse files
authored
Merge pull request #29 from KostasCherv/codex/coverage-gate
ci: enforce measured test coverage baselines
2 parents a6e9cbd + ad686b6 commit b170185

7 files changed

Lines changed: 277 additions & 63 deletions

File tree

.github/workflows/ci.yml

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,19 @@ jobs:
3131
SUPABASE_URL: https://example.com
3232
SUPABASE_SECRET_KEY: dummy-secret-key-for-ci
3333
SUPABASE_JWKS_URL: https://example.com/auth/v1/.well-known/jwks.json
34-
run: uv run python -m pytest tests/ -q
34+
run: >-
35+
uv run python -m pytest tests/ -q
36+
--cov=src
37+
--cov-fail-under=73
38+
--cov-report=term-missing
39+
--cov-report=xml:coverage.xml
40+
- name: Upload backend coverage
41+
if: always()
42+
uses: actions/upload-artifact@v4
43+
with:
44+
name: backend-coverage
45+
path: coverage.xml
46+
if-no-files-found: warn
3547
- name: AI regression gate
3648
if: always()
3749
run: uv run python -m src.evals.regression_gate --output reports/ai-regression-${{ github.sha }}.json
@@ -62,8 +74,15 @@ jobs:
6274
run: npx eslint src --max-warnings=0
6375
- name: Typecheck
6476
run: npx tsc --noEmit -p tsconfig.app.json
65-
- name: Test
66-
run: npx vitest run
77+
- name: Test with coverage
78+
run: npm run test:coverage
79+
- name: Upload UI coverage
80+
if: always()
81+
uses: actions/upload-artifact@v4
82+
with:
83+
name: ui-coverage
84+
path: ui/coverage/
85+
if-no-files-found: warn
6786
- name: Install Playwright browser
6887
run: npx playwright install --with-deps chromium
6988
- name: Browser smoke test

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ __pycache__
1010
cortex.egg-info
1111
.ruff_cache
1212
.pytest_cache
13+
.coverage
14+
coverage.json
15+
coverage.xml
16+
ui/coverage
1317
.mypy_cache
1418
chroma_db
1519
reports

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,16 +414,23 @@ Used for generation-level observability, user scoring, and evaluation datasets.
414414

415415
```bash
416416
uv run pytest -v
417+
uv run pytest --cov=src --cov-fail-under=73 --cov-report=term-missing
417418
uv run ruff check src
418419
uv run mypy src
419420

420421
cd ui
421422
npm run lint
422-
npm test
423+
npm run test:coverage
423424
npx playwright install chromium # first run only
424425
npm run test:e2e
425426
```
426427

428+
CI enforces the measured coverage baseline rather than an aspirational target:
429+
backend coverage must remain at least 73%, while UI statements, branches,
430+
functions, and lines must remain at least 19%, 19%, 12%, and 20%. Coverage
431+
reports are uploaded as workflow artifacts for each run. Raise these floors as
432+
the test suite improves.
433+
427434
The Playwright smoke journey uses local fixtures—no Google, Supabase, or model
428435
credentials are required. It restores an authenticated browser session, creates a
429436
research session, consumes paced SSE progress/report events, and verifies the

0 commit comments

Comments
 (0)