Skip to content

ci: gate pushes and PRs on ruff + pytest at the production Python - #41

Merged
Zeptiny merged 4 commits into
mainfrom
chore/ci-and-lint
Nov 6, 2026
Merged

Zeptiny merged 4 commits into
mainfrom
chore/ci-and-lint

Conversation

@Zeptiny

@Zeptiny Zeptiny commented Nov 6, 2026

Copy link
Copy Markdown
Owner

Why

Nothing gated the suite: 215 tests already ran in ~5 s and ruff check found only 25 issues across 26.5k lines, so the whole gate was missing rather than broken. This adds it, clears the 25 findings, and fixes the one test that a fresh dependency install would turn red.

What

.github/workflows/ci.yml — one job on push to main and on PRs: pip install -r requirements-dev.txt → ruff check . → pytest. Python 3.11, the version Dockerfile ships — local development runs 3.14, and that gap is the point (see the finding below).

pyproject.toml — ruff settings: target-version = "py311", line-length = 120, quote-style = "single" (the tree is single-quoted; the formatter default would rewrite it), and the default E4, E7, E9, F ruleset so the gate is green from its first run. Wider candidates are recorded with their hit counts instead of being enabled: I001 46, B 12, UP 10, SIM 70, E501@120 262.

requirements-dev.txt — ruff==0.15.12 pinned exactly, so CI and local runs agree on what an error is.

Lint cleanup (behaviour untouched) — 4 imports that stopped being used (tasks, HISTORY_WINDOW_OVERLAP, json, TAVILY_AVAILABLE, each checked unused first), 1 f-string with no placeholders, 6 comprehension vars named l, 6 lambdas assigned to a name.

ruff format --check is deliberately not in CI — even with quotes preserved, it still wants to rewrap 72 files. That belongs in its own commit.

A finding worth reading

The 3.11 run caught a real break: test_api_logger asserted 'streaming_only' in str(BadRequestError). Dev has openai 2.30.0, which puts the whole error body in str(); a fresh install resolves openai 3.46.0 (requirements say openai>=1.30.0), which puts only the provider's message text there — so the assertion fails. The response body it wanted is already asserted from the logged record a few lines below, which is what that test is actually about, so it now checks e.status_code == 400 instead.

Practical consequence beyond the test: the next docker build upgrades the bot from openai 2.x to 3.x with no code change and no signal. That's the pinning gap, not this one, but the CI would have gone red on it immediately.

Verification

  • ruff check . → all checks passed
  • pytest → 215 passed on Python 3.14 (local) and on a Python 3.11 venv with openai 3.46, from a clean copy of the tree with no .env — the exact CI condition, so the workflow needs no secrets
  • pyproject.toml resolution confirmed via ruff check --show-settings (target 3.11, line-length 120) and a single-quote format probe
  • Workflow YAML parsed; each commit is independently green

Note: CI installs sentence-transformers, which pulls torch — the first run will be slow until the pip cache warms up. Dropping it to an extra is part of the container cleanup, not this PR.

Not in scope

.dockerignore (.env currently gets baked into the image by COPY . .), dependency pinning/constraints, and two still-wrong REVIEW.md markers I left alone rather than half-fix: §6.1 claims tests/test_spark_parser.py is the only test file (it's gone; cogs/spark_parser.py has no tests), and §2.8 marks /health as implemented (no such command exists).

openai>=2.30 rendered the whole error body inside str(BadRequestError);
openai 3.x renders only the provider's message text, so 'streaming_only'
disappeared and the test went red on a fresh install of the unpinned
requirements. The body it wanted is still checked from the logged record
below, which is what this test is actually about.

Also names the log-record loop variables rec/raw instead of l, clearing
this file's E741 hits for the lint gate added next.
Four imports that stopped being used (tasks, HISTORY_WINDOW_OVERLAP, json,
TAVILY_AVAILABLE), one f-string with nothing to interpolate, six comprehension
variables named l now named after what they hold, and six lambdas assigned to a
name written as the defs their call sites already treat them as.

Behaviour is untouched: every rename is scoped to its own comprehension or
nested function, and the removed imports were checked unused first.
Nothing gated the suite before: 215 tests already ran in about six seconds and
the tree was nearly lint-clean, so the missing piece was only the runner. One
job installs requirements-dev.txt — which doubles as the check that the
documented install still resolves — then ruff check ., then pytest, on 3.11,
the version the image ships, while local development runs 3.14.

pyproject.toml keeps the ruff settings. quote-style single matters: the tree is
single-quoted and the formatter's default would rewrite it. The ruleset stays
the default E4/E7/E9/F so the gate is green from its first run; the wider
candidates and their hit counts are written down in REVIEW.md 6.3 instead.
@coderabbitai

coderabbitai Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 33a514a2-5f67-474c-bb2b-726b23209d1e
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

v4 and v5 still run on a deprecated Node and GitHub annotates every run about
it; v7 is what both repos ship now.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
@Zeptiny
Zeptiny merged commit 732a5d4 into main Nov 6, 2026
2 checks passed
@Zeptiny
Zeptiny deleted the chore/ci-and-lint branch November 9, 2026 15:11
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