chore(ci): add backend Ruff and Mypy checks - #230
Conversation
parthrohit22
left a comment
There was a problem hiding this comment.
Approving — no correctness issues found, and the formatting claim holds up under
independent verification. Notes below are follow-ups, not blockers.
Formatting claim verified, with one caveat.
I replayed ruff format from origin/dev across all 43 changed Python files using
this PR's own pinned config. 42 are byte-identical to the branch. The 43rd,
app/analysis/architecture.py, differs in two places where the branch adds magic
trailing commas that force expansion:
ArchLayer(id=layer, name=..., order=..., nodes=node_ids) # dev, ruff-stable
ArchLayer( # branch, also ruff-stable
id=layer, ..., nodes=node_ids,
)
Both variants pass ruff format --check and are semantically identical, so nothing
is broken and CI is correct either way. Flagging only because the PR body describes
the 43 files as formatter output, and two hunks there are hand edits.
(AST comparison wasn't usable as a cross-check — the repo uses PEP 695 generics in
query_service.py — so the format replay is the stronger evidence regardless.)
The Mypy baseline is thinner than the PR body reads.
The 29 ignore_errors = true modules cover every route module, every service, the
worker, query_service, resolution, extraction/python, and
extraction/typescript — effectively all the interesting logic. What stays checked
is largely schemas and models. The per-module, explicitly-named approach is exactly
the right shape and much better than a global disable, but
"Success: no issues found in 117 source files" reads considerably stronger than the
actual coverage. Please open a follow-up issue tracking the ratchet-down so the
override list doesn't calcify.
Scope gap worth documenting.
ruff check app / mypy app leave tests/ and scripts/ unchecked. Reasonable
for a first baseline — please state it in apps/backend/README.md as the intended
scope so nobody assumes coverage that isn't there.
Rule set note. ["E4","E7","E9","F"] is narrow — no I, B, UP, SIM.
Sensible for a mergeable baseline; candidates for the same ratchet issue.
Merge coordination: this conflicts with #227 in .github/workflows/ci.yml and
app/extraction/support_matrix.py, and #227's new registry code fails
ruff format --check under this config. Suggest landing this one last so the
formatter baseline absorbs #227's code in a single pass.
Summary
The backend had no enforced Python lint, formatting, or type-analysis gate in CI. That left roughly 32,000 lines of application Python without a static quality baseline. This PR establishes a mergeable, pinned baseline without changing runtime behaviour.
Linked issue
Closes #188
Roadmap alignment
ruff check app,ruff format --check app, andmypy appbefore backend tests; all three commands pass locally against this branch.What changed
ruffandmypytooling toapps/backend/pyproject.tomland the backend development requirements.apps/backend/README.md.upstream/dev; the cosmetic changes are isolated from the tooling/configuration commit.Acceptance criteria completed
apps/backend/README.md.devdependency group and development requirements changed; runtime dependencies, Dockerfiles, and production install paths did not.Testing performed
Screenshots
Not applicable — there is no UI change.
Security and data considerations
No runtime request, authentication, authorization, data, migration, or logging behaviour changes. Ruff and Mypy are pinned development tools only; no secrets, environment files, or generated artifacts are included. Static analysis reduces detection latency but does not itself prove the absence of all defects.
Dependencies and blocked work
None. Docker-specific validation is unavailable on this host because the Docker executable is not installed; CI remains responsible for that environment.
Scope changes or remaining work
The maintainer explicitly authorized a one-time 43-file formatting baseline in the same PR. Because
devadvanced during implementation, three additional files that would fail the new formatter check were reformatted in separate cosmetic commits. All 43 formatted files were checked for AST equivalence.The Mypy baseline deliberately records existing debt as explicit per-module configuration. Tightening or removing those entries is follow-up ratchet work, not a claim of full type coverage.
Contributor checklist
devupstream/devupstream/devCloses) is used only because the issue is fully resolved