Repository navigation
Issue #1467: fix: move DeveloperApiKeyDTO to pydantic v2 ConfigDict - #1473
Merged
Merged
Conversation
Replace the v1-style inner `class Config` (orm_mode + from_attributes) with `model_config = ConfigDict(from_attributes=True)`. from_attributes was already on and v2 ignores orm_mode, so behavior is unchanged; the import-time UserWarning goes away. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
bjagg
approved these changes
Nov 4, 2026
bjagg
left a comment
Contributor
There was a problem hiding this comment.
Approving at 0272ef9.
from_attributeswas already on, so moving toConfigDictdoesn't change behavior. Only the warning goes.- The tests pass locally (2 passed). With
main'sdto.pyrestored, the import-warning test fails and the ORM-row test still passes, as it should. - CI is green on
0272ef9.
Thanks for the quick turnaround.
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.
Description of Change
Problem.
DeveloperApiKeyDTO(components/lif/developer_keys/dto.py) configured itself with a pydantic v1-style inner class:On pydantic 2.11.6, importing the module raises
UserWarning: 'orm_mode' has been renamed to 'from_attributes'. That warning shows up in every test run and service start that imports the brick. bjagg flagged it in his read of #1466.Solution. The inner class is now
model_config = ConfigDict(from_attributes=True).from_attributeswas alreadyTrue, and v2 ignoresorm_modeapart from the warning, so behavior doesn't change.Blast radius.
developer_keysis a shared brick, packaged by:lif_mdr_api: MDR's/developer-api-keysendpoints.lif_mdr_api.yml'spaths:already coverscomponents/lif/developer_keys/**.lif_control_plane_api: the/api-keysendpoints from Issue #1182: feat: serve developer keys from the control plane, scoped to a workspace #1466. This service has no deploy workflow onmainyet (Issue #1182: feat: add the control-plane API's deploy workflow #1464 adds one, and itspaths:covers the brick), so nothing deployed can miss the rebuild.Limitations. The same
orm_modewarning still comes fromcomponents/lif/mdr_dto/(24 places), so the MDR test runs still show it. That's out of scope per #1467.How to test.
uv run pytest test/components/lif/developer_keys/test_dto.pyuv run python -W error::UserWarning -c "import lif.developer_keys.dto"exits 0. Onmainit fails with theorm_modewarning.Related Issues
Closes #1467
Refs #1466
Type of Change
Project Area(s) Affected
Checklist
uv run ruff check)uv run ruff format)uv run ty check)Testing
New file:
test/components/lif/developer_keys/test_dto.py.test_dto_module_imports_without_a_config_warningimports the module in a fresh interpreter with-W error::UserWarning. It failed before the fix with theorm_modewarning (confirmed directly, not an import error) and passes after.test_dto_validates_from_an_orm_rowchecks thatmodel_validatestill builds the DTO from an attribute object, the way both key listings do. It needs no database, so it runs everywhere.The existing key tests pass against a real PostgreSQL, 51 passed with none skipped, run in the local pgtest container across:
test/components/lif/developer_keys/test/bases/lif/mdr_restapi/test_developer_api_key_{endpoints,service}.pytest/bases/lif/control_plane_restapi/Without PostgreSQL, 10 of those skip. pre-commit on the changed files is green.
Additional Notes
The diff doesn't share files with any open PR. #1464 only adds
.github/workflows/lif_control_plane_api.yml.🤖 Generated with Claude Code