Skip to content

refactor(host): make every remaining consumer use HostResolution#755

Draft
gewenyu99 wants to merge 1 commit into
mainfrom
posthog-code/host-resolution-cleanup
Draft

refactor(host): make every remaining consumer use HostResolution#755
gewenyu99 wants to merge 1 commit into
mainfrom
posthog-code/host-resolution-cleanup

Conversation

@gewenyu99

@gewenyu99 gewenyu99 commented Jun 28, 2026

Copy link
Copy Markdown
Collaborator

The rest of the migration, stacked on #749 (which adds the class and routes #746's own resolution through it).

Flips Credentials.host from a string to a HostResolution (resolved once at auth) and routes every remaining consumer through it — host.apiHost / host.appHost / host.gatewayUrl / host.mcpUrl — replacing loose (region, baseUrl) threading everywhere outside #746's own surface: self-driving, source-maps, task-stream, orchestrator, agentic, prompts, Doctor/Slack screens, the WizardUI interfaces, plus the test/playground ripple.

Pre-auth OAuth/provisioning URL resolution stays loose (no region yet).

Review/merge order: #746 (with #749 merged in) → this.

@github-actions

Copy link
Copy Markdown

🧙 Wizard CI

Run the Wizard CI and test your changes against wizard-workbench example apps by replying with a GitHub comment using one of the following commands:

Test all apps:

  • /wizard-ci all

Test all apps in a directory:

  • /wizard-ci basic-integration
  • /wizard-ci error-tracking-upload-source-maps
  • /wizard-ci mcp-analytics
  • /wizard-ci misc
  • /wizard-ci revenue

Test an individual app:

  • /wizard-ci basic-integration/android
  • /wizard-ci basic-integration/angular
  • /wizard-ci basic-integration/astro
Show more apps
  • /wizard-ci basic-integration/django
  • /wizard-ci basic-integration/fastapi
  • /wizard-ci basic-integration/flask
  • /wizard-ci basic-integration/javascript-node
  • /wizard-ci basic-integration/javascript-web
  • /wizard-ci basic-integration/laravel
  • /wizard-ci basic-integration/next-js
  • /wizard-ci basic-integration/nuxt
  • /wizard-ci basic-integration/python
  • /wizard-ci basic-integration/rails
  • /wizard-ci basic-integration/react-native
  • /wizard-ci basic-integration/react-router
  • /wizard-ci basic-integration/sveltekit
  • /wizard-ci basic-integration/swift
  • /wizard-ci basic-integration/tanstack-router
  • /wizard-ci basic-integration/tanstack-start
  • /wizard-ci basic-integration/vue
  • /wizard-ci error-tracking-upload-source-maps/android
  • /wizard-ci error-tracking-upload-source-maps/cicd-docker-node-raw
  • /wizard-ci error-tracking-upload-source-maps/cicd-github-actions-docker-node-raw
  • /wizard-ci error-tracking-upload-source-maps/cicd-github-actions-nested-docker-node-raw
  • /wizard-ci error-tracking-upload-source-maps/cicd-github-actions-node-raw
  • /wizard-ci error-tracking-upload-source-maps/cicd-github-actions-single-stage-docker-node-raw
  • /wizard-ci error-tracking-upload-source-maps/cicd-gitlab-node-raw
  • /wizard-ci error-tracking-upload-source-maps/cicd-monorepo-pnpm-node-react
  • /wizard-ci error-tracking-upload-source-maps/cicd-monorepo-raw-node-react
  • /wizard-ci error-tracking-upload-source-maps/cicd-ssh-vps-node-raw
  • /wizard-ci error-tracking-upload-source-maps/flutter
  • /wizard-ci error-tracking-upload-source-maps/ios
  • /wizard-ci error-tracking-upload-source-maps/next
  • /wizard-ci error-tracking-upload-source-maps/next-no-posthog
  • /wizard-ci error-tracking-upload-source-maps/node-raw
  • /wizard-ci error-tracking-upload-source-maps/node-rollup
  • /wizard-ci error-tracking-upload-source-maps/node-rollup-typescript-plugin
  • /wizard-ci error-tracking-upload-source-maps/node-webpack
  • /wizard-ci error-tracking-upload-source-maps/nuxt-3-6
  • /wizard-ci error-tracking-upload-source-maps/nuxt-4-3
  • /wizard-ci error-tracking-upload-source-maps/react-native
  • /wizard-ci error-tracking-upload-source-maps/react-vite
  • /wizard-ci error-tracking-upload-source-maps/rust
  • /wizard-ci mcp-analytics/custom-dispatcher
  • /wizard-ci mcp-analytics/typescript-sdk
  • /wizard-ci misc/quack-quack
  • /wizard-ci revenue/stripe

Results will be posted here when complete.

