Skip to content

[codex] Use assert_never for enum fallbacks#3177

Merged
adamtheturtle merged 1 commit into
mainfrom
adamtheturtle/assert-never-enums
May 19, 2026
Merged

[codex] Use assert_never for enum fallbacks#3177
adamtheturtle merged 1 commit into
mainfrom
adamtheturtle/assert-never-enums

Conversation

@adamtheturtle
Copy link
Copy Markdown
Member

@adamtheturtle adamtheturtle commented May 19, 2026

Replaces the enum fallback case _ pragmas in the Flask VWS, VWQ, and target-manager settings helpers with exhaustive assert_never branches. The enum match arms now use qualified enum members and explicit receiver annotations so strict match checkers can prove the fallback is unreachable. Adds a coverage exclusion for that assert_never pattern, matching the sibling-repo convention. Validated via commit and push hooks, including ruff, mypy, pyright, ty, and pyrefly.


Note

Low Risk
Low risk: changes are limited to enum-to-implementation helper methods and coverage configuration, with no behavioral changes expected unless an impossible enum value is encountered.

Overview
Updates the Flask mock servers’ enum helper methods (image matcher and target rater selection) to use exhaustive match statements: arms now reference qualified enum members, add explicit self annotations, and replace the prior fallback case _/ValueError with case _ as unreachable: assert_never(unreachable).

Adjusts coverage config to exclude the new assert_never unreachable-branch pattern from coverage reporting.

Reviewed by Cursor Bugbot for commit 6cb4d7f. Bugbot is set up for automated code reviews on this repo. Configure here.

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