MPT-21666 stream statement charges as JSONL#333
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (12)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (9)
📜 Recent review details⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
🧰 Additional context used📓 Path-based instructions (1)**/*⚙️ CodeRabbit configuration file
Files:
🧠 Learnings (4)📚 Learning: 2025-12-12T15:02:20.732ZApplied to files:
📚 Learning: 2026-04-02T09:35:03.825ZApplied to files:
📚 Learning: 2026-02-02T13:05:41.144ZApplied to files:
📚 Learning: 2026-04-16T13:00:41.320ZApplied to files:
🪛 Ruff (0.15.15)tests/unit/http/mixins/test_stream_jsonl_mixin.py[warning] 13-13: Invalid rule code in Add non-Ruff rule codes to the (RUF102) [warning] 21-21: Invalid rule code in Add non-Ruff rule codes to the (RUF102) tests/unit/resources/billing/test_statement_charges.py[warning] 79-79: Invalid rule code in Add non-Ruff rule codes to the (RUF102) [warning] 89-89: Invalid rule code in Add non-Ruff rule codes to the (RUF102) 🔇 Additional comments (4)
📝 WalkthroughWalkthroughThis PR introduces JSONL (newline-delimited JSON) streaming support to the API client. The implementation spans HTTP-level streaming infrastructure, reusable service mixins that wrap HTTP streaming, and integration with the StatementCharges resource. ChangesJSONL Streaming Support
🎯 3 (Moderate) | ⏱️ ~20 minutes Caution Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional.
❌ Failed checks (1 error)
✅ Passed checks (3 passed)
Comment |
🤖 AI-generated PR — Please review carefully. Add line-by-line JSONL/NDJSON streaming for statement charges so large charge sets can be consumed without buffering full pages into memory. - Add a stream() context-manager primitive to HTTPClient/AsyncHTTPClient that opens a streaming response (Accept: application/jsonl) and follows the redirect to the charge blob automatically. - Add StreamJSONLMixin/AsyncStreamJSONLMixin that iterate the response lines and yield one parsed model per line; wire it into StatementChargesService, exposing client.billing.statements.charges(id).stream(). - Populate the StatementCharge model with the full Charge schema fields from the MPT OpenAPI spec (typed scalars + nested BaseModel refs). - Add unit and e2e coverage; ignore .claude/ local artifacts. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
80c0659 to
21579d3
Compare
|



🤖 AI-generated PR — Please review carefully.
What was done
Add line-by-line JSONL/NDJSON streaming for statement charges so large charge sets can be consumed without buffering full pages into memory.
stream()context-manager primitive toHTTPClient/AsyncHTTPClientthat opens a streaming response (Accept: application/jsonl) and follows the redirect to the charge blob automatically.StreamJSONLMixin/AsyncStreamJSONLMixinthat iterate the response lines and yield one parsed model per line; wire it intoStatementChargesService, exposingclient.billing.statements.charges(id).stream().StatementChargemodel with the full Charge schema fields from the MPT OpenAPI spec (typed scalars + nestedBaseModelrefs)..claude/local artifacts.Testing
Unit and e2e coverage added for the streaming primitive, the JSONL mixins, and the statement charges service.
Closes MPT-21666