ci: add ruff lint gate + sweep tests/ lint debt; harden session-validation tests#155
Merged
Merged
Conversation
…ation tests Adds a `lint` job to CI (ruff check + ruff format --check on src/ + tests/), pinned to ruff 0.15.8 to match the ruff-pre-commit rev. Until now nothing linted the whole tree: the pre-commit hook only sees changed files and CI had no ruff step, so lint debt accumulated invisibly. `build` now needs lint. Enabling that gate required clearing the pre-existing debt in tests/ (src/ was already clean): - 411 F401 unused-imports: removed the dead ones; the 45 intentional availability probes (`from google.genai import types` / `import numpy` inside try/except ImportError or skipif guards) get an explicit `# noqa: F401` since deleting them would break skip logic. - 92 F841 unused-variables: dropped the dead bindings while preserving the side-effecting calls (e.g. `result = agent.run(...)` -> `agent.run(...)`). Also hardens the four Supabase namespace-validation tests carried in by #154: they had been re-pointed at the module-level `_validate_namespace` in isolation, leaving an orphaned `store` local (4x F841) and exercising no store path. Routed them back through `store._key("sid", namespace=...)` so the validator's wiring into _key is actually asserted, which also removes the duplicate/unsorted import. Full suite: 7469 passed, 205 skipped, coverage 91.01% (gate 90%). Claude-Session: https://claude.ai/code/session_01HQhq1HKYipPa6rjQAzffcg
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.
Follow-up to #154. Two things: close the lint-enforcement gap, and finish the test polish #154 left behind.
Add ruff to CI
New
lintjob runsruff check+ruff format --checkonsrc/andtests/, pinned to ruff 0.15.8 to match theruff-pre-commitrev (no CI-vs-local drift).buildnowneeds: [lint, test, security].Why this matters: nothing was linting the whole tree. The pre-commit hook only sees changed files and
ci.ymlhad no ruff step, so lint debt piled up invisibly. (This is also how #154 merged with lint violations — CI was green because CI didn't lint.)Clear the pre-existing tests/ debt (required to turn the gate on)
src/was already 100% clean.tests/had 504 violations:from google.genai import types/import numpyinsidetry/except ImportErrororskipifguards) get an explicit# noqa: F401since deleting them breaks skip logic.result = agent.run(...)→agent.run(...)), verified against ruff's fix behavior.Harden the #154 namespace tests
The four Supabase namespace-validation tests had been re-pointed at the module-level
_validate_namespacein isolation, leaving an orphanedstorelocal (the 4 F841s) and exercising no store path — so a future edit dropping the validator from_keywould pass silently. Routed them back throughstore._key("sid", namespace=...), which asserts the wiring and removes the duplicate/unsorted import.Verification
ruff check src/ tests/→ All checks passed (under both 0.15.8 and 0.15.17)ruff format --check src/ tests/→ 418 files already formattedScope: only
tests/+.github/workflows/ci.yml.src/untouched.https://claude.ai/code/session_01HQhq1HKYipPa6rjQAzffcg