Repository navigation
fix(generation): let httpx choose the multipart boundary - #542
Conversation
openapi-python-client 0.29 makes every multipart endpoint send Content-Type: multipart/form-data; boundary=+++. httpx encodes the body with that boundary, so an uploaded file containing "\r\n--+++" ended its part early and the rest was parsed as a malformed extra part. This hit create_deployment (and deploy_resources_from_files), create_document and create_documents. Post-gen hook 0420 removes that header line, so httpx sets Content-Type with a random boundary for each request. Upstream made the same change in 0.30 (openapi-generators/openapi-python-client#1511). We can't take 0.30 yet because it moves generated clients to httpx2. Closes #541
|
🤖 The changes in this PR were produced by nano-agent, an autonomous agent. Commits are authored under the operator's own git identity when one is resolvable (the human running the fleet), so they can satisfy CLA/DCO requirements; this note records that the work was generated by the agent. |
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the multipart upload boundary fix.
No open issues 🎉
What changed in this PR
Fixes multipart upload corruption by letting httpx choose a random boundary instead of using the generator’s fixed +++ boundary. This addresses #541 without requiring the generator upgrade that switches to httpx2.
Changes:
- Adds a post-generation hook to remove fixed multipart boundary headers.
- Regenerates all three affected upload endpoints.
- Adds endpoint-wide boundary checks, payload round-trip tests, and focused hook tests.
| File | Description |
|---|---|
tests/acceptance/test_multipart_boundary.py |
Adds regression coverage for multipart boundaries and hook behavior. |
hooks/post_gen/0420_drop_fixed_multipart_boundary.py |
Removes generated headers that pin multipart boundaries. |
generated/camunda_orchestration_sdk/api/resource/create_deployment.py |
Lets httpx choose the deployment upload boundary. |
generated/camunda_orchestration_sdk/api/document/create_documents.py |
Lets httpx choose the multiple-document upload boundary. |
generated/camunda_orchestration_sdk/api/document/create_document.py |
Lets httpx choose the single-document upload boundary. |
Review effort: Balanced
|
nano-ack: issuecomment-7315691027 — attribution note acknowledged; it is informational and needs no code change. |
|
Successfully created backport PR for |
|
Successfully created backport PR for |
* test(generation): reproduce truncated multipart uploads from the fixed boundary Refs #541 * fix(generation): let httpx choose the multipart boundary openapi-python-client 0.29 makes every multipart endpoint send Content-Type: multipart/form-data; boundary=+++. httpx encodes the body with that boundary, so an uploaded file containing "\r\n--+++" ended its part early and the rest was parsed as a malformed extra part. This hit create_deployment (and deploy_resources_from_files), create_document and create_documents. Post-gen hook 0420 removes that header line, so httpx sets Content-Type with a random boundary for each request. Upstream made the same change in 0.30 (openapi-generators/openapi-python-client#1511). We can't take 0.30 yet because it moves generated clients to httpx2. Closes #541 * chore(generation): regenerate SDK for the multipart boundary fix (cherry picked from commit 0bea8e3) Co-authored-by: Josh Wulf <josh.wulf@camunda.com>
… to stable/9) (#544) * fix(generation): let httpx choose the multipart boundary (#542) * test(generation): reproduce truncated multipart uploads from the fixed boundary Refs #541 * fix(generation): let httpx choose the multipart boundary openapi-python-client 0.29 makes every multipart endpoint send Content-Type: multipart/form-data; boundary=+++. httpx encodes the body with that boundary, so an uploaded file containing "\r\n--+++" ended its part early and the rest was parsed as a malformed extra part. This hit create_deployment (and deploy_resources_from_files), create_document and create_documents. Post-gen hook 0420 removes that header line, so httpx sets Content-Type with a random boundary for each request. Upstream made the same change in 0.30 (openapi-generators/openapi-python-client#1511). We can't take 0.30 yet because it moves generated clients to httpx2. Closes #541 * chore(generation): regenerate SDK for the multipart boundary fix (cherry picked from commit 0bea8e3) * test: scan the imported SDK for multipart endpoints, not generated/ Signed-off-by: Josh Wulf <josh.wulf@camunda.com> --------- Signed-off-by: Josh Wulf <josh.wulf@camunda.com> Co-authored-by: Josh Wulf <josh.wulf@camunda.com>
Closes #541
Problem
openapi-python-client 0.29 makes every multipart endpoint send
Content-Type: multipart/form-data; boundary=+++. httpx encodes the body with that boundary, so an uploaded file containing\r\n--+++ended its part early. Affected endpoints:create_deployment(and sodeploy_resources_from_files)create_documentcreate_documentsFix
Post-gen hook
0420_drop_fixed_multipart_boundary.pyremoves that header line, so httpx setsContent-Typewith a random boundary for each request. This is what upstream does in 0.30 (openapi-generators/openapi-python-client#1511). We can't take 0.30 yet because it moves generated clients to httpx2 (#390). Once the generator stops emitting the line, the hook does nothing.Commits
test_multipart_boundary.pyfails on the current output. The scan finds 3 pinned boundaries, and all 3 endpoints truncate a payload containing\r\n--+++to<definitions>.The test covers the whole class of defect:
Checks
make generate,make lint,make typecheckandmake testall pass (1941 passed). No local Camunda was available for an integration run.Labelled
backport stable/10andbackport stable/9: both lines have the same bug.