Repository navigation
refactor(hub)!: upstream server shape plus one Corbits mount block - #814
Merged
Merged
Conversation
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
force-pushed
the
hub-upstream-shape
branch
from
September 17, 2026 23:13
45617e1 to
5e4e7c4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
apps/hubtakes upstream Interchange's own hub shape (owner ruling, LESS IS MORE):apps/hub/src/index.tsisexport default await createHubServer(), andapps/hub/src/server.tsis upstream's ownserver.ts(stockcreateAuth(db),DB_HOST/DB_PORT/DB_USER/DB_PASSWORD/DB_NAME/PG_SCHEMA, noSESSION_SECRET/social sign-in) plus one clearly delimited block that mounts every Corbits library the hub still needs.@corbits/mailbox(mountMailbox+ the dual-writemailbox-persist.tshelper),@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) withnative-connector-registry.ts'sCONNECTOR_REGISTRY/MCP_PRESETS, and@corbits/workflows' author routes.apps/hub/src/config.ts(env parsing folds intoserver.ts, upstream-style, readingprocess.envdirectly), the static handler andHUB_STATIC_DIR(the hub no longer serves the web build —bun run devnow starts the web app's own Vite dev server alongside the hub, using its existing/apiproxy), theALLOW_PLAINTEXT_SECRETSdev-only credential-cipher fallback, and social (Google/GitHub) sign-in — none of these exist in upstream's own composition.notify-delivery.tsis also gone: nothing mounted it.config.test.ts,credential-cipher.test.ts,static-handler.test.ts,notify-delivery.test.ts, andscripts/dev.test.ts(all asserted on deleted surface). Rewroteapps/hub/test/composition.test.tsagainst the new shape — it bootscreateHubServer()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.tsmoved offapps/hub/src/config.ts'sHubConfigonto the same env vars the hub itself now reads (DATABASE_URLstill drives everything for tooling;dev.ts/harness.tsderiveDB_HOST/DB_PORT/DB_USER/DB_PASSWORD/DB_NAMEfrom it for the hub process).apps/hub/srcline 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'sDB_HOST/DB_PORT/DB_USER/DB_PASSWORD/DB_NAME/PG_SCHEMA,PORT,HUB_MAX_TARBALL_BYTES.CREDENTIAL_ENCRYPTION_KEY/PRINCIPAL_KEY_ENCRYPTION_KEYare now unconditionally required (no plaintext fallback).BASE_URLis kept, narrowed to feeding only the Corbits connections/OAuth mount's callback URLs.Test plan
bun run typecheck— cleanbun run lint— cleanbun run fmt— cleanHUB_DATA_DIR=$(mktemp -d) bun apps/hub/src/index.tswith no DB/credential env fails atCREDENTIAL_ENCRYPTION_KEY environment variable is requiredinsidecreateHubServer, not at importbun testinapps/hub— DB-gatedcomposition.test.ts/mailbox-persist.test.tsboot the hub correctly (signing key generated, sidecar reconciliation loop starts) but hitsorry, too many clients alreadyagainst 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