fix: backend-lint and backend-test CI (#35)#36
Conversation
Pin ruff==0.15.11 in dev deps so CI and local formatters never skew. Reformats 61 files to current ruff style; auto-wraps 39 long lines as a side effect. Pre-existing formatter version skew, no behavior change. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- E501: file-level noqa on 10 prompt-heavy modules whose long lines are triple-quoted prompt content (cannot wrap without changing model input); wrapped 6 genuine code lines via implicit string concatenation.
Annotated 43 untyped function defs across 20 files, which also cleared 14 downstream no-untyped-call sites. The two genuinely third-party untyped calls (google Credentials, redis from_url) got targeted # type: ignore[no-untyped-call].
…return, var-annotated)
…, ignore coverage.xml
Youdahe123
left a comment
There was a problem hiding this comment.
Solid, methodical CI fix. The phased approach (formatter → auto-fixes → manual → generics → signatures → mypy) is the right order and makes the diff reviewable. Key observations:
What's solid:
- The two real bugs caught during type review (
missing lms_adapterincourses.py, wrong return tuple inoutcome_tracker.py) are a good sign — mypy found things that tests missed. - OpenAI mock fix (
coroutine returning async generator) is the correct interface match for the real library. - Pydantic V2 error format update (
string_too_shortvsmin_length) and theNameErrorfix in test_unsafe_content_fails are clean. - 160 tests passing with no new skips or xfails.
Minor notes:
pyproject.tomladded 3 lines — worth confirming none of these relax rules we'd want enforced (e.g.,ignoredirectives in mypy config). Quick sanity check before merge.tasks/lms_sync.pywas heavily changed (+118/-27). The changes appear to be type annotation additions, but given it drives background sync jobs, worth a quick read to confirm no behavioral changes snuck in alongside the type fixes.
CI: Backend lint + tests pass ✅. Frontend lint/build fail — those are tracked and fixed in #38 (separate PR).
✅ Approving — backend side is clean. Suggest merging before #38 since #38 is likely branched from a state that doesn't include these backend fixes yet.
Merge statusCI: Backend lint ✅ Backend tests ✅ | Frontend lint ❌ Frontend build ❌ (frontend failures are pre-existing, fixed in #38) Recommendation: merge this first. This is the only PR in the stack that can land without a rebase — backend CI is clean on its own run. Frontend failures here are not caused by this branch; they predate it and are resolved by #38. After this merges: #38 should rebase onto updated main to pick up these backend fixes. Once it does, all 4 CI checks should pass on #38. |
Fixes 40 tsc errors, 103 ESLint errors, and the tsc -b flag bug. All frontend checks pass. Backend failures are pre-existing, fixed by the companion PR #36 (already merged).
Fix: backend-lint and backend-test CI
Fixes both
backend-lintandbackend-testjobs. All checks and tests now pass on this branch.Note:
frontend-lintandfrontend-buildfailures are tracked and fixed in separate issues/PRs.Closes #35
What was done
Lint fixes (six phases, one commit each):
ruff format src/repo-wide (formatter version skew)ruff check --fix(import order, unused imports, py312 modernizations)type-argerrors)no-untyped-def,no-untyped-call)arg-type,attr-defined,union-attr, etc.)Phase 6 also fixed two real bugs found during type review: missing
lms_adapterincourses.pyand a wrong return tuple inoutcome_tracker.py.Test fixes:
test_llm_stream.py(2)test_invalid_name_failsstring_too_shortvsmin_length)test_non_pedagogical_template_failstest_unsafe_content_failsinvalid_strategyshould beunsafe_strategy)test_preprocess_templateyou,are,is, etc.) to_preprocess_templateVerification