Skip to content

fix: backend-lint and backend-test CI (#35)#36

Merged
Youdahe123 merged 9 commits into
mainfrom
fix/backend-lint-ci
Jun 28, 2026
Merged

fix: backend-lint and backend-test CI (#35)#36
Youdahe123 merged 9 commits into
mainfrom
fix/backend-lint-ci

Conversation

@baohuy1303

@baohuy1303 baohuy1303 commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Fix: backend-lint and backend-test CI

Fixes both backend-lint and backend-test jobs. All checks and tests now pass on this branch.

Note: frontend-lint and frontend-build failures are tracked and fixed in separate issues/PRs.

Closes #35

What was done

Lint fixes (six phases, one commit each):

Phase What
1 ruff format src/ repo-wide (formatter version skew)
2 ruff check --fix (import order, unused imports, py312 modernizations)
3 Remaining ruff errors by hand (E501, E741, E731, F841, UP042)
4 Added type arguments to bare generics (143 type-arg errors)
5 Annotated untyped function signatures (no-untyped-def, no-untyped-call)
6 Resolved remaining mypy errors (arg-type, attr-defined, union-attr, etc.)

Phase 6 also fixed two real bugs found during type review: missing lms_adapter in courses.py and a wrong return tuple in outcome_tracker.py.

Test fixes:

Test Fix
test_llm_stream.py (2) Fixed OpenAI mock to be a coroutine returning an async generator, matching the real openai library interface
test_invalid_name_fails Updated assertion for Pydantic V2 error format (string_too_short vs min_length)
test_non_pedagogical_template_fails Updated assertion to match actual validator error messages
test_unsafe_content_fails Fixed NameError (invalid_strategy should be unsafe_strategy)
test_preprocess_template Added missing stop words (you, are, is, etc.) to _preprocess_template

Verification

ruff check src/           # All checks passed!
ruff format --check src/  # 99 files already formatted
mypy src/                 # Success: no issues found in 99 source files
pytest tests/             # 160 passed

baohuy1303 and others added 8 commits June 8, 2026 03:03
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].
@baohuy1303 baohuy1303 changed the title Fix: backend-lint CI (ruff + mypy) Fix: backend-lint and backend-test CI Jun 8, 2026
@baohuy1303 baohuy1303 changed the title Fix: backend-lint and backend-test CI fix: backend-lint and backend-test CI (#35) Jun 8, 2026
@baohuy1303 baohuy1303 requested a review from Youdahe123 June 8, 2026 22:20

@Youdahe123 Youdahe123 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_adapter in courses.py, wrong return tuple in outcome_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_short vs min_length) and the NameError fix in test_unsafe_content_fails are clean.
  • 160 tests passing with no new skips or xfails.

Minor notes:

  • pyproject.toml added 3 lines — worth confirming none of these relax rules we'd want enforced (e.g., ignore directives in mypy config). Quick sanity check before merge.
  • tasks/lms_sync.py was 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.

@Youdahe123

Copy link
Copy Markdown
Contributor

Merge status

CI: 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.

Merge order: #36#38#34

@Youdahe123 Youdahe123 merged commit 87703a3 into main Jun 28, 2026
2 of 4 checks passed
Youdahe123 pushed a commit that referenced this pull request Jun 28, 2026
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).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

backend-lint and backend-test CI failing on main

2 participants