Conversation
Co-authored-by: is0692vs <135803462+is0692vs@users.noreply.github.com>
Co-authored-by: is0692vs <135803462+is0692vs@users.noreply.github.com>
Co-authored-by: is0692vs <135803462+is0692vs@users.noreply.github.com>
Co-authored-by: is0692vs <135803462+is0692vs@users.noreply.github.com>
Co-authored-by: is0692vs <135803462+is0692vs@users.noreply.github.com>
💡 **What:** Replaced the sequential `Promise.allSettled` chunking loop with `p-map` in the papers upload route. 🎯 **Why:** The chunking approach awaited each chunk to completely finish before starting the next. This created bottlenecks if one file in the chunk was slower to upload than the others, effectively blocking the pipeline. `p-map` maintains a constant pool of concurrent requests up to `MAX_CONCURRENT_UPLOADS`, maximizing network throughput. 📊 **Measured Improvement:** In a local benchmark of 30 mock uploads with high variability in response times (simulating varying R2 upload latency depending on file sizes): - Baseline (chunking): 503.92ms - Improved (`p-map`): 228.14ms - Over 2x performance increase under variable latency scenarios. Tests and typechecks pass. Co-authored-by: is0692vs <135803462+is0692vs@users.noreply.github.com>
Remove dead stopOnError usage, collect p-map results without mapper side effects, and pin p-map to CJS-compatible v4 for this CommonJS workspace. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Extract test-token issuance helper, add backend auth E2E scenarios for secret/body validation and users/me auth, and extend auth flow with API auth assertions before/after logout. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
💡 **What:** Replaced the sequential `Promise.allSettled` chunking loop with `p-map` in the papers upload route. 🎯 **Why:** The chunking approach awaited each chunk to completely finish before starting the next. This created bottlenecks if one file in the chunk was slower to upload than the others, effectively blocking the pipeline. `p-map` maintains a constant pool of concurrent requests up to `MAX_CONCURRENT_UPLOADS`, maximizing network throughput. 📊 **Measured Improvement:** In a local benchmark of 30 mock uploads with high variability in response times (simulating varying R2 upload latency depending on file sizes): - Baseline (chunking): 503.92ms - Improved (`p-map`): 228.14ms - Over 2x performance increase under variable latency scenarios. Tests and typechecks pass. Co-authored-by: is0692vs <135803462+is0692vs@users.noreply.github.com>
Share auth constants from helper to remove duplication, split test-org assertions into isolated cases, and add explicit unauthorized coverage for test-org. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: is0692vs <135803462+is0692vs@users.noreply.github.com>
Co-authored-by: is0692vs <135803462+is0692vs@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: is0692vs <135803462+is0692vs@users.noreply.github.com>
Co-authored-by: is0692vs <135803462+is0692vs@users.noreply.github.com>
…94226991725669 ci: automate staging to main PR creation
…dening test(e2e): strengthen backend auth and real session coverage
…30034077035267870 ⚡ [Performance] Optimize file upload concurrency with p-map
…1230fc ⚡ perf: use sequential bounded batching for R2 bucket deletions
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 13 minutes and 50 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughステージング→メイン昇格用のGitHub Actionsワークフローを追加し、APIの並列アップロードを Changes
Sequence Diagram(s)(条件を満たさないため、シーケンス図は省略します) Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 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 |
There was a problem hiding this comment.
Code Review
This pull request introduces the p-map library to handle concurrent file uploads more efficiently in the papers route. It also refactors E2E authentication helpers and adds comprehensive tests for backend authentication flows. Review feedback highlights performance regressions in file deletion logic, where previously parallel operations were changed to sequential ones in both the POST and DELETE routes. Furthermore, it is recommended to update API test assertions to use toEqual for stricter and more robust validation of response bodies.
Merging this PR will not alter performance
Comparing Footnotes
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
fix: address PR 414 review feedback
chore: sync main into staging
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@apps/api/src/routes/papers.ts`:
- Around line 699-703: The cleanup error log in the block pushing to
cleanupPromises (where c.env.BUCKET.delete(uploadedKeys.slice(i, i + 1000)) is
called) lacks context about which chunk failed; update the catch handler for
that promise to include the chunk identifiers (e.g., the slice range i..i+1000
and/or a sample or count from uploadedKeys.slice(i, i + 1000)) along with the
error details when calling console.error so you can trace which keys caused the
cleanup failure.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: e1c5e258-67a6-404c-b1a9-d561a914a2cb
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (8)
.github/workflows/promote-staging-to-main.ymlapps/api/package.jsonapps/api/src/routes/__tests__/papers.test.tsapps/api/src/routes/papers.tsapps/e2e/helpers/auth.tsapps/e2e/tests/scenarios/auth-flow.spec.tsapps/e2e/tests/scenarios/backend-auth-e2e.spec.tspatch.diff
💤 Files with no reviewable changes (1)
- patch.diff
fix(api): add cleanup chunk context for paper rollback
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@apps/api/src/routes/papers.ts`:
- Around line 697-713: The current rollback cleanup builds cleanupPromises by
calling c.env.BUCKET.delete(chunk) for every 1000-key chunk and then awaits
Promise.all, which fires all deletes concurrently; change this to use a shared
helper (e.g., ensureSequentialOrBoundedDeletes) that accepts uploadedKeys and a
concurrency limit, and performs deletion either sequentially or with a bounded
worker pool (N parallel tasks) to avoid mass parallel requests; replace the
inline loops that build cleanupPromises (the block using uploadedKeys,
cleanupPromises, and c.env.BUCKET.delete) and the similar code at the other
occurrence with calls to this helper so R2 deletes are rate-limited and
backpressure-safe.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 0b914181-ccb8-45fa-8f8f-ac4a8ab9be37
📒 Files selected for processing (2)
apps/api/src/routes/__tests__/papers.test.tsapps/api/src/routes/papers.ts
fix(api): bound R2 delete batch concurrency
Summary
Promotes
stagingintomain.stagingmainnpm run pr:promoteIncluded PRs
Compare