fix(attachments): align deferred parse budget with import transport - #1469
fix(attachments): align deferred parse budget with import transport#1469seonghobae wants to merge 11 commits into
Conversation
|
Important Approval pendingCodeRabbit has no unresolved comments, but it could not review the latest commit because the review limit was reached. Follow the review guidance in this comment to continue. 📝 WalkthroughWalkthroughThe attachment parser source limit is increased from 20 MiB to 64 MiB. The NewsDOM client rejects PDF payloads above 20 MiB before network activity. The worker records provider payload-size failures. ADRs and related documentation define the bounded, fail-closed contract. ChangesAttachment Parse Contract
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: 🔵 Low · up to The PR raises the deferred attachment parse limit to match the 64 MiB import transport and preserves explicit unsupported-format statuses. It is mergeable with owner awareness or follow-up for remaining changelog wording corrections and the warning-level output behavior. Suggested reviewers: Sequence Diagram(s)sequenceDiagram
participant AttachmentParser
participant NewsdomWorker
participant NewsdomClient
AttachmentParser->>NewsdomWorker: provide deferred PDF payload
NewsdomWorker->>NewsdomClient: request_pdf_dom(payload)
NewsdomClient-->>NewsdomWorker: raise NewsdomPayloadTooLargeError above 20 MiB
NewsdomWorker->>NewsdomWorker: record provider_payload_size_exceeded and failed status
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Current-head verification note ( |
|
Current head |
|
PR governance metadata gate update for PR governance metadata gate is waiting on current-head requirements; see the latest check for pending reasons. |
|
@coderabbitai review |
|
|
Current-head disposition for de6d712: the four Devin threads are informational. The parser bound now matches the authenticated 64 MiB import ceiling; retained base64 expansion and the external NewsDOM capacity are recorded as the object-storage/sidecar integration gaps. The worker maps sidecar request/response errors to visible recognition failure rather than leaving an unusable payload falsely parsed; only an unconfigured provider remains pending for retry. The oversized test is an intentional boundary test. No additional source change is required in this bounded slice. |
|
@coderabbitai review |
|
Maintainer exact-head validation
|
|
Exact-head disposition for the prior CodeRabbit changelog observation: current head 575b0c2 already states the bounded range explicitly in CHANGELOG.md: attachments larger than 20 MiB and no larger than 64 MiB, with unsupported binaries remaining metadata-only. ADR-0006 and the doctoring contract state the same boundary. No further source or documentation change is warranted for that observation. The remaining merge blockers are current-head hosted review/security evidence and the protected approval requirement. |
|
/coderabbit review |
|
@coderabbitai review |
|
Superseded by current head 258ac41: the requested change is implemented verbatim — the NewsdomPayloadTooLargeError handler now records via logger.info with the operational-information rationale, preserving parse status, error code provider_payload_size_exceeded, and RESULT_FAILED return. All threads resolved; required checks green.
CodeRabbit round-2 finding: the entry named only unsupported_content_type; the contract also defines unsupported_binary. Name both so the changelog matches the persisted-metadata contract while preserving the size-limit and parse_size_limit_exceeded fail-closed descriptions.
|
Addressed the CodeRabbit round-2 finding in 6d6e499: CHANGELOG.md now names both contract statuses ( |
Superseded by head 6d6e499: the single requested change is implemented verbatim — CHANGELOG.md now names both contract statuses (unsupported_content_type and unsupported_binary) for unsupported binaries, preserving size-limit descriptions and fail-closed parse_size_limit_exceeded behavior. Thread resolved with the diff reply.
Customer outcome
Attachments larger than 20 MiB are no longer rejected by a hidden deferred-parser limit after the authenticated 64 MiB import transport accepts them. Unsupported binary types remain visible as metadata-only evidence with a concrete parser status; this PR does not claim to parse them.
Change
MAX_ATTACHMENT_PARSE_SOURCE_BYTESwith the existing 64 MiB email import budget.unsupported_content_type/unsupported_binarybehavior without raw bytes.Verification
python -m ruff check backend/services/attachment_parser.py backend/tests/test_attachment_parser.pyPYTHONPATH=. pytest backend/tests/test_attachment_parser.py -q— 18 passedgit diff --checkScope boundary
This is an ingestion-contract fix. It does not add a new binary parser dependency, change unsupported-format handling, expose raw bytes, or change database schema. A future parser for an unsupported format requires its own sandbox, provenance, dependency, and exact-head regression evidence.
Research
Summary by CodeRabbit
Bug Fixes
Documentation