Add edge redirects for meeting links#23
Conversation
|
Warning Review limit reached
Next review available in: 31 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
✨ 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 vanity redirects at the edge for specific meeting paths (/meet-with-will, /meet-with-khaliq, and /virtual-office) to their respective external destinations, along with corresponding unit tests and documentation. The review feedback suggests enhancing this feature by making the path lookup case-insensitive to handle manual typing variations, preserving incoming query parameters (such as UTM tracking codes) during the redirect, and updating the test suite to cover these case-insensitivity and query parameter preservation behaviors.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| it.each(redirects)("redirects %s at the edge", async (path, destination) => { | ||
| const cloudWebWorker = { fetch: vi.fn() }; | ||
| const response = await worker.fetch( | ||
| new Request(`https://agentrelay.com${path}?utm_source=test`), | ||
| { | ||
| CLOUD_APP_ORIGIN: "https://origin.test.invalid", | ||
| CLOUD_WEB_WORKER: cloudWebWorker, | ||
| }, | ||
| buildCtx(), | ||
| ); | ||
|
|
||
| expect(response.status).toBe(302); | ||
| expect(response.headers.get("location")).toBe(destination); | ||
| expect(cloudWebWorker.fetch).not.toHaveBeenCalled(); | ||
| }); |
There was a problem hiding this comment.
Update the test to assert that query parameters (such as utm_source) are preserved during the redirect, matching the updated redirect behavior.
it.each(redirects)("redirects %s at the edge", async (path, destination) => {
const cloudWebWorker = { fetch: vi.fn() };
const response = await worker.fetch(
new Request("https://agentrelay.com" + path + "?utm_source=test"),
{
CLOUD_APP_ORIGIN: "https://origin.test.invalid",
CLOUD_WEB_WORKER: cloudWebWorker,
},
buildCtx(),
);
expect(response.status).toBe(302);
const expectedUrl = new URL(destination);
expectedUrl.searchParams.set("utm_source", "test");
expect(response.headers.get("location")).toBe(expectedUrl.toString());
expect(cloudWebWorker.fetch).not.toHaveBeenCalled();
});| it.each(redirects)("accepts a trailing slash for %s", (path, destination) => { | ||
| expect(getVanityRedirect("agentrelay.com", `${path}/`)).toBe(destination); | ||
| }); |
There was a problem hiding this comment.
Add test coverage for case-insensitivity to ensure that mixed-case or uppercase vanity URLs are correctly matched and redirected.
| it.each(redirects)("accepts a trailing slash for %s", (path, destination) => { | |
| expect(getVanityRedirect("agentrelay.com", `${path}/`)).toBe(destination); | |
| }); | |
| it.each(redirects)("accepts a trailing slash and mixed case for %s", (path, destination) => { | |
| expect(getVanityRedirect("agentrelay.com", path + "/")).toBe(destination); | |
| expect(getVanityRedirect("agentrelay.com", path.toUpperCase())).toBe(destination); | |
| }); |
|
Preview deployed!
This is a Cloudflare Workers preview version of this PR's build. |
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
There was a problem hiding this comment.
1 issue found across 1 file (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="router/index.ts">
<violation number="1" location="router/index.ts:92">
P2: `.toLowerCase()` was added to enable case-insensitive vanity-route matching, but there doesn't appear to be a test exercising mixed-case or uppercase paths (e.g. `/Meet-With-Will`). Adding a case-variant test case would prevent regressions if the normalization logic changes.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
|
|
||
| const normalizedPathname = (pathname.length > 1 | ||
| ? pathname.replace(/\/$/, "") | ||
| : pathname).toLowerCase(); |
There was a problem hiding this comment.
P2: .toLowerCase() was added to enable case-insensitive vanity-route matching, but there doesn't appear to be a test exercising mixed-case or uppercase paths (e.g. /Meet-With-Will). Adding a case-variant test case would prevent regressions if the normalization logic changes.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At router/index.ts, line 92:
<comment>`.toLowerCase()` was added to enable case-insensitive vanity-route matching, but there doesn't appear to be a test exercising mixed-case or uppercase paths (e.g. `/Meet-With-Will`). Adding a case-variant test case would prevent regressions if the normalization logic changes.</comment>
<file context>
@@ -87,9 +87,9 @@ export function getVanityRedirect(hostname: string, pathname: string): string |
+ const normalizedPathname = (pathname.length > 1
? pathname.replace(/\/$/, "")
- : pathname;
+ : pathname).toLowerCase();
return VANITY_REDIRECTS.get(normalizedPathname);
}
</file context>
Summary
/meet-with-will,/meet-with-khaliq, and/virtual-officeagentrelay.comWhy
These short, memorable Agent Relay URLs should resolve at the edge without involving the Next.js application. The redirects use temporary
302responses so their external meeting destinations can be changed without persistent browser caching.Validation
npm testinrouter— 68 tests passednpm run typecheckinroutergit diff --checkSummary by cubic
Add edge redirects for
/meet-with-will,/meet-with-khaliq, and/virtual-officein therouterCloudflare Worker. Uses 302s and bypasses the Cloud app so these links resolve fast and remain easy to change.agentrelay.com, accepts trailing slashes, is case-insensitive, and ignores nested paths.router/README.md.Written for commit e88fb75. Summary will update on new commits.