test: lock oversized PDF rejection policy branches - #416
Open
Frankie-Xu wants to merge 1 commit into
Open
Frankie-Xu wants to merge 1 commit into
Frankie-Xu wants to merge 1 commit into
Conversation
Add unit coverage for oversized_pdf_policy.py so billing/admission decisions stay locked without changing production behavior. Co-authored-by: Frankie-Xu <Frankie-Xu@users.noreply.github.com>
Frankie-Xu
marked this pull request as ready for review
September 14, 2026 18:48
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Related to #121.
Summary
oversized_pdf_policy.py. That module is the billing/admission gate for oversized PDFs and previously had no direct tests.MAX_PDF_PAGE_LIMIT/OVERSIZED_PDF_SHARD_ENABLED/OVERSIZED_PDF_SOFT_LIMIT(no real large PDFs).Covered branches:
MAX_PDF_PAGE_LIMITare not rejectedOVERSIZED_PDF_SHARD_ENABLED=falseand pages above the direct limit →ValidationExceptionOVERSIZED_PDF_SOFT_LIMIT→ admitteduser_message+reason, and keepinternal_messageoffto_client()This does not implement #121 productionization (shard pipeline / 300MB upload). It only locks the current rejection policy.
Verification
make lint— All checks passedmake typecheck— 0 errors, 0 warnings, 0 informationscd apps/worker && uv run pytest -p no:postgresql tests/unit/test_oversized_pdf_policy.py -q— 7 passed-p no:postgresqlis only to skip the autoloadedpytest-postgresqlplugin in this environment (no libpq). The tests do not use Postgres.Deployment Notes
Checklist