Repository navigation
SEL-282: Gateway ruff gate enforces only Pyflakes (F) - #149
Merged
Merged
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
PetrefiedThunder
force-pushed
the
agent/grok/sel-282
branch
2 times, most recently
from
October 19, 2026 07:57
d2ccbc4 to
dd14225
Compare
Linear: SEL-282 Refs #110 Engine: grok (fleet coding engine, Grok Bot dispatch)
PetrefiedThunder
force-pushed
the
agent/grok/sel-282
branch
from
October 19, 2026 10:02
dd14225 to
8e29e23
Compare
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.
Linear: SEL-282
Fixes #110
Coding engine: grok, dispatched by Grok Bot for C.Lee.
What changed
The gateway lint gate still only selected Pyflakes (
F) at this tip (611fdf3). CI’sruff checkpassed, and the same tree under the Python SDK rule set (E,F,W,I,N,UP,B,C4) reported 1780 errors. The issue’s 2159 count was from an older commit.gateway/ruff.tomlnow selects that SDK set. These codes stay ignored, with the reason in the file, because cleaning them here would be a large or behavior-changing rewrite:E501,I001,UP007,UP017,UP035,UP042,UP045,B904,C408,N818. Every other selected rule is enforced, including the ones the audit named (B023,B905,E402).Existing violations of the enforced rules are fixed. Loop closures bind the loop variables.
zipcalls that are equal-length by construction passstrict=True. The latejsonimport in receipts moved to the top; script imports that must follow env orsys.pathsetup are markednoqa. FastAPIDepends/Query/Body/Header/Securitystay legal default arguments. The preflight handler no longer uses one sharedPreflightRequest()as its default; an omitted body still runs the empty-override sweep. A new test locks the rule set so a later edit cannot drop back to Pyflakes-only.I001, the ignored pyupgrade codes,B904,C408, andN818still do not fail new code. The rest of the SDK set does.How verified
From
gateway/, ruff 0.16.10 (the CI pin):uvx ruff@0.16.10 check . --select E,F,W,I,N,UP,B,C4 --ignore E501 --statisticsbefore the edit:Found 1780 errors.uvx ruff@0.16.10 check .with the old config:All checks passed!After the edit:
uvx ruff@0.16.10 check .→All checks passed!uvx ruff@0.16.10 format --check .→660 files already formatted/tmp/sel282-venv/bin/python -m pytest tests/test_ruff_gate.py tests/test_preflight.py tests/test_qa_svc_money_gaps.py::test_non_finite_transfer_moves_no_money tests/test_mcp_legacy_envelope_validation.py::test_non_finite_argument_is_refused_before_execution tests/test_mcp_transport_hardening.py::test_standard_unrenderable_json_is_refused_with_no_effect tests/test_billing.py::test_rejected_charge_does_not_inflate_velocity_counters tests/test_constant_test_loop.py::test_partner_api_key_bootstrap_json_output tests/test_constant_test_loop.py::test_malformed_tool_args_are_a_configuration_error tests/test_gateway_auth_breakit.py::test_jwt_signed_by_wrong_key_rejected tests/test_gateway_auth_breakit.py::test_expired_jwt_rejected -q --tb=short→28 passed in 4.50s/tmp/sel282-venv/bin/python -m pytest tests/test_preflight.py::test_preflight_omitted_body_stays_optional tests/test_ruff_gate.py -q --tb=short→2 passed in 0.69sA read-only Muse review of the zip, preflight, and loop-closure edits reported no defects. The full gateway pytest suite was not run.
Not done / follow-ups
Import sorting (
I001), the ignored pyupgrade codes, exception chaining (B904),C408, and exception renames (N818) are still a backlog. New code of those codes will passruff checkuntil each ignore is removed.tests/test_discover_kyc_honesty.pyunpacks an expected Stripe status and a KYC flag and never asserts them. The names are now marked unused. The assertions were left as they were, because the table does not match the checks in the test body.Note
Low Risk
Mostly lint and style fixes; the preflight default change is a small FastAPI binding fix with a regression test, and singleton caches remain functionally equivalent.
Overview
Aligns gateway
ruff checkwith the Python SDK rule set instead of Pyflakes-only (F), so CI now enforces bugbear/pyupgrade-style checks (e.g.B023loop closures,B905zip(..., strict=True),E402import order) while keeping a documented ignore list for large backlogs (I001, selectedUP*codes,B904,C408,N818,E501). FastAPIDepends/Body/etc. are whitelisted viaextend-immutable-calls.Mechanical fixes across app, failure_lab, scripts, and tests so the tree passes under the expanded gate:
@lru_cachewithout empty parens,TimeoutErrorinstead ofasyncio.TimeoutError, moderndict/listannotations, comprehension/set tweaks, and closure fixes in invariant-attack harnesses. Behavioral tweaks: preflight usesBody(default_factory=PreflightRequest)(avoids a shared default instance; omitted body still works—covered by a new test); MCPToolCallResponsekeeps camelCase wire names with naming noqa.Adds
tests/test_ruff_gate.pyto lock the selected rules and ensure audit-highlighted codes are not globally ignored.Reviewed by Cursor Bugbot for commit 8e29e23. Bugbot is set up for automated code reviews on this repo. Configure here.