Finalize FastAPI refactor: fix 5 runtime bugs and add API test suite - #203
Draft
alvarolopez with Copilot wants to merge 12 commits into
Draft
Finalize FastAPI refactor: fix 5 runtime bugs and add API test suite#203alvarolopez with Copilot wants to merge 12 commits into
alvarolopez with Copilot wants to merge 12 commits into
Conversation
…attribute in utils.py
…omment, pytest.approx)
Copilot
AI
changed the title
Finalize FastAPI refactor and add comprehensive API tests
Finalize FastAPI refactor: fix 5 runtime bugs and add API test suite
Jul 7, 2026
Copilot created this pull request from a session on behalf of
alvarolopez
July 7, 2026 08:22
View session
|
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.




The aiohttp→FastAPI migration had several bugs preventing the API from running at all. This fixes them and adds 38 endpoint tests to validate the implementation.
Bug fixes
Model never instantiated (
model/v2/__init__.py): stevedore returns a class; was passing it unwrapped toModelWrapper→ every method call raisedTypeError: missing 1 required positional argument: 'self'. Added().Dead async code in
warm()(model/v2/wrapper.py): method wasasync defand referencedself._loop/self._executor/self._workersthat were never defined. Made synchronous, removed unusedasyncio/functoolsimports.get_root()crashes on disabled docs (api/__init__.py,api/v2/__init__.py):APP.docs_url[1:]raisedAttributeErrorwhen docs are disabled (url isNone). Alsoget_rootdidawait get_v2_version(request)on a plaindef— madeget_v2_versionasync.JSONResponsemissingcontent=kwarg (api/v2/predict.py):JSONResponse(ret)passes the dict as a positional arg, notcontent.Form/File fields broken under Pydantic v2 + FastAPI
Depends()(api/v2/utils.py):pydantic.create_model()in v2 doesn't exposeForm/FileFieldInfo defaults through__init__.__signature__, so FastAPI treated everything as query params. Replaced with a class factory that builds an explicitinspect.Signaturewith the correct FieldInfo defaults:Test infrastructure
conftest.py: session-scopedtest_appandclientfixtures; mocks stevedore loading with an in-processTestModel.test_v2_api.py: 38 tests across 7 classes covering root, v2 version, model list, model metadata, predict (required/optional params, file upload, validation errors), debug, and OpenAPI/Swagger/ReDoc endpoints.Pre-existing test bug fixed
test_loading_errorpatchedget_available_models(doesn't exist) instead ofget_available_model_names, and didn't reset theMODELsingleton — the test only appeared to pass becauseload_model()short-circuited on the already-loaded singleton.