Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Rate limit exceeded
⌛ 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: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
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 |
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request refactors the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
Vercel Preview
|
There was a problem hiding this comment.
Code Review
This pull request refactors the research/_base.ts module to eliminate duplicated proxy logic, replacing it with a thin adapter that delegates to a new shared helper in _utils/backend-proxy.ts. This is an excellent change that improves code maintainability and centralizes the backend communication logic. The addition of a dedicated test file for the new adapter ensures that its specific contract, particularly the enforcement of authentication, is verified. I have one minor suggestion to further simplify the adapter code by using a direct re-export for the apiBaseUrl function.
| import { | ||
| apiBaseUrl as sharedApiBaseUrl, | ||
| proxyJson as sharedProxyJson, | ||
| type ProxyMethod, | ||
| } from "../_utils/backend-proxy" | ||
|
|
||
| export async function proxyJson(req: Request, upstreamUrl: string, method: string) { | ||
| const body = method === "GET" ? undefined : await req.text() | ||
| const controller = new AbortController() | ||
| const timeout = setTimeout(() => controller.abort(), 120_000) // 2 min timeout | ||
| export function apiBaseUrl(): string { | ||
| return sharedApiBaseUrl() | ||
| } |
There was a problem hiding this comment.
For better code clarity and conciseness, you can directly re-export apiBaseUrl since it's a simple pass-through. This avoids the need for a wrapper function and an import alias.
| import { | |
| apiBaseUrl as sharedApiBaseUrl, | |
| proxyJson as sharedProxyJson, | |
| type ProxyMethod, | |
| } from "../_utils/backend-proxy" | |
| export async function proxyJson(req: Request, upstreamUrl: string, method: string) { | |
| const body = method === "GET" ? undefined : await req.text() | |
| const controller = new AbortController() | |
| const timeout = setTimeout(() => controller.abort(), 120_000) // 2 min timeout | |
| export function apiBaseUrl(): string { | |
| return sharedApiBaseUrl() | |
| } | |
| import { | |
| proxyJson as sharedProxyJson, | |
| type ProxyMethod, | |
| } from "../_utils/backend-proxy" | |
| export { apiBaseUrl } from "../_utils/backend-proxy" |
There was a problem hiding this comment.
Pull request overview
Refactors the research API proxy base to remove the duplicated proxy implementation by delegating to the shared backend proxy helper, while locking in the “always auth” behavior with a focused contract test.
Changes:
- Replaced
research/_base.ts’s legacy proxy logic with a thin adapter overapi/_utils/backend-proxy. - Forced
{ auth: true }at the delegation boundary while keeping the sameapiBaseUrl/proxyJsonsurface. - Added a dedicated Vitest contract test to ensure the adapter continues to enforce auth.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| web/src/app/api/research/_base.ts | Replaces the local proxy implementation with delegation to the shared backend proxy helper (forcing auth). |
| web/src/app/api/research/_base.test.ts | Adds a contract test verifying delegation and enforced auth options. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| apiBaseUrl as sharedApiBaseUrl, | ||
| proxyJson as sharedProxyJson, | ||
| type ProxyMethod, | ||
| } from "../_utils/backend-proxy" |



Summary
research/_base.tsimplementation with a thin adapter over the shared backend proxy helperapiBaseUrl/proxyJsoncall surface while forcingauth: trueat the delegation boundary_basecontract test so the auth-default behavior stays lockedWhy
research/_base.tshad drifted into a second JSON proxy stack and was being reused well outsideresearch/. This PR removes that duplicate implementation without widening review scope to dozens of route import rewrites.Validation
cd web && npx vitest run src/app/api/research/_base.test.ts src/app/api/research/repro/context/route.test.ts src/app/api/_utils/backend-proxy.test.tscd web && npx eslint src/app/api/research/_base.ts src/app/api/research/_base.test.tscd web && npx tsc --noEmitcd web && npm run build