fix: cap POST /download-zip at 50 documents#111
Open
bmersereau wants to merge 2 commits into
Open
Conversation
bmersereau
commented
May 13, 2026
Author
bmersereau
left a comment
There was a problem hiding this comment.
PR Review
Summary
Adds MAX_ZIP_DOCUMENTS = 50 guard to POST /single-documents/download-zip, returning 400 with a clear message when the request exceeds the limit. Simple, correct, and exactly scoped to the issue.
Findings
- [severity:praise] Named constant
MAX_ZIP_DOCUMENTSmakes the limit self-documenting and easy to tune - [severity:praise] Error message includes the actual limit value (
Cannot download more than ${MAX_ZIP_DOCUMENTS} documents at once) — good UX - [severity:nit] Static test uses
readFileSync— verifies pattern is present but not that the HTTP response is actually 400. Acceptable given the simplicity of the change
Specific checks
-
"test": "vitest run"in package.json ✓ -
vitest.config.tsinclude filter present ✓ - Tests pass: 2/2 ✓
- documents.ts unchanged from origin/main (aside from this fix) ✓
Verdict
Approve — clean.
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.
Summary
MAX_ZIP_DOCUMENTS = 50constant and a 400 guard toPOST /single-documents/download-zipCloses #99
Closes #114
Changes
backend/src/routes/documents.ts—MAX_ZIP_DOCUMENTSconstant + length check returning 400backend/src/lib/__tests__/downloadZipLimit.test.ts— static analysis test verifying the limit existsbackend/vitest.config.ts— vitest config scoping tests tosrc/(excludes compileddist/)backend/package.json—"test": "vitest run"script addedTest plan