Skip to content

Fix type errors and run type checks in CI - #11

Merged
chrisjkuch merged 3 commits into
add-typecheckingfrom
fix-typechecking
Nov 18, 2026
Merged

chrisjkuch merged 3 commits into
add-typecheckingfrom
fix-typechecking

Conversation

@chrisjkuch

@chrisjkuch chrisjkuch commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #8. Stacked on #10. Fixes every type error so mypy, strict mypy on src/, pyrefly, and ty pass, and makes CI enforce them on Python 3.12 with the lowest allowed dependency versions and on Python 3.14 with uv.lock.

  • _generated.py already passed every checker and needed no codegen changes. The existing drift check plus the type check job means a regenerated file has to type-check too
  • Adds typecheck to just check, gives the typecheck recipes --lowest-direct like just test, and adds a typecheck CI job that follows main's job conventions and is in notify.needs
  • Raises the floors to requests>=2.34, urllib3>=2, and faker>=26 (seeding extra), the first releases that ship type information. Below them, mypy can't see their types
  • Adds model_validate to the PageableBundle Protocol so get_bundle_page type-checks, keeping it structural so a caller's own bundle class still matches
  • Annotates transport, errors, testing, and seeding, and replaces bare dict with dict[str, Any]
  • KeycloakClientCredentialsProvider._request_token returns the token and expiry instead of setting them, so get_token returns a str

Behavior changes, also in the changelog:

  • APISession(timeout=...) accepts a float
  • KeycloakAdmin.ensure_organization raises LookupError if Keycloak returns no id for a new organization, instead of returning an organization whose id is None. New unit test covers it

Verification:

  • just typecheck passes on 3.14, on 3.12, and on 3.12 with --lowest-direct. Unit tests pass at both resolutions
  • pdc-exchange's 769 unit tests pass against this branch. ty on pdc-exchange reports one new diagnostic: its own bundle_type: type annotation in exchange/pdc/testing.py should become type[PageableBundle] when it upgrades
  • Integration tests pass against the local PDC stack (94 passed, plus the existing strict xfail for Scope user-group permissions to the requesting token service#2617)

🤖 Generated with Claude Code

@chrisjkuch
chrisjkuch added this pull request to stack #12 November 18, 2026 06:45
Annotate the hand-written modules so mypy, strict mypy on src, pyrefly,
and ty all pass on Python 3.12 and 3.14. Generated models already passed.
Add typecheck to `just check` and a CI job for both Python versions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tocol

- Raise floors to requests>=2.34, urllib3>=2, and faker>=26, the first
  releases with type information, and type check them in CI with
  `just typecheck --lowest-direct` on Python 3.12
- Match the typecheck CI job to main's conventions and notify on failure
- Keep PageableBundle a Protocol, adding model_validate, so structurally
  matching bundles still type check
- Accept list payloads and UUID keycloak ids in the testing helpers
- Test ensure_organization's missing-id error, share one JSON helper in
  seeding, inline the read-only field set, and add a changelog entry

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chrisjkuch
chrisjkuch requested a review from jayqi November 18, 2026 07:09
@chrisjkuch
chrisjkuch marked this pull request as ready for review November 18, 2026 07:09
Comment thread .github/workflows/ci.yml Resolved
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chrisjkuch
chrisjkuch merged commit fed72ef into main Nov 18, 2026
5 checks passed
@chrisjkuch
chrisjkuch deleted the fix-typechecking branch November 18, 2026 14:46
@chrisjkuch chrisjkuch mentioned this pull request Nov 18, 2026
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.

[Bug]: Package is lying about being typechecked

2 participants