Fix the lint on vllm_mm #43

Closed
opened 2026-09-18 03:15:55 +00:00 by Mark · 1 comment
Owner

What is dirty

ruff check . from the repo root returns 77 errors (vs 86 on origin/main pre-#38 — the #38 commit net-fixed 9 violations while adding new code). Categories:

31  F401  [*] unused-import
15  E402  [ ] module-import-not-at-top-of-file
14  E712  [ ] true-false-comparison
11  F841  [ ] unused-variable
 6  F541  [*] f-string-missing-placeholders
Found 77 errors.
[*] 37 fixable with the `--fix` option (25 hidden fixes can be enabled with the `--unsafe-fixes` option).

37 of 77 are auto-fixable with ruff check --fix; the remaining 40 are deliberate corrections (E712 true-false-comparison, E402 module-import-not-at-top-of-file, F841 unused-variable) that need human judgment. Use --unsafe-fixes policy as a separate question per row.

Why this blocks the lane

Per the 2026-07-08 rule on the kilo-gsd-runner profile: "we do not knowingly pass along lint errors repos." The kilo-gsd Lint gate runs ruff check . against the entire tree after every Implement phase. A feature-request ticket that touches only clean files still fails the gate if the baseline is dirty, and bugfix retries exhaust against lint that the implementer never touched. Confirmed in this run on Mark/vllm_mm#38 — the implementer's commit (ea16ebf) is correct and tests pass (96/96), but the pipeline halted because the gate cannot distinguish "introduced by this commit" from "pre-existing in baseline." A repo-cleanup commit unblocks every future feature dispatch on this repo.

What a real fix looks like

Fix every lint error reported above so ruff check . exits 0 against the repo root (not just the backend subdir). Sequence:

  1. ruff check --fix . to clear the 37 auto-fixable items. Review the diff — F401 unused-import removals should not break anything (the unused import is, by definition, unused); F541 extraneous f-prefix is purely cosmetic.
  2. Manually handle the 40 non-auto-fixable items:
    • E712 true-false-comparison (14): replace == True/== False with truthiness or explicit is True/is False where comparison is intentional. Many of these are in test fixtures.
    • E402 module-import-not-at-top-of-file (15): typical pattern is import after a docstring or after a from __future__ import annotations. Either move the import to top, or add a per-file # noqa: E402 with a comment explaining why.
    • F841 unused-variable (11): either use the variable or prefix with _ to silence. Some are deliberate (e.g. exception bindings used only for side effects).
  3. Verify ruff check . exits 0.
  4. Run backend tests (cd backend && pytest) to confirm nothing broke.
  5. Run frontend lint (npm run lint) separately — ruff does not check TS files in this repo; that's a separate concern tracked by eslint.

This ticket is intentionally NOT a kilo-gsd task. It is a HERMES KANBAN AGENT task (tasker-worker or similar code-writing worker). kilo-gsd is correctly gated OFF dirty repos and gets no carve-out here.

  • Mark/vllm_mm#38 was the trigger — its implementer's commit (ea16ebf) landed on origin/main despite the lint gate, via the saastools#12 recovery pattern. The recovery was justified because the implementer's diff was clean; future feature dispatches will not have that luxury.
  • 2026-07-08 user rule (kilo-gsd-lint-gate-whole-repo skill): bulk-block every open issue on a dirty repo with blocked:preflight until cleanup lands. Once this ticket closes, those blocks can be released.

Verification

cd /home/b/Projects/vllm_mm
ruff check . --statistics  # should print "All checks passed!"
cd backend && pytest        # should still be green
## What is dirty `ruff check .` from the repo root returns 77 errors (vs 86 on origin/main pre-#38 — the #38 commit net-fixed 9 violations while adding new code). Categories: ``` 31 F401 [*] unused-import 15 E402 [ ] module-import-not-at-top-of-file 14 E712 [ ] true-false-comparison 11 F841 [ ] unused-variable 6 F541 [*] f-string-missing-placeholders Found 77 errors. [*] 37 fixable with the `--fix` option (25 hidden fixes can be enabled with the `--unsafe-fixes` option). ``` 37 of 77 are auto-fixable with `ruff check --fix`; the remaining 40 are deliberate corrections (E712 true-false-comparison, E402 module-import-not-at-top-of-file, F841 unused-variable) that need human judgment. Use `--unsafe-fixes` policy as a separate question per row. ## Why this blocks the lane Per the 2026-07-08 rule on the kilo-gsd-runner profile: "we do not knowingly pass along lint errors repos." The kilo-gsd Lint gate runs `ruff check .` against the entire tree after every Implement phase. A feature-request ticket that touches only clean files still fails the gate if the baseline is dirty, and bugfix retries exhaust against lint that the implementer never touched. Confirmed in this run on Mark/vllm_mm#38 — the implementer's commit (ea16ebf) is correct and tests pass (96/96), but the pipeline halted because the gate cannot distinguish "introduced by this commit" from "pre-existing in baseline." A repo-cleanup commit unblocks every future feature dispatch on this repo. ## What a real fix looks like Fix every lint error reported above so `ruff check .` exits 0 against the repo root (not just the backend subdir). Sequence: 1. `ruff check --fix .` to clear the 37 auto-fixable items. Review the diff — `F401 unused-import` removals should not break anything (the unused import is, by definition, unused); `F541 extraneous f-prefix` is purely cosmetic. 2. Manually handle the 40 non-auto-fixable items: - `E712 true-false-comparison` (14): replace `== True`/`== False` with truthiness or explicit `is True`/`is False` where comparison is intentional. Many of these are in test fixtures. - `E402 module-import-not-at-top-of-file` (15): typical pattern is `import` after a docstring or after a `from __future__ import annotations`. Either move the import to top, or add a per-file `# noqa: E402` with a comment explaining why. - `F841 unused-variable` (11): either use the variable or prefix with `_` to silence. Some are deliberate (e.g. exception bindings used only for side effects). 3. Verify `ruff check .` exits 0. 4. Run backend tests (`cd backend && pytest`) to confirm nothing broke. 5. Run frontend lint (`npm run lint`) separately — ruff does not check TS files in this repo; that's a separate concern tracked by eslint. This ticket is intentionally NOT a kilo-gsd task. It is a HERMES KANBAN AGENT task (tasker-worker or similar code-writing worker). kilo-gsd is correctly gated OFF dirty repos and gets no carve-out here. ## Related - Mark/vllm_mm#38 was the trigger — its implementer's commit (ea16ebf) landed on origin/main despite the lint gate, via the saastools#12 recovery pattern. The recovery was justified because the implementer's diff was clean; future feature dispatches will not have that luxury. - 2026-07-08 user rule (kilo-gsd-lint-gate-whole-repo skill): bulk-block every open issue on a dirty repo with `blocked:preflight` until cleanup lands. Once this ticket closes, those blocks can be released. ## Verification ```bash cd /home/b/Projects/vllm_mm ruff check . --statistics # should print "All checks passed!" cd backend && pytest # should still be green ```
Author
Owner

Fixed in branch fix/43-ruff-cleanup (commit dfe20b1).

Verification

  • ruff check . -> All checks passed! (was 77 errors: 31 F401, 15 E402, 14 E712, 11 F841, 6 F541)
  • cd backend && pytest -> 234 passed, 2 skipped
  • python -c 'from app.main import app' -> 46 routes register OK
  • Diff: 28 files changed, 72 insertions(+), 80 deletions(-)

Fix breakdown

  • 37 auto-fixed by ruff check --fix (F401 unused-imports, F541 f-string without placeholders)
  • 14 E712 ModelRecord.is_active == True -> ModelRecord.is_active.is_(True) (proper SQLAlchemy IS TRUE with NULL semantics)
  • 15 E402: 9 in main.py routed via # noqa: E402 with a comment (logging must be configured BEFORE routers that log at import time); 6 in proxy.py fixed by moving the trace() helper below the imports
  • 11 F841: 8 dead assignments deleted; 3 settings (_rope_freq_base, _rope_freq_scale, _gpu_memory_utilization) accepted via alias table but not yet plumbed into the cmd — renamed to _-prefixed with explanatory comments so the config surface stays valid while the ruff gate is happy

The kilo-gsd Lint gate should now pass on this repo on future dispatches.

Closes #43

Fixed in branch `fix/43-ruff-cleanup` (commit dfe20b1). ## Verification - `ruff check .` -> All checks passed! (was 77 errors: 31 F401, 15 E402, 14 E712, 11 F841, 6 F541) - `cd backend && pytest` -> 234 passed, 2 skipped - `python -c 'from app.main import app'` -> 46 routes register OK - Diff: 28 files changed, 72 insertions(+), 80 deletions(-) ## Fix breakdown - 37 auto-fixed by `ruff check --fix` (F401 unused-imports, F541 f-string without placeholders) - 14 E712 `ModelRecord.is_active == True` -> `ModelRecord.is_active.is_(True)` (proper SQLAlchemy IS TRUE with NULL semantics) - 15 E402: 9 in main.py routed via `# noqa: E402` with a comment (logging must be configured BEFORE routers that log at import time); 6 in proxy.py fixed by moving the `trace()` helper below the imports - 11 F841: 8 dead assignments deleted; 3 settings (`_rope_freq_base`, `_rope_freq_scale`, `_gpu_memory_utilization`) accepted via alias table but not yet plumbed into the cmd — renamed to `_`-prefixed with explanatory comments so the config surface stays valid while the ruff gate is happy The kilo-gsd Lint gate should now pass on this repo on future dispatches. Closes #43
Mark closed this issue 2026-09-18 03:20:26 +00:00
Sign in to join this conversation.
No description provided.