Skip to content

refactor(hub)!: upstream server shape plus one Corbits mount block - #814

Merged
TheGreatAxios merged 1 commit into
mainfrom
hub-upstream-shape
Sep 17, 2026
Merged

TheGreatAxios merged 1 commit into
mainfrom
hub-upstream-shape

Conversation

@TheGreatAxios

Copy link
Copy Markdown
Contributor

Summary

  • apps/hub takes upstream Interchange's own hub shape (owner ruling, LESS IS MORE): apps/hub/src/index.ts is export default await createHubServer(), and apps/hub/src/server.ts is upstream's own server.ts (stock createAuth(db), DB_HOST/DB_PORT/DB_USER/DB_PASSWORD/DB_NAME/PG_SCHEMA, no SESSION_SECRET/social sign-in) plus one clearly delimited block that mounts every Corbits library the hub still needs.
  • Corbits mount block: @corbits/mailbox (mountMailbox + the dual-write mailbox-persist.ts helper), @corbits/memory, @corbits/cron (migrations + mount + ticker), @corbits/artifacts (mountArtifacts + mountWorkflowArtifacts), @corbits/webhook-triggers (management + ingress + launch), @corbits/connections (connections, OAuth connect, OAuth loopback, MCP servers, MCP OAuth, workflow-connections) with native-connector-registry.ts's CONNECTOR_REGISTRY/MCP_PRESETS, and @corbits/workflows' author routes.
  • Deleted: apps/hub/src/config.ts (env parsing folds into server.ts, upstream-style, reading process.env directly), the static handler and HUB_STATIC_DIR (the hub no longer serves the web build — bun run dev now starts the web app's own Vite dev server alongside the hub, using its existing /api proxy), the ALLOW_PLAINTEXT_SECRETS dev-only credential-cipher fallback, and social (Google/GitHub) sign-in — none of these exist in upstream's own composition. notify-delivery.ts is also gone: nothing mounted it.
  • Tests: deleted config.test.ts, credential-cipher.test.ts, static-handler.test.ts, notify-delivery.test.ts, and scripts/dev.test.ts (all asserted on deleted surface). Rewrote apps/hub/test/composition.test.ts against the new shape — it boots createHubServer() and proves stock platform routes answer plus a Corbits mount (mailbox) still sits inside the native tenant middleware.
  • scripts/dev.ts, scripts/e2e/harness.ts, scripts/reset.ts moved off apps/hub/src/config.ts's HubConfig onto the same env vars the hub itself now reads (DATABASE_URL still drives everything for tooling; dev.ts/harness.ts derive DB_HOST/DB_PORT/DB_USER/DB_PASSWORD/DB_NAME from it for the hub process).

apps/hub/src line count: 2794 -> 1757 lines.

Env names changed: dropped SESSION_SECRET, HUB_STATIC_DIR, ALLOW_PLAINTEXT_SECRETS, GOOGLE_CLIENT_ID/SECRET, GITHUB_CLIENT_ID/SECRET, SIGNUP_RATE_LIMIT_*, SIGNIN_RATE_LIMIT_*, SIDECAR_DEFAULT_PROVISIONER. Added/kept upstream's DB_HOST/DB_PORT/DB_USER/DB_PASSWORD/DB_NAME/PG_SCHEMA, PORT, HUB_MAX_TARBALL_BYTES. CREDENTIAL_ENCRYPTION_KEY/PRINCIPAL_KEY_ENCRYPTION_KEY are now unconditionally required (no plaintext fallback). BASE_URL is kept, narrowed to feeding only the Corbits connections/OAuth mount's callback URLs.

Test plan

  • bun run typecheck — clean
  • bun run lint — clean
  • bun run fmt — clean
  • HUB_DATA_DIR=$(mktemp -d) bun apps/hub/src/index.ts with no DB/credential env fails at CREDENTIAL_ENCRYPTION_KEY environment variable is required inside createHubServer, not at import
  • bun test in apps/hub — DB-gated composition.test.ts/mailbox-persist.test.ts boot the hub correctly (signing key generated, sidecar reconciliation loop starts) but hit sorry, too many clients already against this machine's shared local Postgres (heavy concurrent use by other agents on this box) before completing their HTTP assertions; this is environment contention, not a code issue — needs a re-run against a dedicated Postgres/CI to confirm green

apps/hub takes upstream Interchange's hub shape exactly: server.ts is
upstream's own composition (createAuth, DB_HOST/DB_PORT/DB_USER/
DB_PASSWORD/DB_NAME, no SESSION_SECRET or social sign-in) with one
delimited block mounting every Corbits library the hub still needs
(mailbox, memory, cron, artifacts, webhook-triggers, connections/OAuth/
MCP, workflow-authoring). index.ts is `export default await
createHubServer()`, matching upstream.

Deleted: config.ts (env parsing folds into server.ts, upstream-style),
the static handler and HUB_STATIC_DIR (the web app now runs its own
dev server), the ALLOW_PLAINTEXT_SECRETS credential-cipher fallback and
social sign-in, notify-delivery.ts (dead: nothing mounted it), and the
tests that assumed that surface (config, credential-cipher,
static-handler tests; composition.test.ts rewritten against the new
shape). scripts/dev.ts, scripts/e2e/harness.ts, and scripts/reset.ts
move off apps/hub/src/config.ts's HubConfig onto the same env vars the
hub itself now reads.
@TheGreatAxios
TheGreatAxios merged commit 9471c89 into main Sep 17, 2026
3 of 4 checks passed
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