Skip to content

Latest commit

 

History

History
27 lines (19 loc) · 6.47 KB

debug.md

File metadata and controls

27 lines (19 loc) · 6.47 KB

Canonical native response schema repair

Retry task 5 with a controller-owned correction to the response projection. The approved task remains valid: the failure concerns documentation of existing native output, with no need to change provider registration or serialization.

  • ROOT_CAUSE: _response wraps the existing FastAPI success schema in allOf, retaining aliased native row properties as binding constraints. _operation receives no route response model, so its canonical per-provider row_schema extension cannot correct that success schema. Native routes use response_model_by_alias=False; FastAPI's generated OpenAPI schema does not necessarily follow that output flag.
  • CATEGORY: LOGIC_ERROR
  • FIX_PLAN:
    1. Pass the actual route's response_model from project_financial_openapi through _operation to _response. Preserve the existing explicit rejection of unknown or non-False response_model_by_alias.
    2. For a non-None native Pydantic response model, obtain the success base through the existing _model_schema(response_model, schemas, dataset, "native_response", mode="serialization", by_alias=False). This reuses definition namespacing and collision checks and preserves the actual OBBject envelope, provider unions, result container types, nullable branches and extra fields. Place that reference in allOf[0]; retain the existing financial metadata overlay in allOf[1]. Do not retain the original aliased response schema as another conjunct.
    3. Preserve the current manually supplied success schema when response_model is None (including existing fixture routes). A non-None unsupported model or schema-generation failure must fail explicitly as InvalidFinancialAnnotation, with the original exception chained where applicable; it must never fall back to the conflicting original schema. Do not introduce a TypeAdapter or another serializer merely to support unrequested response shapes.
    4. Keep original native components unchanged. For typed routes, generate the canonical base and validate the expected projected component even on repeat projection; do not let the current early return silently accept a pre-existing stale aliased component or a changed typed response model. _put can retain deterministic collision rejection. The untyped fallback can retain its existing repeat-projection behavior. No runtime route, provider or data-class mutation is needed.
  • VERIFICATION: First rerun the existing bounded provider pytest invocation for tests/providers/test_financial_openapi.py with -n0 --maxprocesses=2 -k native, recording the actual child exit code without overwriting the retained red evidence. Then run the complete focused file, covering canonical success branches, native component preservation, all references, input nonmutation, idempotence, manual-schema fallback and explicit unsupported typed-model failure. Add a typed repeat-projection check so the fast path cannot hide a conflicting component. The controller then runs the planned combined affected join, owning Ruff checks and whole-file complexity checks (400 physical / 300 logical / 50 per function), followed by independent review. These are proposed checks, not passed evidence.
  • NEXT_ACTION: RETRY_TASK
  • CONFIDENCE: HIGH
  • NOTES: Investigation only; no production or test edits and no suite rerun. The failure is reproduced in the retained worker evidence; the proposed canonical envelope has not yet been executed by this investigation. If canonical generation fails or loses native branch constraints in the focused run, stop and inspect that exact model before expanding the repair.

Evidence and scope

The retained native-red.log reports two failed and one passed native-selected tests, with actual child exit code 1 in native-red.rc, on Python 3.13.15. Both failures reach EquityInfo and compare canonical class properties with projected success branches. This demonstrates the defect for installed and isolated native routes; it does not establish that the remaining ten isolated datasets pass. The later synthetic runtime cases were not included in that run.

The inspected source is root ff451333671e0dc0ca8f9e98141568d3541eec50, data fork dca75f9b358c3defe5ab7948f847a120a08ff98e, as frozen in the worker report. The provider lock declares FastAPI 0.143.0 and Pydantic 2.14.1; these are lockfile versions, not a new installed-version probe. ProviderInterface._generate_return_annotations constructs actual OBBject_<dataset> classes from registered provider row unions and results types. The installed test already passes its identity assertion that route.response_model is interface.return_annotations[dataset] before failing the row-schema comparison. Router supplies the False alias-output default.

The approved task plan explicitly requires native-name agreement and task 5's real route/schema join. Requirements 4.1 and 4.2 preserve financial metadata meaning; 6.1 requires truthful discovery schemas; 6.3 requires compatibility. The design and amendment keep projection derived from native classes and preserve results and extra.results_metadata.__qopenbb_financial__. This correction repairs the accepted task 3 component at its task 5 integration gate, within the controller's assigned repair ownership. It does not require a new prerequisite, registration engine, dependency, runtime activation or owner product decision.

Official documentation corroborates the local explanation: FastAPI response models explain that the OpenAPI model schema can remain unchanged by response_model_by_alias; Pydantic JSON Schema documentation documents explicit by_alias=False and serialization mode. These current documentation pages support the API choice; retained local tests and source establish this repository's failure.

The existing native test helper follows every success branch, which correctly prevents an extension-only repair from appearing successful. Its first-batch assertion should also require a nonempty collected branch list, as the installed-baseline test already does, so an unexpectedly missing result schema cannot pass through all([]). This is a focused regression-strengthening suggestion for the owning test worker.