Skip to content

ci: run lint and a pytest suite on every PR and push to main - #3

Merged
yyeret merged 5 commits into
mainfrom
claude/ci-test-suite-922d36
Oct 6, 2026
Merged

yyeret merged 5 commits into
mainfrom
claude/ci-test-suite-922d36

Conversation

@yyeret

@yyeret yyeret commented Oct 6, 2026

Copy link
Copy Markdown
Owner

Summary

Every PR and push to main now runs lint and a 176-test suite on Python 3.11 and 3.13, and fails below 90% coverage. Until now nothing checked the flow-metric math, the API routes, or dashboard generation.

The suite never touches the network, gh, bws, or Gemini. subprocess.run is blocked for every test, each test runs in a temp directory, and a blocked call that production code swallows (its broad except Exception handlers would otherwise turn it into "no key" or "no PRs") still fails the test at teardown.

Expected values are worked out by hand from small synthetic PR sets, with time frozen. Three formulas were mutated as a spot check: two were caught immediately, and the third (p85 SLE index) survived until a 10-PR percentile test closed the gap.

Layers are selectable with pytest -m unit|integration|e2e, in roughly the 70/25/5 shape from the test-pyramid default. The issues-analytics tests that landed on main meanwhile were moved into the unit and integration layers, and issues.py is part of the coverage source.

Run it locally: pip install -r requirements-dev.txt && ruff check . && pytest --cov (also in the README).

Characterized, not fixed

Tests pin these current behaviors; production code is untouched apart from requirements.txt.

  • analyze_and_build_report raises KeyError when the data has no "repo" key; compute_flow_metrics defaults it.
  • p50/p85 SLE use int(n * p) indexing, so the "median" of two PRs is the larger one.
  • A merged PR landing exactly on the first weekly bin boundary is excluded from throughput (bins are start-exclusive).
  • calc_era_stats would raise TypeError if a merged-set PR had cycle_time_hours of None.

python-dotenv is now declared in requirements.txt; it was already installed transitively through uvicorn[standard].

Reviewer notes

  • The Python 3.11 leg could not be run locally (the dev venv is 3.14), so this PR's first CI run is its first test on 3.11.
  • Review was a focused pass (author's read plus one independent adversarial reviewer). It found a merge conflict with main, a swallowable subprocess guard, a weak dashboard assertion, and shallow CI-config checks; all four are fixed here. No unapplied findings.
  • Plan: docs/plans/2026-10-06-001-feat-ci-test-suite-plan.md.

Compound Engineering

🤖 Generated with Claude Code

yyeret and others added 5 commits October 6, 2026 07:05
Adds pyproject/requirements-dev, a subprocess/env/cwd isolation fixture,
PR factories, and unit tests for classification, per-PR metrics, stats,
flow-metric aggregates and app helpers. Declares python-dotenv.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Covers gh collection/pagination/cache, dashboard generation, every FastAPI
route, and one full collect->analyze->chat->dashboard pipeline with only gh
and Gemini faked.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Runs ruff (errors only) and pytest with a 90% coverage floor on a Python
3.11/3.13 matrix for PRs and pushes to main.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Resolves add/add conflicts in tests/conftest.py and requirements-dev.txt,
moves the issues-analytics tests into the unit/integration layers, and
adds issues.py to the coverage source.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@yyeret
yyeret merged commit 63c90f4 into main Oct 6, 2026
2 checks passed
@yyeret
yyeret deleted the claude/ci-test-suite-922d36 branch October 6, 2026 11:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant