Skip to content

Q1-06: types in every module - #484

Merged
sknampally merged 3 commits into
developfrom
q1/types-everywhere
Nov 28, 2026
Merged

sknampally merged 3 commits into
developfrom
q1/types-everywhere

Conversation

@sknampally

Copy link
Copy Markdown
Collaborator

Story #483, part of #449 (Credibility: code quality).

mypy now checks every module except reframe.core.commands, which comes off the list once Q1-05 (#454) has split it. The override list in pyproject.toml goes from 25 modules to 1.

What changed

  • 108 type errors in 24 modules fixed with annotations, None checks, and new names where one name held two types.
  • What the code does is unchanged. Where mypy could not see an invariant the code relies on, an assert states it with a comment, for example "with create, loader returns the loader or stops".
  • design/flow.py replaces the (re.search(...) or [None, ""])[1] idiom with a small _first() helper.

Real faults the types turned up, each fixed with a test that fails on the old code

  • core/preflight.py: an AWS sign-in whose identity named no account passed preflight, and the graph check then used "None" as the account in its policy simulation. Preflight now lists it as a problem with the sign-in command.
  • report/store.py: ensure() returned None if the reports Terraform root did not report its bucket, and uploads would go to s3://None/.... It now stops with a clear message.

Checks, run locally as CI runs them

  • ruff check src tests: passes.
  • mypy: no issues in 89 source files.
  • Offline tests: 461 pass, 2 of them new.
  • Coverage: 81%, floor 80%.

Prepared with AI assistance.

Prepared with AI assistance.
mypy now checks every module except reframe.core.commands, which comes
off the list once Q1-05 has split it. The 108 errors in the 24 other
modules are fixed with annotations, None checks and renamed reused
names; what the code does is unchanged.

Two real faults the types turned up, each with a test:
- preflight accepted an AWS sign-in that named no account, and the
  graph check then used "None" as the account
- the reports store returned no bucket if its Terraform root did not
  report one, and uploads went to s3://None; it now stops

Prepared with AI assistance.
Prepared with AI assistance.
@sknampally
sknampally merged commit 9f7eae1 into develop Nov 28, 2026
10 checks passed
@sknampally
sknampally deleted the q1/types-everywhere branch November 28, 2026 14:08
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.

1 participant