Repository navigation
ci: gate pushes and PRs on ruff + pytest at the production Python - #41
Merged
Merged
Conversation
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.
Contributor
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Nothing gated the suite: 215 tests already ran in ~5 s and
ruff checkfound 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 tomainand on PRs:pip install -r requirements-dev.txt→ruff check .→pytest. Python 3.11, the versionDockerfileships — 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 defaultE4, E7, E9, Fruleset so the gate is green from its first run. Wider candidates are recorded with their hit counts instead of being enabled:I00146,B12,UP10,SIM70,E501@120 262.requirements-dev.txt—ruff==0.15.12pinned 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 namedl, 6 lambdas assigned to a name.ruff format --checkis 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_loggerasserted'streaming_only' in str(BadRequestError). Dev has openai 2.30.0, which puts the whole error body instr(); a fresh install resolves openai 3.46.0 (requirements sayopenai>=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 checkse.status_code == 400instead.Practical consequence beyond the test: the next
docker buildupgrades 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 passedpytest→ 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 secretspyproject.tomlresolution confirmed viaruff check --show-settings(target 3.11, line-length 120) and a single-quote format probeNote: 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(.envcurrently gets baked into the image byCOPY . .), dependency pinning/constraints, and two still-wrongREVIEW.mdmarkers I left alone rather than half-fix: §6.1 claimstests/test_spark_parser.pyis the only test file (it's gone;cogs/spark_parser.pyhas no tests), and §2.8 marks/healthas implemented (no such command exists).