Replace iban with nested BankInfo model#7
Conversation
Extract full bank/wire transfer details (IBAN, SWIFT/BIC, bank name, routing number, account number, payment instructions) instead of just IBAN. Also adds default=None to all nullable fields, syncs the JSON schema documentation, and adds unit tests for schema models. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughInvoice schema and Pydantic models expanded for international use: added structured bank_details, seller/buyer addresses, broadened tax ID descriptions, made currency and line_items required, and updated tests and README to reflect these schema changes. Changes
Sequence Diagram(s)(Skipped — changes are schema/model additions without multi-component sequential control flow.) Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
tests/unit/test_pdf_parser.py (1)
200-205:⚠️ Potential issue | 🟡 MinorAdd type hints to stub method signatures.
The methods
pymupdf_rect_stub.__init__(line 200) andpymupdf_rect_stub.intersects(line 203) in the touched block lack type annotations, which violates the coding guideline requiring type hints on all Python function signatures.Proposed fix
class pymupdf_rect_stub: """Stub for pymupdf.Rect that supports intersects().""" - def __init__(self, bbox): + def __init__(self, bbox: tuple[float, float, float, float]) -> None: self.x0, self.y0, self.x1, self.y1 = bbox - def intersects(self, other): + def intersects(self, other: "pymupdf_rect_stub") -> bool: return not ( self.x1 <= other.x0 or other.x1 <= self.x0 or self.y1 <= other.y0 or other.y1 <= self.y0 )🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/unit/test_pdf_parser.py` around lines 200 - 205, The stub methods pymupdf_rect_stub.__init__ and pymupdf_rect_stub.intersects are missing type annotations; update __init__ to annotate the bbox parameter (e.g., Sequence[float] or Tuple[float, float, float, float]) and the return type as None, and update intersects to annotate its other parameter as the same rect type (or "pymupdf_rect_stub") and its return type as bool; ensure you import or reference typing types (Sequence/Tuple) as needed and keep names consistent with the class for static checks.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@tests/integration/test_extract_endpoint.py`:
- Line 148: The test function test_extract_with_custom_pdf_settings is missing
type annotations; update its signature to include parameter and return type
hints for client, auth_header, mock_pdf_parser, and mock_llm_extractor and a
return type of None (e.g., client typed as the project test client type like
FlaskClient or TestClient, or typing.Any if a concrete fixture type is
unavailable); also add any necessary imports (e.g., from typing import Any) so
the annotations are valid.
In `@tests/unit/test_invoice_schema.py`:
- Around line 5-169: Add explicit return type annotations (-> None) to all test
methods listed: test_all_fields_populated, both test_all_none_is_valid methods,
test_us_wire_fields, test_round_trip_json, test_full_address,
test_bank_details_nested, test_bank_details_null_is_valid, and
test_bank_details_from_dict; update each function signature in the Test classes
and module-level tests to include "-> None" (e.g., def
test_all_fields_populated(self) -> None:) so the test definitions have proper
type hints while preserving their bodies and assertions.
---
Outside diff comments:
In `@tests/unit/test_pdf_parser.py`:
- Around line 200-205: The stub methods pymupdf_rect_stub.__init__ and
pymupdf_rect_stub.intersects are missing type annotations; update __init__ to
annotate the bbox parameter (e.g., Sequence[float] or Tuple[float, float, float,
float]) and the return type as None, and update intersects to annotate its other
parameter as the same rect type (or "pymupdf_rect_stub") and its return type as
bool; ensure you import or reference typing types (Sequence/Tuple) as needed and
keep names consistent with the class for static checks.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 7f810a03-55f3-411d-aeaa-f00c0495e19b
📒 Files selected for processing (7)
README.mdsrc/app/schemas/default_invoice_schema.jsonsrc/app/schemas/invoice.pytests/integration/test_extract_endpoint.pytests/unit/test_invoice_schema.pytests/unit/test_llm_extractor.pytests/unit/test_pdf_parser.py
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
ibanfield with nestedBankInfomodel containing IBAN, SWIFT/BIC, bank name, bank address, routing number, account number, and payment notesdefault=Noneto all nullable fields acrossBankInfo,Address,InvoiceLineItem, andInvoiceSchemaso partial dicts validate correctlydefault_invoice_schema.jsonwith Pydantic model (add missingseller_address,buyer_address, updatebank_details)BankInfo,Address, andInvoiceSchemamodelsTest plan
make test)make typecheck)make format && make lint)bank_detailsnested object in response🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Documentation