fix(resources): preserve multipart file uploads in generated client (HYBIM-882)#104
Conversation
…02ce8bb) Port of rungalileo/galileo-python@02ce8bb2 — fix: Preserve multipart file uploads in generated client (#624). - openapi.yaml: replace contentMediaType: application/octet-stream with format: binary for 7 Body_* multipart file fields so openapi-python-client generates File-typed attributes instead of plain str - scripts/import-openapi-yaml.sh: add yq patches for the 7 binary fields so the fix survives future openapi.yaml regenerations; tighten error handling - 6 generated Body_* models: update file fields from str → File, add BytesIO import, add File/FileTypes imports, call .to_tuple() in to_dict/to_multipart, construct File(payload=BytesIO(...)) in from_dict - tests/test_datasets.py: add two tests verifying File payloads round-trip through to_multipart() correctly
…ation block Two gaps vs upstream 02ce8bb: - ListAnnotationQueueParams.properties.sort.default patch was missing (added in e34a5b1 / PR#103 but not carried forward to this branch) - Post-patch verification block (yq -e with 14 assertions) was absent - Error message corrected: "Failed to fetch..." -> "Failed to patch..."
…locks On Windows, time.time_ns() resolution can be coarser than the execution time of a trivial function, so duration_ns can legitimately be 0. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
fercor-cisco
left a comment
There was a problem hiding this comment.
🤖 This review was generated by the Astra agent (claude-opus-4-8). It may contain mistakes.
Verdict: approve — Faithful, correct port of upstream generated multipart-upload fix; call sites already pass File objects, so this repairs genuinely broken uploads. Only minor testing/docs gaps.
- Fix docstring: file (str) -> file (File) in BodyCreateCodeScorerVersion - Add test_manual_llm_validate_multipart_body_serializes_list_of_files covering the loop-based query_files/response_files list handling in BodyManualLlmValidateMultipartScorersLlmValidateMultipartPost Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
Port faithfulness review vs upstream Verdict: Faithful port ✅Every substantive change from upstream #624 is present. Remaining deltas are cosmetic artifacts of a different File-by-file comparison
Both new tests pass locally ( Cosmetic-only differences (not defects)Behavior-preserving, stemming from a different generated baseline in this repo:
Items outside #624 scope (expected, harmless)
Conclusion: Complete and correct port. No correctness gaps. The only deltas versus upstream are generator formatting artifacts and two clearly-separate commits that legitimately ride along on the branch. 🤖 Generated with Claude Code |
Reviewer clarified that adding new tests is out of scope for this PR — it is a mechanical lift of the upstream commit only. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Summary
Port of upstream commit
02ce8bb— fix: Preserve multipart file uploads in generated client (#624).openapi.yaml: ReplacecontentMediaType: application/octet-stream→format: binaryfor 7Body_*multipart file fields, enablingopenapi-python-clientto generateFile-typed attributes instead of plainstrscripts/import-openapi-yaml.sh: Addyqpatches for the 7 binary fields so the fix survives futureopenapi.yamlregenerations; tighten error handling ($? -ne 0)Body_*models:file: str→file: File; addBytesIO/File/FileTypesimports; call.to_tuple()into_dict/to_multipart; constructFile(payload=BytesIO(...))infrom_dicttests/test_datasets.py: 2 new tests verifyingFilepayloads round-trip throughto_multipart()correctlyTest plan
poetry run pytest tests/test_datasets.py -v— 61 passedtest_create_dataset_body_serializes_file_as_multipart_upload,test_code_scorer_bodies_serialize_files_as_multipart_uploadsregenerate-api-clientworkflow after merge to produce clean generated output