Skip to content

service settings views: simple typing fixes - #6056

Open
risicle wants to merge 1 commit into
mainfrom
ris-type-fixes-service-settings
Open

risicle wants to merge 1 commit into
mainfrom
ris-type-fixes-service-settings

Conversation

@risicle

@risicle risicle commented Sep 7, 2026

Copy link
Copy Markdown
Member

And some ignore markers where we're reaching in to add extra errors to form fields, which we should probably find better ways to do.

This PR makes one important decision - allowing assert statements in production code, but only for the purposes of type-narrowing. In these cases it's to tell the type checker something it can't figure out itself - that a valid form won't have None values for certain fields. These are all cases where a None being present would have thrown an exception anyway because of what the following code was trying to do with it.

This seems preferable to me than wrapping each use of these .data attributes in cast(...) calls, which would also have not given certainty about correctness in the way assert statements do.

@risicle
risicle requested review from CrystalPea and quis September 7, 2026 11:05
@risicle

risicle commented Sep 7, 2026

Copy link
Copy Markdown
Member Author

Oops sorry @CrystalPea, was trying to click @quis for review (this is a strawman for something we were already discussing).. but take a look if you like anyway.

Comment thread app/main/views/service_settings/index.py Outdated
Comment thread app/main/views/service_settings/index.py Outdated
Comment thread app/main/views/service_settings/index.py Outdated
@risicle
risicle force-pushed the ris-type-fixes-service-settings branch from e02afe9 to 88d9cba Compare September 7, 2026 15:29
and some ignore markers where we're reaching in to add extra
errors to form fields, which we should probably find better
ways to do
@risicle
risicle force-pushed the ris-type-fixes-service-settings branch from 88d9cba to 97552dc Compare September 19, 2026 16:17
@risicle
risicle requested a review from quis September 19, 2026 16:17
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.

2 participants