Repository navigation
fix(data): align PDF DOM upload budget with sidecar #1427
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
seonghobae
wants to merge
12
commits into
fix/postgres-smoke-read-state
Choose a base branch
from
codex/pdf-dom-upload-64m
base: fix/postgres-smoke-read-state
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 4 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
834ab66
fix(data): align PDF DOM upload budget with sidecar
seonghobae 200f410
chore: sync pdf upload branch with develop
seonghobae e43cd00
docs: normalize pdf upload ADR formatting
seonghobae 795bfd2
Merge remote-tracking branch 'origin/develop' into codex/pr1427-recon…
seonghobae 29be15e
docs(adr): record PDF DOM design traceability
seonghobae e6a87cb
Merge remote-tracking branch 'origin/develop' into repair/naruon-pr1427
seonghobae 37ab7bd
Merge #1468 smoke fixture root fix for stacked PDF upload
seonghobae a91deed
Merge current develop into PDF DOM upload branch
seonghobae ecf023c
docs(pdf): require immutable NewsDOM release
seonghobae 3a5f2b3
Merge branch 'fix/postgres-smoke-read-state' of https://github.com/Co…
seonghobae 0236679
fix(data): inherit verified migration prerequisite
seonghobae cb08b1c
fix(pdf): inherit search storage and repair proposal traceability
seonghobae File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| # ADR-0005: Bounded PDF DOM upload contract | ||
|
|
||
| **Status:** Accepted | ||
| **Date:** 2026-08-20 | ||
| **Decision owner:** Naruon maintainers | ||
| **Scope:** Signed `POST /api/data/documents/pdf-dom-recognition` uploads | ||
|
|
||
| ## Context | ||
|
|
||
| Naruon email imports and the NewsDOM sidecar are being aligned to a 64MiB | ||
| bounded PDF transport budget. The direct Data workspace upload still used an | ||
| independent 20MiB limit, so a customer could upload a large PDF through email | ||
| but receive an avoidable `413` when using the equivalent manual workflow. | ||
|
|
||
| ## Decision | ||
|
|
||
| Set the direct PDF DOM upload and its pending-payload decoder to 64MiB. Keep the | ||
| signed-session boundary, PDF signature validation, one-byte-over-limit read, | ||
| base64 persistence contract, and `413` response unchanged. This ADR records | ||
| Naruon's consumer-side contract; the NewsDOM sidecar has its own ADR and must | ||
| pass its own checks before deployment. | ||
|
|
||
| ## Consequences | ||
|
|
||
| - Email and manual PDF ingestion present the same bounded size expectation to | ||
| customers. | ||
| - The endpoint can persist more temporary database content, so existing | ||
| workspace quotas, background worker limits, and database capacity monitoring | ||
| remain required. | ||
| - No unbounded upload is introduced, and malformed or non-PDF payloads continue | ||
| to fail closed before recognition. | ||
|
|
||
| ## Alternatives rejected | ||
|
|
||
| ### Keep a separate 20MiB manual-upload limit | ||
|
|
||
| Rejected because it creates a customer-visible workflow inconsistency without a | ||
| different safety property after the sidecar contract is raised. | ||
|
|
||
| ### Remove the upload limit | ||
|
|
||
| Rejected because request and database resource use must remain bounded at the | ||
| authenticated trust boundary. | ||
|
|
||
| ## References (APA 7th) | ||
|
|
||
| Internet Engineering Task Force. (2022). *HTTP semantics (RFC 9110).* RFC | ||
| Editor. https://www.rfc-editor.org/rfc/rfc9110 | ||
|
|
||
| RFC 9110 supports retaining an explicit `413 Payload Too Large` response when a | ||
| request exceeds the server's permitted content size. | ||
|
|
||
| National Institute of Standards and Technology. (2025). *Secure software | ||
| development framework (SSDF) version 1.2* (NIST Special Publication 800-218 | ||
| Rev. 1, Initial Public Draft). https://doi.org/10.6028/NIST.SP.800-218r1.ipd | ||
|
|
||
| The SSDF supports auditable input bounds, regression tests, and operational | ||
| controls for untrusted-input boundary changes. | ||
|
|
||
| No customer data or source PDF is included; the standards remain linked to their | ||
| authoritative publishers. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| # Doctoring record: bounded PDF DOM upload contract | ||
|
|
||
| **Observed gap:** The signed Data workspace PDF upload rejected files above | ||
| 20MiB even though the aligned email-import and NewsDOM transport contracts | ||
| accept up to 64MiB. | ||
|
|
||
| **Correction:** The upload endpoint and pending-payload decoder now share a | ||
| 64MiB bound. Signature validation, signed-session authorization, base64 storage, | ||
| worker deferral, and `413` rejection remain fail-closed. | ||
|
|
||
| **Evidence:** `backend/tests/test_data_api.py` asserts the 64MiB contract and | ||
| keeps the over-limit test monkeypatched to a small fixture. The NewsDOM sidecar | ||
| alignment is tracked separately in its own ADR and PR. | ||
|
|
||
| **References (APA 7th):** | ||
|
|
||
| - Internet Engineering Task Force. (2022). *HTTP semantics (RFC 9110).* RFC | ||
| Editor. https://www.rfc-editor.org/rfc/rfc9110 | ||
| - National Institute of Standards and Technology. (2025). *Secure software | ||
| development framework (SSDF) version 1.2* (NIST SP 800-218 Rev. 1, Initial | ||
| Public Draft). https://doi.org/10.6028/NIST.SP.800-218r1.ipd | ||
|
|
||
| No customer or private reference data was read, and no source PDF is | ||
| redistributed. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.