Skip to content

fix: well_known_url field deprecation warning - #1625

Open
jacob-williamson wants to merge 4 commits into
mainfrom
fix_deprecation_warning
Open

fix: well_known_url field deprecation warning#1625
jacob-williamson wants to merge 4 commits into
mainfrom
fix_deprecation_warning

Conversation

@jacob-williamson

@jacob-williamson jacob-williamson commented Aug 13, 2026

Copy link
Copy Markdown

I've been using the OIDCConfig class in the queue service, and ran into a bug where my tests were failing because of a deprecation warning.

def _well_known_url(self) -> str:
        if self.issuer:
            if self.well_known_url:
                LOGGER.warning(
                    DeprecationWarning(
                        "well_known_url and issuer are both set. "
                        "Defaulting to issuer URL"
                    ),
                )
            return self.issuer + "/.well-known/openid-configuration"
        return cast(str, self.well_known_url)

The issue is that even if you don't use the deprecated field (well_known_url), the model itself accesses it when it does if self.well_known_url:. This causes pydantic to emit a warning which causes tests to fail. I've replaced this with a check that doesn't access the actual field which fixes the issue.

Since pydantic also emits its own warning, we could probably get rid of the check all together.

@jacob-williamson
jacob-williamson requested a review from a team as a code owner August 13, 2026 15:57
@jacob-williamson
jacob-williamson marked this pull request as draft August 13, 2026 16:02
Comment thread src/blueapi/config.py Outdated
Comment on lines 253 to 259

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you're right - if pydantic intercepts the field access to raise a deprecation warning that is probably enough and we can remove this entire check

@jacob-williamson jacob-williamson Aug 13, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From looking at the stdio output in the tests, I now think when using the cli you don't see the pydantic warning, so may still be good to have the check

Comment thread src/blueapi/config.py
raise ValueError("Please provide 'OIDCConfig.issuer'")
if self.well_known_url:
if "well_known_url" in self.model_fields_set:
LOGGER.warning(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should either raise a warning or log a message. Logging a warning is not really doing either how they're intended.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, I've made it a log message

@tpoliaw
tpoliaw requested a review from ZohebShaikh August 13, 2026 16:32
@codecov

codecov Bot commented Aug 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.96%. Comparing base (872ea21) to head (b223a7a).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1625   +/-   ##
=======================================
  Coverage   95.96%   95.96%           
=======================================
  Files          45       45           
  Lines        3317     3317           
=======================================
  Hits         3183     3183           
  Misses        134      134           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jacob-williamson jacob-williamson changed the title Fix deprecation warning bug: Fix well_known_url field deprecation warning Aug 13, 2026
@jacob-williamson jacob-williamson changed the title bug: Fix well_known_url field deprecation warning fix: Fix well_known_url field deprecation warning Aug 13, 2026
@jacob-williamson jacob-williamson changed the title fix: Fix well_known_url field deprecation warning fix: well_known_url field deprecation warning Aug 13, 2026
@jacob-williamson
jacob-williamson marked this pull request as ready for review August 13, 2026 17:06
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