fix(attachments): align deferred parse budget with import transport - #1469
fix(attachments): align deferred parse budget with import transport#1469seonghobae wants to merge 21 commits into
Conversation
📝 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.
… into codex/pr1469-restack # Conflicts: # backend/services/attachment_parser.py
|
현재 head |
Normally inherit the PDF upload, database, dependency, and search owner stack. Preserve complete proposal history while repairing ADR identity and acceptance claims. Keep the provider guard separate from the proposed admission ceiling. Observed document-size RED becomes 63 boundary passes. Combined actual-migration PostgreSQL, real NASA PDF retention and rollback, import, and parent tests pass 276 with zero skips. Hosted reviews, owner release and capacity evidence remain open. Co-Authored-By: Codex <noreply@openai.com> Signed-off-by: Seongho Bae <me@seonghobae.me>
Preserve the #1469 attachment parser, NewsDOM client/worker and focused tests while adopting #1427 as the prerequisite owner stack. Inherit ADR-0021 and the current direct PDF-DOM upload boundary from #1427 instead of the stale child data.py. Renumber the attachment parse-source proposal to ADR-0023 and keep the external NewsDOM transport contract fail-closed until an immutable owner release is pinned. The existing CHANGELOG child delta is preserved verbatim for lineage; its former ADR-0005/0006 references remain a known follow-up documentation RED before merge. Signed-off-by: Seongho Bae <me@seonghobae.me>
Restore #1427's exact CHANGELOG blob so the attachment child cannot delete valid prerequisite release notes while its former ADR references are being repaired. The #1469 attachment CHANGELOG delta remains a known Draft obligation to reintroduce with ADR-0021/0023 references before merge. Signed-off-by: Seongho Bae <me@seonghobae.me>
Cache primitive IDs and explicitly reload remaining pending rows after rollback. Real two-item PostgreSQL cases reproduce two MissingGreenlet failures, then 29 focused tests pass; the combined migrated suite passes 276 tests without skips. Preserve full source bytes, identity, provider boundaries and proposal history. Co-Authored-By: Codex <noreply@openai.com> Signed-off-by: Seongho Bae <me@seonghobae.me>
Integrate facadfb and its parent without rewriting either lineage. Preserve its prerequisite changelog and admission/provider separation, plus the fully tested local real-PDF and rollback repair. Correct unverified deployed/released size wording and retain the complete historical proposal. Co-Authored-By: Codex <noreply@openai.com> Signed-off-by: Seongho Bae <me@seonghobae.me>
Preserve the complete #1469 source-retention and HTTP 413 delta on #1427. No branch, workflow, source, or decision is deleted or superseded; ADR-0023 remains Proposed. Real PostgreSQL commit/rollback contention reproduced two stranded leases. Add one-connection lifecycle coverage, strict unlock confirmation, disconnect cursor recovery, and invalidate-before-close cancellation regression. Focused review regressions reached five RED then five GREEN; full exact-head revalidation follows this commit.
Extend the existing #1566 playbook with the reproduced #1469 lease-lifetime, cleanup-order, and interrupted-cursor lessons. Preserve all prior guidance and the #1564 base; no source, workflow, or proposal is deleted or superseded. The new documentation contract failed before the guidance update; the combined source-only suite now passes 45 tests. Runtime PostgreSQL evidence remains separately owned by #1469. Co-Authored-By: OpenAI Codex <noreply@openai.com>
Preserve the lease repair unchanged and retain its exact 303-test checkpoint receipt. Cover the two remaining missing-pending-row branches for attachments and documents; no schema, source, workflow, or proposal is deleted. Final full-suite evidence must be rerun on this new head. Co-Authored-By: OpenAI Codex <noreply@openai.com>
Advance the canonical ledger to1.30 with exact #1469 runtime and #1566 instruction receipts. Preserve historical heads, Proposed ADRs, existing sibling repair ownership, and all outstanding protected/release/customer acceptance gates. No runtime, workflow, schema, or predecessor delta is removed. Co-Authored-By: OpenAI Codex <noreply@openai.com>
Physical lease, interruption, and exact-head verification — 2026-09-05
실제 PostgreSQL에서 항목별 commit·rollback 뒤 다른 조회가 작업자의 연결을 재사용하고 잠금이 남는 문제를 재현했습니다. 한 연결을 작업 전체에 고정하고, 취소·연결 종료·해제 실패 때의 복구 순서와 미처리 항목 재개를 보완했습니다.
a312ea5e516fe1d696cfb35ffff7d3a731ad9cd2, tree83bf3605c961dc7be1c304585762a58de0124ba7; direct fix(data): align PDF DOM upload budget with sidecar #1427 base stayscb08b1c3ea2aba8844fc29ef703c34368cc55e47. Normal commits47b2347anda312ea5preserve the full prior1b757d5delta, including HTTP 413 classification, original bytes, migration/search prerequisites, and Proposed ADR lineage.ce3f52eebe36323639ed80ad7e5517428f2f58efa527300b14b5e94af2ef927b.751c99f2d3963dcf79e6011fce8e94185a2a14b58bd389aed49ceb8739c459f2equals final source; this is not GitHub approval.uv sync --locked, fresh/repeated migration to0020_search_trigram_storage, explicit-W error, and before/after head/clean-tree guards. Ruff passed; terminal output had no Timeout/Fatal/Warn/Denied matches. Test-owned hardened PG/network resources were removed; existing services were untouched.services/newsdom_worker.py, not every product module or every imaginable edge case.Task.cancel()plus a gated realAsyncSession.closeverifies cleanup ordering; the gate is a controlled simulation, not a real network-black-hole test. Unit cases cover both kinds' cursor resume and missing/no-longer-pending reloads.a7bf4bab7352c8c1fd9e720b48f59d63057de29a5fdf049ebe2faef8ff3d6ea2; worker coverage JSON:025ff2ea21aa66efc15bdbc9afc8ab3499591d085219b327d278b240a60b7363. Local evidence directory:/private/tmp/naruon-sweep-lease.QAQAFc. The earlier303-pass checkpoint is recorded separately and was not transferred to the final head.162c0df, with source-only checks explicitly distinguished.Reproduce from
backendagainst isolated PostgreSQL/pgvector with fresh test credentials using the 17 files listed in doctoring:Keep Draft. Current-head required hosted checks and qualifying approval, protected foundation integration, immutable NewsDOM release/pin, real64MiB recognition, signed browser recovery, representative capacity/p95 and security acceptance remain open. A database lease is not exactly-once external provider execution. No dependency addition, provider/model timeout, force push, approval, closure, release or protection bypass occurred.
Historical HTTP413 and retained-source receipts (earlier heads)
Current HTTP 413 extension and exact-head revalidation — 2026-09-05
Current head
1b757d5aa25c469157f8f03301964eb3061ed0fe, tree6b520c3cbe824d4017b97c39ef61fa702434e04a, is a normal descendant of the full retained-source/rollback repairdb083c9. Direct parent #1427 stayscb08b1c3ea2aba8844fc29ef703c34368cc55e47; keep Draft.220c7d0751f56244e568513f149669a3856099af/1b757d5aa25c469157f8f03301964eb3061ed0fewithout rewriting history. Provider HTTP 413 now maps to the same size-limit error category as the local guard, so a smaller provider limit is not misclassified as a generic recognition failure.uv sync --locked, fresh/repeat migrations to0020_search_trigram_storage, and the same full 17-file suite with-W error: 277 passed, 0 failures/errors/skips, 73.71 s. Before/after head and clean-tree guards passed. Changed-file Ruff passed; isolated PostgreSQL/network cleanup completed.5ec09d7152e0f3551fa670ac15567282ae02ac71170cd51eb5e3e51433abab10. The previous 276-pass result remains bound todb083c9; it was not reused as evidence for this later head.Historical retained-source integration receipt
Current exact authority — 2026-09-05
codex/pdf-dom-upload-64m@cb08b1c3ea2aba8844fc29ef703c34368cc55e47feat/naruon-attachment-parse-64m1b757d5aa25c469157f8f03301964eb3061ed0feCurrent repair lineage
A fresh read of
request_pdf_dom()found a contract hole after the earlier 20 MiB local preflight repair. A payload admitted by Naruon's local guard could still be rejected by the actually deployed NewsDOM provider with HTTP 413, but the client converted every>=400response into genericNewsdomRequestError. The worker therefore could persistrecognition_failedinstead of the already-definedprovider_payload_size_exceededevidence.220c7d0751f56244e568513f149669a3856099af: adds an executablehttpx.MockTransportregression requiring a remote HTTP 413 to raiseNewsdomPayloadTooLargeErroreven when the local payload is below the 20 MiB client guard.1b757d5aa25c469157f8f03301964eb3061ed0fe: translates only HTTP 413 toNewsdomPayloadTooLargeErrorbefore the generic>=400branch and updates that exception's docstring to cover both local and provider-side contract rejection. Other provider errors remain generic request failures.This preserves the domain invariant already consumed by
newsdom_worker: a provider-side size rejection is durable, specific evidence and is not silently collapsed into a generic recognition failure. It does not claim that a deployed NewsDOM version accepts 64 MiB.Owner-stack / ADR boundary
The earlier non-force restack onto #1427 is preserved. ADR-0023 remains Proposed, depends on ADR-0021 for the direct PDF path, and requires an immutable released NewsDOM transport contract before provider-size compatibility can be promoted.
ContextualWisdomLab/newsdom-api#665remains the owner path for the candidate bounded provider transport. No mutable owner head is treated as a released dependency.The current branch retains the repaired CHANGELOG/proposal-history/database evidence from predecessor
db083c9b30dc0156a46baa2cc0ffc3aec5444ab7. That predecessor recorded a clean-lock focused run of 276 tests and real PostgreSQL/corpus evidence, but those results are now predecessor development evidence only because the source and test tree changed at220c7d0/1b757d5. They are not merge authority for this exact head.Verification boundary
A fresh exact-head workflow lookup for
1b757d5aa25c469157f8f03301964eb3061ed0fecurrently returns no pull-request workflow runs. No qualifying independent post-last-push approval exists. Do not manufacture queue activity with a no-op commit and do not transferdb083c9...checks or local results to the new head.Keep Draft until the unchanged exact head has the then-live required repository/organization checks terminal-success, zero actionable current-head findings/threads, and a qualifying independent post-last-push approval; #1427 is protected-integrated; and the bounded NewsDOM owner contract is immutably released and pinned where the product claims provider compatibility. Actual 64 MiB provider recognition, representative memory/storage/index/latency/tenant-quota evidence, signed browser upload, and actionable document error/retry UX remain buyer-visible acceptance gaps. No self-approval, force push, destructive rebase, gate weakening, dummy requeue, mutable dependency, or predecessor-evidence transfer.