fix: type response output text annotation events#3467
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c8e04a21f7
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
|
||
|
|
||
| def test_response_output_text_annotation_added_event_uses_annotation_union() -> None: | ||
| event = ResponseOutputTextAnnotationAddedEvent.model_validate( |
There was a problem hiding this comment.
Use the pydantic-version-neutral parser
This new test is run in the repo's Pydantic v1 job (scripts/test invokes nox -s test-pydantic-v1, and noxfile.py installs pydantic<2), but model_validate only exists on Pydantic v2 models and this project only shims dump methods on its v1 BaseModel. Under the v1 test job this line raises AttributeError before exercising the regression; use the already imported _compat.parse_obj/model_parse helper or skip the test for PYDANTIC_V1.
Useful? React with 👍 / 👎.
|
Addressed in c5c6a36. The regression test now uses the version-neutral model_parse helper so it runs under both Pydantic v1 and v2 jobs. |
Changes being requested
Fixes #3419.
Use the existing
Annotationdiscriminated union forResponseOutputTextAnnotationAddedEvent.annotationinstead ofobject, and add a regression test that validates URL citation payloads are parsed into the typed annotation model.Additional context & links
Validation:
.venv/bin/python -m pytest -o addopts= tests/test_models.py -k response_output_text_annotation_added_event