@gewenyu99 gewenyu99 force-pushed the posthog-code/host-resolution-class branch from 03864d4 to a8be871 Compare June 28, 2026 22:26
@gewenyu99 gewenyu99 force-pushed the posthog-code/host-resolution-cleanup branch from 94b2f8d to a3defe1 Compare June 28, 2026 22:27
@gewenyu99 gewenyu99 changed the title refactor(host): drop dead cloudRegion plumbing (follow-up to #749) refactor(host): route every consumer through HostResolution Jun 28, 2026
@gewenyu99 gewenyu99 force-pushed the posthog-code/host-resolution-class branch from a8be871 to 25691f6 Compare June 28, 2026 22:52
@gewenyu99 gewenyu99 force-pushed the posthog-code/host-resolution-cleanup branch from a3defe1 to 7ac776d Compare June 28, 2026 22:53
@gewenyu99 gewenyu99 changed the title refactor(host): route every consumer through HostResolution refactor(host): make every remaining consumer use HostResolution Jun 28, 2026
gewenyu99 added a commit that referenced this pull request Jun 28, 2026
Introduce HostResolution — a frozen, resolve-once snapshot of every PostHog
origin (api/app/asset/gateway/mcp), a façade over the @utils/urls resolvers
that carries the --base-url override through every field.

Point #746's own host resolution at it: the auth-time region+host resolution
(setup-utils), the LLM gateway (agent-interface, mcp-prompt-streaming), and the
region->app-url derivations (linear, audit, events-audit, posthog-integration,
AiOptIn) now go through HostResolution instead of getHost/getCloudUrl/
getLlmGatewayUrl/detectRegion.

Credentials.host stays a string here, so the single-field sites construct a
throwaway HostResolution to read one origin — each marked TODO: clean up in
#755, where the Credentials.host flip lets them read off the resolved object.

Meant to merge into #746.
@gewenyu99 gewenyu99 force-pushed the posthog-code/host-resolution-class branch from 25691f6 to e5eb333 Compare June 28, 2026 23:15
@gewenyu99 gewenyu99 force-pushed the posthog-code/host-resolution-cleanup branch from 7ac776d to 4ecd3e3 Compare June 28, 2026 23:15
rafaeelaudibert pushed a commit that referenced this pull request Jun 30, 2026
…749)

Introduces `HostResolution` and points **#746's own host-resolution code** at it — minimal, meant to **merge into #746** and release with it.

Where #746 resolves a PostHog origin via the loose `getHost`/`getCloudUrl`/`getLlmGatewayUrl`/`detectRegion(region, baseUrl)` helpers, it now goes through `HostResolution` instead:
- auth-time region+host resolution (`setup-utils`)
- the LLM gateway (`agent-interface`, `mcp-prompt-streaming`)
- the region→app-url derivations (`linear`, `audit`, `events-audit`, `posthog-integration`, `AiOptIn`)

`Credentials.host` stays a `string` here. Flipping it to the object and migrating every *other* consumer is the stacked PR (#755), so this stays minimal and doesn't grow #746.

Stacked on #746 (`feat/base-url-override`).
Base automatically changed from posthog-code/host-resolution-class to feat/base-url-override June 30, 2026 00:31
rafaeelaudibert pushed a commit that referenced this pull request Jun 30, 2026
…749)

Introduces `HostResolution` and points **#746's own host-resolution code** at it — minimal, meant to **merge into #746** and release with it.

Where #746 resolves a PostHog origin via the loose `getHost`/`getCloudUrl`/`getLlmGatewayUrl`/`detectRegion(region, baseUrl)` helpers, it now goes through `HostResolution` instead:
- auth-time region+host resolution (`setup-utils`)
- the LLM gateway (`agent-interface`, `mcp-prompt-streaming`)
- the region→app-url derivations (`linear`, `audit`, `events-audit`, `posthog-integration`, `AiOptIn`)

`Credentials.host` stays a `string` here. Flipping it to the object and migrating every *other* consumer is the stacked PR (#755), so this stays minimal and doesn't grow #746.

Stacked on #746 (`feat/base-url-override`).
@rafaeelaudibert rafaeelaudibert force-pushed the feat/base-url-override branch from 1f6a999 to 3770db7 Compare June 30, 2026 00:36
Base automatically changed from feat/base-url-override to main June 30, 2026 01:20
The rest of the migration, on top of the class PR. Flip Credentials.host from a
string to a HostResolution (resolved once at auth) and route every remaining
consumer through it (host.apiHost / host.appHost / host.gatewayUrl /
host.mcpUrl), replacing the loose (region, baseUrl) threading everywhere outside
prompts, Doctor/Slack screens, the WizardUI interfaces, plus test/playground
ripple. Also resolves the #749 TODOs — the throwaway single-field constructions
become reads off the resolved credentials.host.

Pre-auth OAuth/provisioning URL resolution stays loose (no region yet).
@gewenyu99 gewenyu99 force-pushed the posthog-code/host-resolution-cleanup branch from 4ecd3e3 to 8ddf75f Compare June 30, 2026 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant