Add batch plot image upload endpoint#1217
Conversation
) Supports multi-file FormData uploads with a single wallet signature. Validates each file individually (WebP/JPEG, max 1MB, magic bytes), returns ordered per-file results with CID/URL or per-slot errors. Enforces max 20 files per batch and 3 batch requests/minute per wallet. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
realproject7
left a comment
There was a problem hiding this comment.
RE2 Review: ✅ Approve
Well-structured endpoint. Auth, validation, rate limiting, and ordered results all look correct.
Highlights:
- Wallet signature with timestamp expiry (5 min) — solid
- Magic byte verification prevents type spoofing
- Per-file error reporting without aborting the batch — good UX
- Parallel uploads via
Promise.allis appropriate for ≤20 files - Existing single-file endpoint untouched
Minor non-blocking note:
walletBatchLogMap grows unbounded — old entries are filtered on read but stale wallet keys are never evicted. In a serverless/short-lived environment (Vercel) this is fine since instances recycle frequently, but in a long-running server it would be a slow memory leak. Not a blocker for MVP.
CI: lint-and-typecheck and e2e still pending at review time.
project7-interns
left a comment
There was a problem hiding this comment.
Verdict: REQUEST CHANGES
Summary
The endpoint covers the main auth, validation, upload, ordered result, and rate-limit behavior, but it only recognizes one FormData field shape. #1213 explicitly calls out batch files such as file_0, file_1, or files[], so PlotToon-compatible clients using those common names would be rejected as empty uploads.
Findings
- [medium] Batch file extraction only accepts fields named exactly
files, sofiles[]andfile_0/file_1requests are rejected withNo files provided.- File:
src/app/api/upload-plot-images/route.ts:101 - Suggestion: Accept the documented/common batch field forms while preserving upload order, e.g. repeated
files, repeatedfiles[], and numericfile_<index>entries sorted by their index. Add tests for at least one non-filesshape.
- File:
Decision
Requesting changes because this is an API compatibility issue against the ticket behavior, not just an implementation detail. CI was still pending at review time.
Supports files, files[], file_0/file_1, and file[0]/file[1] field names. Indexed fields are sorted numerically to preserve upload order. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
project7-interns
left a comment
There was a problem hiding this comment.
Verdict: APPROVE
Summary
The requested FormData compatibility fix is in place. The endpoint now accepts repeated files, repeated files[], and indexed file_0/file[0] forms while preserving numeric order for indexed fields, with tests covering the previously missing shapes.
Findings
- None blocking.
Decision
Approved. The prior RE1 finding is resolved. lint-and-typecheck is green on the updated commit; e2e was still pending at approval time and should be verified before merge.
Summary
POST /api/upload-plot-imagesendpoint for multi-image batch uploadsPlotLink: Upload plot images\nTimestamp: ...){ index, cid, url, mimeType, sizeBytes }per success,{ index, error }per failure/api/upload-plot-imagesingle-file endpointCloses #1213
Test plan
🤖 Generated with Claude Code