refactor: rename apps/connections to apps/gateway#446
Conversation
Complete the second half of the two-step rename (first: gateway → relay). Updates package name, Vercel project references, URL paths (/services/connections → /services/gateway), all imports, test aliases, comments, and service tags across the monorepo. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
5 Skipped Deployments
|
📝 WalkthroughSummary by CodeRabbit
WalkthroughThis PR systematically renames the "connections" service to "gateway" across the repository, updating package names, API routes, environment comments, import aliases, URL constants, service labels, rewrites, and integration tests. No functional logic or public API signatures were intentionally changed. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~30 minutes Possibly related PRs
🚥 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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (5)
packages/integration-tests/src/connections-browser-oauth-flow.integration.test.ts (1)
4-8:⚠️ Potential issue | 🟡 MinorUpdate stale route docs to match the gateway route base.
Line 4 says this suite tests gateway flow, but Lines 5-7 still document
/connections/...endpoints, which conflicts with Line 128 (/services/gateway...).✏️ Suggested doc fix
- * - GET /connections/:provider/authorize (URL + state for browser redirect) - * - GET /connections/:provider/callback (browser redirect, not inline) - * - GET /connections/oauth/status (polling for completion) + * - GET /services/gateway/:provider/authorize (URL + state for browser redirect) + * - GET /services/gateway/:provider/callback (browser redirect, not inline) + * - GET /services/gateway/oauth/status (polling for completion)🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/integration-tests/src/connections-browser-oauth-flow.integration.test.ts` around lines 4 - 8, Update the stale route docs at the top of the test file to match the gateway route base used elsewhere (see the /services/gateway base referenced at line 128): change the documented endpoints from /connections/:provider/... to /services/gateway/connections/:provider/... so the comment lists GET /services/gateway/connections/:provider/authorize, GET /services/gateway/connections/:provider/callback, GET /services/gateway/connections/oauth/status and the state token lifecycle note, ensuring the comment in the test suite matches the actual gateway routes exercised by the tests.packages/integration-tests/src/full-stack-connection-lifecycle.integration.test.ts (1)
393-393:⚠️ Potential issue | 🟡 MinorTest description text is stale after endpoint rename.
Line [393] and the step comment still say
/connections/..., but the exercised route is/services/gateway/.... Rename these strings so test intent matches behavior.✏️ Suggested text-only fix
- it("DELETE /connections/:provider/:id triggers teardown workflow", async () => { + it("DELETE /services/gateway/:provider/:id triggers teardown workflow", async () => { ... - // ── 2. DELETE /connections/:provider/:id → teardown_initiated ── + // ── 2. DELETE /services/gateway/:provider/:id → teardown_initiated ──As per coding guidelines,
**/*.test.ts: Test files should use descriptive test names.Also applies to: 470-472
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/integration-tests/src/full-stack-connection-lifecycle.integration.test.ts` at line 393, Update the stale test description and inline step comments that reference the old "/connections/:provider/:id" route so they reflect the actual exercised route "/services/gateway/:provider/:id"; specifically rename the "it" description that currently reads "DELETE /connections/:provider/:id triggers teardown workflow" and any other assertions/comments around the test (including the blocks at the later occurrence around lines 470-472) to use "/services/gateway/:provider/:id" so the test name and comments match the implemented route and clearly describe the behavior being verified.packages/integration-tests/src/contract-snapshots.test.ts (1)
227-234: 🧹 Nitpick | 🔵 TrivialAlign test titles with the new
/services/gatewaypaths.The request paths were migrated, but the test names still mention
/connections/:id, which is now misleading.Also applies to: 249-254
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/integration-tests/src/contract-snapshots.test.ts` around lines 227 - 234, Update the two test case titles that still reference `/connections/:id` to reflect the migrated endpoint `/services/gateway/:id`; specifically edit the it() descriptions that currently read "GET /connections/:id/token response" (and the similar title at the later occurrence) so they mention `/services/gateway/:id` instead, keeping the rest of the test logic (the connReq calls and assertions) unchanged; look for the test blocks containing the strings "Shape 2: GET /connections/:id/token response" and the later similar title and update those titles accordingly.apps/backfill/src/workflows/backfill-orchestrator.ts (1)
53-63:⚠️ Potential issue | 🟡 MinorFix stale “Connections” wording in timeout/failure errors.
Lines 55 and 62 still report “Connections …” even though this call is now Gateway-bound, which degrades operational clarity.
Suggested fix
- `Connections getConnection request timed out for ${installationId}`, + `Gateway getConnection request timed out for ${installationId}`, ... - `Connections getConnection failed: ${response.status} for ${installationId}`, + `Gateway getConnection failed: ${response.status} for ${installationId}`,🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apps/backfill/src/workflows/backfill-orchestrator.ts` around lines 53 - 63, Error messages still say "Connections" but the call is Gateway-bound; update the thrown Error texts in the timeout and non-ok response paths to reference "Gateway" instead of "Connections". Specifically change the Error thrown inside the DOMException timeout branch (where it currently reads `Connections getConnection request timed out for ${installationId}`) and the Error thrown when `!response.ok` (currently `Connections getConnection failed: ${response.status} for ${installationId}`) to use "Gateway getConnection" or similar consistent "Gateway" phrasing while keeping `installationId` and `response.status` intact.apps/backfill/src/workflows/entity-worker.ts (1)
84-87:⚠️ Potential issue | 🟡 MinorUpdate stale error label from “Connections” to “Gateway”.
Line 86 now logs the wrong service name after the endpoint migration, which can mislead debugging.
Suggested fix
- `Connections getToken failed: ${response.status} for ${installationId}`, + `Gateway getToken failed: ${response.status} for ${installationId}`,🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apps/backfill/src/workflows/entity-worker.ts` around lines 84 - 87, The thrown Error message currently says "Connections getToken failed" which is stale; update the error string in the response.ok failure branch (the Error thrown where response, installationId are in scope) to say "Gateway getToken failed" so logs reflect the migrated endpoint/service; ensure the template remains `Gateway getToken failed: ${response.status} for ${installationId}` and update any identical occurrences in the same function or surrounding token-fetching logic (e.g., in entity-worker's token retrieval block) to keep messages consistent.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@api/console/src/router/org/connections.ts`:
- Around line 22-23: Update deployment sequence and documentation to ensure
runtime lookup succeeds: coordinate the Vercel project rename to
"lightfast-gateway" before merging the change that sets gatewayUrl via
withRelatedProject({ projectName: "lightfast-gateway" }). Add an explicit PR
checklist item and a brief inline comment next to the withRelatedProject usage
so reviewers know the Vercel rename must be completed (or a fallback config/env
used) prior to rollout.
In `@apps/console/next.config.ts`:
- Around line 184-185: Add a temporary legacy rewrite that maps the old ingress
path "/services/connections/:path*" to the new backend destination
`${gatewayUrl}/services/connections/:path*` so OAuth callbacks that still hit
the old path succeed during rollout; add this alongside the existing rewrite for
"/services/gateway/:path*" (use the same pattern as the gateway rewrite), place
the connections rewrite before/above any catch-all rewrites to ensure it
matches, and mark it with a TODO comment to remove after the manual dashboard
updates are complete.
In
`@packages/integration-tests/src/connections-cli-oauth-flow.integration.test.ts`:
- Around line 4-10: Update the file header docblock to match the actual gateway
endpoints used in the tests: replace references to "/connections/..." with the
real routes the tests call under the gateway prefix, e.g. "GET
/services/gateway/connections/:provider/authorize", "GET
/services/gateway/connections/oauth/status", and "GET
/services/gateway/connections/:provider/callback?redirect_to=inline"; ensure the
documented list (the header comment block at the top of
packages/integration-tests/src/connections-cli-oauth-flow.integration.test.ts)
exactly mirrors the test flow: authorize → callback → poll and notes that
gatewayApp.request() is used (no tRPC/service mesh).
---
Outside diff comments:
In `@apps/backfill/src/workflows/backfill-orchestrator.ts`:
- Around line 53-63: Error messages still say "Connections" but the call is
Gateway-bound; update the thrown Error texts in the timeout and non-ok response
paths to reference "Gateway" instead of "Connections". Specifically change the
Error thrown inside the DOMException timeout branch (where it currently reads
`Connections getConnection request timed out for ${installationId}`) and the
Error thrown when `!response.ok` (currently `Connections getConnection failed:
${response.status} for ${installationId}`) to use "Gateway getConnection" or
similar consistent "Gateway" phrasing while keeping `installationId` and
`response.status` intact.
In `@apps/backfill/src/workflows/entity-worker.ts`:
- Around line 84-87: The thrown Error message currently says "Connections
getToken failed" which is stale; update the error string in the response.ok
failure branch (the Error thrown where response, installationId are in scope) to
say "Gateway getToken failed" so logs reflect the migrated endpoint/service;
ensure the template remains `Gateway getToken failed: ${response.status} for
${installationId}` and update any identical occurrences in the same function or
surrounding token-fetching logic (e.g., in entity-worker's token retrieval
block) to keep messages consistent.
In
`@packages/integration-tests/src/connections-browser-oauth-flow.integration.test.ts`:
- Around line 4-8: Update the stale route docs at the top of the test file to
match the gateway route base used elsewhere (see the /services/gateway base
referenced at line 128): change the documented endpoints from
/connections/:provider/... to /services/gateway/connections/:provider/... so the
comment lists GET /services/gateway/connections/:provider/authorize, GET
/services/gateway/connections/:provider/callback, GET
/services/gateway/connections/oauth/status and the state token lifecycle note,
ensuring the comment in the test suite matches the actual gateway routes
exercised by the tests.
In `@packages/integration-tests/src/contract-snapshots.test.ts`:
- Around line 227-234: Update the two test case titles that still reference
`/connections/:id` to reflect the migrated endpoint `/services/gateway/:id`;
specifically edit the it() descriptions that currently read "GET
/connections/:id/token response" (and the similar title at the later occurrence)
so they mention `/services/gateway/:id` instead, keeping the rest of the test
logic (the connReq calls and assertions) unchanged; look for the test blocks
containing the strings "Shape 2: GET /connections/:id/token response" and the
later similar title and update those titles accordingly.
In
`@packages/integration-tests/src/full-stack-connection-lifecycle.integration.test.ts`:
- Line 393: Update the stale test description and inline step comments that
reference the old "/connections/:provider/:id" route so they reflect the actual
exercised route "/services/gateway/:provider/:id"; specifically rename the "it"
description that currently reads "DELETE /connections/:provider/:id triggers
teardown workflow" and any other assertions/comments around the test (including
the blocks at the later occurrence around lines 470-472) to use
"/services/gateway/:provider/:id" so the test name and comments match the
implemented route and clearly describe the behavior being verified.
ℹ️ Review info
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
⛔ Files ignored due to path filters (2)
packages/integration-tests/src/__snapshots__/contract-snapshots.test.ts.snapis excluded by!**/*.snappnpm-lock.yamlis excluded by!**/pnpm-lock.yaml,!**/pnpm-lock.yaml
📒 Files selected for processing (71)
api/console/src/env.tsapi/console/src/router/org/connections.tsapps/backfill/src/lib/related-projects.tsapps/backfill/src/routes/trigger.tsapps/backfill/src/workflows/backfill-orchestrator.test.tsapps/backfill/src/workflows/backfill-orchestrator.tsapps/backfill/src/workflows/entity-worker.test.tsapps/backfill/src/workflows/entity-worker.tsapps/backfill/src/workflows/step-replay.test.tsapps/backfill/src/workflows/workflow-contracts.test.tsapps/console/next.config.tsapps/console/src/middleware.tsapps/gateway/.gitignoreapps/gateway/.vercelignoreapps/gateway/eslint.config.jsapps/gateway/integration-specs.jsonapps/gateway/package.jsonapps/gateway/src/app.tsapps/gateway/src/env.tsapps/gateway/src/index.tsapps/gateway/src/integration.test.tsapps/gateway/src/lib/cache.tsapps/gateway/src/lib/github-jwt.tsapps/gateway/src/lib/token-store.tsapps/gateway/src/lib/urls.tsapps/gateway/src/middleware/auth.tsapps/gateway/src/middleware/error-sanitizer.tsapps/gateway/src/middleware/lifecycle.tsapps/gateway/src/middleware/request-id.tsapps/gateway/src/middleware/sentry.tsapps/gateway/src/middleware/tenant.tsapps/gateway/src/providers/impl/github.test.tsapps/gateway/src/providers/impl/github.tsapps/gateway/src/providers/impl/linear.test.tsapps/gateway/src/providers/impl/linear.tsapps/gateway/src/providers/impl/sentry.test.tsapps/gateway/src/providers/impl/sentry.tsapps/gateway/src/providers/impl/vercel.test.tsapps/gateway/src/providers/impl/vercel.tsapps/gateway/src/providers/index.test.tsapps/gateway/src/providers/index.tsapps/gateway/src/providers/schemas.tsapps/gateway/src/providers/types.tsapps/gateway/src/routes/connections.integration.test.tsapps/gateway/src/routes/connections.test.tsapps/gateway/src/routes/connections.tsapps/gateway/src/routes/workflows.tsapps/gateway/src/sentry-init.tsapps/gateway/src/workflows/connection-teardown.test.tsapps/gateway/src/workflows/connection-teardown.tsapps/gateway/tsconfig.build.jsonapps/gateway/tsconfig.jsonapps/gateway/tsup.config.tsapps/gateway/turbo.jsonapps/gateway/vercel.jsonapps/gateway/vitest.config.tspackage.jsonpackages/integration-tests/package.jsonpackages/integration-tests/src/api-console-connections.integration.test.tspackages/integration-tests/src/backfill-connections-api.integration.test.tspackages/integration-tests/src/cli-oauth-full-flow.integration.test.tspackages/integration-tests/src/connections-backfill-trigger.integration.test.tspackages/integration-tests/src/connections-browser-oauth-flow.integration.test.tspackages/integration-tests/src/connections-cli-oauth-flow.integration.test.tspackages/integration-tests/src/connections-relay-cache.integration.test.tspackages/integration-tests/src/contract-snapshots.test.tspackages/integration-tests/src/event-ordering.integration.test.tspackages/integration-tests/src/full-stack-connection-lifecycle.integration.test.tspackages/integration-tests/src/harness.tspackages/integration-tests/tsconfig.jsonpackages/integration-tests/vitest.config.ts
packages/integration-tests/src/connections-cli-oauth-flow.integration.test.ts
Show resolved
Hide resolved
- Add inline comment about Vercel project rename dependency on withRelatedProject usage - Add temporary legacy rewrite for /services/connections/:path* so OAuth callbacks still work during rollout - Update error messages in backfill-orchestrator and entity-worker from "Connections" to "Gateway" (+ matching test assertions) - Update docblocks in CLI and browser OAuth test files to use full /services/gateway/ paths - Update test titles in contract-snapshots and full-stack lifecycle tests to reflect actual route paths - Update stale snapshots Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (3)
packages/integration-tests/src/full-stack-connection-lifecycle.integration.test.ts (1)
1-15: 🧹 Nitpick | 🔵 TrivialConsider updating the file header to reflect the gateway service rename.
The docblock still references "Connections" as a service name in lines 5-7 (e.g., "Connections writes cache", "Connections notifies Backfill", "Backfill fetches from Connections HTTP API"). While the PR preserves domain-concept names like the tRPC router key, these comments describe the service layer rather than the domain concept. Update them to say "Gateway" for consistency with the renamed service.
Suggested docblock update
* End-to-end integration tests that wire all three services together: -* - Connections writes cache → Relay reads it -* - Connections notifies Backfill via QStash -* - Backfill fetches from Connections HTTP API +* - Gateway writes cache → Relay reads it +* - Gateway notifies Backfill via QStash +* - Backfill fetches from Gateway HTTP API * - Backfill dispatches events to Relay🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/integration-tests/src/full-stack-connection-lifecycle.integration.test.ts` around lines 1 - 15, Update the file header docblock to replace service-layer references to "Connections" with the new service name "Gateway" so the comments match the rename; specifically edit the sentences that currently read like "Connections writes cache", "Connections notifies Backfill via QStash", and "Backfill fetches from Connections HTTP API" in the top-of-file comment block in full-stack-connection-lifecycle.integration.test.ts (the docblock containing "Suite 5: Full Stack Connection Lifecycle") to use "Gateway" instead of "Connections" while keeping domain-concept names (like any tRPC router keys) unchanged.apps/backfill/src/workflows/entity-worker.test.ts (1)
100-101:⚠️ Potential issue | 🟡 MinorUpdate stale test titles that still reference Connections.
Assertions target Gateway, but two test names still say “Connections API”, which makes failures misleading.
✏️ Suggested rename
- it("fetches token from Connections API and proceeds", async () => { + it("fetches token from Gateway API and proceeds", async () => { ... - it("throws when Connections API returns 401", async () => { + it("throws when Gateway API returns 401", async () => {As per coding guidelines:
**/*.test.ts: Test files. Review for: - Descriptive test names.Also applies to: 120-120
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apps/backfill/src/workflows/entity-worker.test.ts` around lines 100 - 101, The two test titles within the describe("get-token step") block are stale—rename the it() descriptions that mention "Connections API" (e.g., "fetches token from Connections API and proceeds" and the other similar test at the same block) to reference the Gateway (e.g., "fetches token from Gateway and proceeds") so the test names match the actual assertions against Gateway; update both it() strings in the entity-worker.test.ts file to clear, descriptive titles reflecting Gateway.apps/backfill/src/workflows/backfill-orchestrator.test.ts (1)
134-134:⚠️ Potential issue | 🟡 MinorRename the test case title to Gateway for consistency.
The assertion now checks a Gateway error, so keeping “Connections API” in the title is outdated.
✏️ Suggested rename
- it("throws when Connections API returns 404", async () => { + it("throws when Gateway API returns 404", async () => {As per coding guidelines:
**/*.test.ts: Test files. Review for: - Descriptive test names.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apps/backfill/src/workflows/backfill-orchestrator.test.ts` at line 134, The test case title is outdated: update the it(...) string in backfill-orchestrator.test.ts from "throws when Connections API returns 404" to a Gateway-focused description (e.g., "throws when Gateway returns 404") so it matches the assertion checking for a Gateway error; locate the it(...) invocation in the file (the test for backfill orchestrator) and change only the test name string to reflect "Gateway" for consistency.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@apps/backfill/src/workflows/backfill-orchestrator.test.ts`:
- Line 134: The test case title is outdated: update the it(...) string in
backfill-orchestrator.test.ts from "throws when Connections API returns 404" to
a Gateway-focused description (e.g., "throws when Gateway returns 404") so it
matches the assertion checking for a Gateway error; locate the it(...)
invocation in the file (the test for backfill orchestrator) and change only the
test name string to reflect "Gateway" for consistency.
In `@apps/backfill/src/workflows/entity-worker.test.ts`:
- Around line 100-101: The two test titles within the describe("get-token step")
block are stale—rename the it() descriptions that mention "Connections API"
(e.g., "fetches token from Connections API and proceeds" and the other similar
test at the same block) to reference the Gateway (e.g., "fetches token from
Gateway and proceeds") so the test names match the actual assertions against
Gateway; update both it() strings in the entity-worker.test.ts file to clear,
descriptive titles reflecting Gateway.
In
`@packages/integration-tests/src/full-stack-connection-lifecycle.integration.test.ts`:
- Around line 1-15: Update the file header docblock to replace service-layer
references to "Connections" with the new service name "Gateway" so the comments
match the rename; specifically edit the sentences that currently read like
"Connections writes cache", "Connections notifies Backfill via QStash", and
"Backfill fetches from Connections HTTP API" in the top-of-file comment block in
full-stack-connection-lifecycle.integration.test.ts (the docblock containing
"Suite 5: Full Stack Connection Lifecycle") to use "Gateway" instead of
"Connections" while keeping domain-concept names (like any tRPC router keys)
unchanged.
ℹ️ Review info
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
⛔ Files ignored due to path filters (1)
packages/integration-tests/src/__snapshots__/contract-snapshots.test.ts.snapis excluded by!**/*.snap
📒 Files selected for processing (10)
api/console/src/router/org/connections.tsapps/backfill/src/workflows/backfill-orchestrator.test.tsapps/backfill/src/workflows/backfill-orchestrator.tsapps/backfill/src/workflows/entity-worker.test.tsapps/backfill/src/workflows/entity-worker.tsapps/console/next.config.tspackages/integration-tests/src/connections-browser-oauth-flow.integration.test.tspackages/integration-tests/src/connections-cli-oauth-flow.integration.test.tspackages/integration-tests/src/contract-snapshots.test.tspackages/integration-tests/src/full-stack-connection-lifecycle.integration.test.ts
Summary
apps/connections/→apps/gateway/, completing the second half of the two-step rename (first:apps/gateway→apps/relayin refactor: rename apps/gateway to apps/relay #445)@lightfast/connections→@lightfast/gateway), Vercel project refs (lightfast-connections→lightfast-gateway), URL paths (/services/connections/→/services/gateway/), all imports, test aliases, service tags, and commentsconnectionsRouter,gw_DB tables,gw:Redis prefix, andGATEWAY_API_KEYenv var are all unchangedWhat's NOT changed
connections(domain concept, not app name)@repo/gateway-typespackage (already correct)gw_installations,gw_resources) and Redis prefix (gw:)GATEWAY_API_KEYenv var (already correct)Post-merge manual steps
lightfast-connections→lightfast-gatewayin dashboardgateway.lightfast.aiDNS in Vercel/services/gateway/pathsTest plan
pnpm typecheckpasses (148/148)pnpm lintpasses (131/131)pnpm testpasses (75/75)apps/connections,@lightfast/connections, orlightfast-connectionsreferences in source filespnpm dev:appstarts gateway on port 4110/services/gateway/proxy path🤖 Generated with Claude Code