fix: repoint dead .com hosts to live .dev (recoupable/chat#1819 §A+§B)

Merged
SW
4mo ago
+70-626

Part of the recoupable.com -> .dev migration (tracking issue recoupable/chat#1819, §A+§B). Repoints the dead .com hosts that this repo emits to their verified-live .dev equivalents.

Live targets (verified 200)

chat.recoupable.dev, api.recoupable.dev, docs.recoupable.dev. Apex recoupable.com/www is still alive, so it is untouched. Emails (INBOUND_EMAIL_DOMAIN, OUTBOUND_EMAIL_DOMAIN, agent@/shared@, noreply) are untouched.

Changes

FileChange
lib/composio/getFrontendBaseUrl.tsproduction fallback chat.recoupable.com -> chat.recoupable.dev (env-var logic/fallback structure unchanged)
lib/const.tsnew DOCS_BASE_URL = "https://docs.recoupable.dev" next to the email-domain consts
lib/emails/getEmailFooter.tschat link now built from getFrontendBaseUrl()
lib/agents/buildTaskCard.tstask link now built from getFrontendBaseUrl()
lib/coding-agent/handleGitHubWebhook.tstask link now built from getFrontendBaseUrl()
app/page.tsxdocs link -> DOCS_BASE_URL
app/api/chat/route.tscontract comment developers.recoupable.com -> docs.recoupable.dev
lib/chat/recoupApiSkillPrompt.tsdoc host in the agent prompt -> docs.recoupable.dev
lib/emails/inbound/extractRoomIdFromHtml.ts / extractRoomIdFromText.tshost regex widened to recoupable.(com|dev)

DRY approach

All chat-app links route through the existing getFrontendBaseUrl() centralizer rather than carrying their own host literal — flip the host once, every chat/task link follows. Docs links reference the single new DOCS_BASE_URL constant.

RED -> GREEN regex test

The inbound room-id extractors only matched chat.recoupable.com/chat/{uuid}. Added a failing test in both extractRoomIdFromHtml.test.ts and extractRoomIdFromText.test.ts asserting a https://chat.recoupable.dev/chat/<uuid> link extracts the room id, confirmed RED (2 failed / 22 passed), then widened the host part to recoupable.(com|dev):

  • HTML: capturing (com|dev) group added, UUID match index shifted 1 -> 2.
  • Text: non-capturing (?:com|dev) keeps the UUID at group 1.

Legacy .com links still in flight continue to match (existing .com tests stay green), so old emails keep resolving.

Two existing behavioral tests (getEmailFooter, buildTaskCard) that asserted the hardcoded .com URL were updated to assert against getFrontendBaseUrl(), reflecting the DRY routing.

Excluded

  • lib/credits/const.ts:35 sandbox.recoupable.com/settings/profile — sandbox.recoupable.dev is not provisioned (404), so it stays .com pending a sandbox .dev domain.
  • Two further .com doc-host references outside this PR's gate scope (lib/apify/sendApifyWebhookEmail.ts:39 chat link, lib/mcp/tools/registerGetApiKeyTool.ts:25 developers.recoupable.com/api.recoupable.com) were left for a follow-up since they fall outside the touched-domain test suites.

Gate results

  • vitest run lib/emails lib/agents lib/composio lib/coding-agent lib/chat: 1087 passed / 169 files (RED->GREEN .dev tests included).
  • tsc --noEmit: 0 errors in any changed file. 232 pre-existing errors remain in unrelated test files (lib/stripe, lib/supabase, lib/tasks, lib/trigger — mock-shape drift vs generated DB/Trigger types); none introduced by this PR.
  • eslint on changed files: 0 errors (one benign app/page.tsx "no matching configuration" warning, pre-existing flat-config coverage).

🤖 Generated with Claude Code


Summary by cubic

Repointed dead .com hosts to their live .dev equivalents and centralized link building to keep links working across the app (part of recoupable/chat#1819 §A+§B). Backward-compatible parsing keeps existing .com links valid.

  • Refactors

    • getFrontendBaseUrl() now resolves production to https://chat.recoupable.dev; all chat/task links use it (email footers, task cards, GitHub comments).
    • Added DOCS_BASE_URL = "https://docs.recoupable.dev" and switched docs links (homepage, agent prompt, comments).
    • Removed superseded /api/notifications route and its handlers/tests; use POST /api/emails.
  • Bug Fixes

    • Updated room-id extractors to accept recoupable.(com|dev) and added .dev tests.
    • Fixed inline contract links to point at docs.recoupable.dev.