Repository navigation
ci(backend): type-check with ty and fix existing type errors - #116
Merged
Merged
Conversation
… a partial Protocol
… reading rowcount
…ad as an intended override
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
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.
Summary
What changed
Backend
Models and migrations
default=utcnowtimestamp NOT NULL (created_at,updated_at,last_active_at,joined_at,submitted_atacross 16 tables), filling any NULLs first. (63863039d4f1)Mapped[datetime];.claude/rules/models-and-migrations.mdnow says auto-set timestamps aren't nullable.TournamentRole.member_count = 0as a plain class attribute (not a column), so the valuewith_member_counts()sets is typed.down_revisionasstr | Sequence[str] | Noneinalembic/script.py.makoand the two existing merge revisions, which have tuple parents.Schemas and routes
TournamentSummary(...)andAdminTournamentRead(...)(**countsfirst) to avoid a ty false positive; no runtime effect.EventTrackDetailRead.needsnarrowinglist[EventStaffingNeed]tolist[EventStaffingNeedRead]with# ty: ignore[invalid-attribute-override], an intended Pydantic subclass override.Logic
get_scoped_or_404fetches withdb.get(model, id_)instead ofdb.query(model).filter(model.id == id_).first(), so a row already in the session is reused.log_actionandarchive_tournamentacceptactor_id: int | None, which the nightly auto-archive passes for a tournament whose owner was deleted.apply_join_code_update,deactivate_join_codeandis_join_code_expiredtakeJoinCode; theJoinCodeLikeProtocol lacked thelabelit writes.SessionLocalis always asessionmaker(unbound withoutDATABASE_URL);get_dbchecksengineinstead.resolve_person_refsand_resolve_chapter_creatorsreturndict[int | None, PersonRefResponse], matching theNonekey they already add for deleted accounts.func.max(TournamentForm.order); the reorder route sorts by the submitted orders.seed_members.pypassesmembership.userto write-through instead of aFakeUserstub.asserts or explicit checks.Tooling
tyas a dev dependency (locked at 0.0.86), configured inbackend/ty.tomlwitherror-on-warning = true.routes/sheets.py,sheets_validation.py,sync_service.py);sync_sheetstill writes membership columns dropped in2df371e5.uv run ty check) to the backend workflow.pytest.yml/ "Backend Tests" tobackend.yml/ "Backend CI" (jobtest→checks), since it now lints and type-checks too.actions/checkoutto v7 inbackend.ymlandrelease.yml, andactions/setup-nodeto v7 inrelease.yml, which run on Node 24 instead of the deprecated Node 20..githooks/pre-committype-checks a copy of the staged backend, so unstaged edits don't affect the result.Editor
.vscode/settings.json, pointing the ty and Ruff extensions atbackend/.venv, settingty.configurationFile, reporting ty diagnostics for the whole workspace and making Ruff the Python formatter..vscode/extensions.jsonrecommending both extensions;.gitignorenow ignores.vscode/*except these two files.Out of scope
Test plan
pytestpasses locallyAutomated
tests/core/test_form_branching.pyuses string field ids, matchingFormField.id.tests/test_migrations.pycovers the new revision against the models.uv run ty checkand Ruff pass acrossbackend/.Manual
63863039d4f1, and ranalembic check.release.ymlis untested with the new action versions; it first runs at the next manual release.