{{ message }}
Repository navigation
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.

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 Regression test is vacuous in full-suite runs: pydantic lazily rebuilds an incomplete model on first instantiation (MockValSer._attempt_rebuild calls model_rebuild and sets pydantic_complete = True), and many test files collected before this one construct FastMCP() (e.g. tests/client/test_logging_callback.py:28, tests/server/fastmcp/test_elicitation.py / test_integration.py, which sort before test_server.py). So
assert Settings.__pydantic_complete__passes even if the new module-levelSettings.model_rebuild()in src/mcp/server/fastmcp/server.py is removed — the test only detects the regression when run in isolation or first. To actually guard the "complete at import" property, the check must run in a fresh interpreter (e.g. subprocess `python -c "from mcp.server.fastmcp.server…Extended reasoning...
The module-level Settings.model_rebuild() is later removed or moved (regressing the PR's fix). On the locked dependency resolution (pydantic-settings < 2.15, where no IncompleteFieldDefinitionWarning is emitted),
uv run --frozen pyteststill passes: an earlier-collected test such as tests/client/test_logging_callback.py instantiates FastMCP(), pydantic's lazy rebuild marks Settings complete, and test_settings_model_is_complete_at_import asserts True. The regression the test was added to catch ships undetected until the 'highest' resolution CI breaks again.Verification: nit. The new test (tests/server/fastmcp/test_server.py:35-37,
assert Settings.__pydantic_complete__) is order-dependent and does not reliably guard the fix in a full-suite run. Mechanism: pydantic v2 leaves a model with an unresolved forward reference mocked, and the first instantiation triggers a lazymodel_rebuild()which, on success, setscls.__pydantic_complete__ = True(this is the very