refactor(api): enforce enums over string literals on openapi surface#38009
Merged
Conversation
Contributor
Pyrefly Type Coverage
|
Replace raw string comparisons on the /openapi/v1 surface with enum members for type safety: - New CallerKind StrEnum for caller_kind (account/end_user); distinct from CreatorUserRole despite shared values. - Reuse AppStatus.NORMAL for app status checks. - Reuse AccountStatus.ACTIVE for membership status check.
2bc7802 to
868e462
Compare
asukaminato0721
approved these changes
Jun 26, 2026
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #38009 +/- ##
=======================================
Coverage 85.28% 85.28%
=======================================
Files 4938 4938
Lines 256070 256074 +4
Branches 48559 48559
=======================================
+ Hits 218389 218395 +6
+ Misses 33434 33432 -2
Partials 4247 4247
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Replace raw string literals with enum members on the
/openapi/v1surface for type enforcement.CallerKindStrEnum forcaller_kind(account/end_user) — kept distinct fromCreatorUserRoledespite shared values (different domain: authenticated principal vs. resource authorship).AppStatus.NORMALfor app status checks (App.statusis already typedMapped[AppStatus]).AccountStatus.ACTIVEfor membership status check.Device-flow RFC 8628 dict responses left as-is — intentionally outside the
OpenApiErrorCodetype system.7 files, no behavior change.
ruffclean; 435 openapi unit tests pass.