Skip to content

refactor(hub)!: delete hub-api-client and migration-runner; the hub applies package migrations itself (CL-8325) - #837

Merged
TheGreatAxios merged 4 commits into
mainfrom
cl-8325-hub-migrations
Sep 18, 2026
Merged

TheGreatAxios merged 4 commits into
mainfrom
cl-8325-hub-migrations

Conversation

@TheGreatAxios

Copy link
Copy Markdown
Contributor

Summary

  • The hub applies its own database migrations at boot (apps/hub/src/migrate.ts): @intx/db's platform migrations, then @corbits/cron, @corbits/webhook-triggers, @corbits/mailbox, @corbits/artifacts, and @corbits/memory's own migrations — one process doing the work directly, like upstream Interchange.
  • @corbits/migration-runner is deleted. Cron, webhook-triggers, and evals now each ship a single idempotent SQL block (CREATE SCHEMA IF NOT EXISTS + IF NOT EXISTS throughout) applied inside a pg_advisory_xact_lock-guarded transaction — no ledger table needed.
  • scripts/db-setup.ts shrinks to: create the database if missing, then call the hub's migrateHub. scripts/reset.ts and scripts/dev.ts keep working against the smaller surface.
  • @corbits/hub-api-client is not deleted: packages/connections (a large, active consumer — being deleted separately in CL-8327) still depends on it throughout. Per the ruling, it's left in place but no longer a dependency of apps/hub (which never actually imported it — packages/tool-registry-publish already declares its own structurally-compatible ApiCall type instead of importing @corbits/hub-api-client's).
  • docs/package-migrations.md is deleted; the convention it described is now one sentence each in AGENTS.md, ARCHITECTURE.md, CONTRIBUTING.md, and IMPLEMENTATION.md.
  • tsconfig.build.json edited by hand to drop the migration-runner reference.

Test plan

  • bun run typecheck
  • bun run lint
  • bun run fmt
  • bun test apps/hub packages/cron packages/webhook-triggers packages/tool-registry-publish packages/evals — all non-DB-gated tests pass (286 pass, 30 skipped for no local Postgres)
  • Live migration verification against a scratch Postgres — the shared local Postgres was saturated ("too many clients already") for the whole session, so this could not be confirmed live. The non-DB-gated suite covers the SQL/lock logic; the DB-gated suites (compose.test.yml) should be run in CI.

@linear-code

linear-code Bot commented Sep 18, 2026

Copy link
Copy Markdown

CL-8325

…need a runner

Each package's migration is a single CREATE-SCHEMA-IF-NOT-EXISTS plus
IF-NOT-EXISTS SQL block run inside a pg_advisory_xact_lock-guarded
transaction, so no ledger table (and no shared @corbits/migration-runner)
is needed to know what has already run.
apps/hub/src/migrate.ts runs @intx/db's platform migrations, then
cron/webhook-triggers/mailbox/artifacts/memory's own migrations, once
before createHubServer mounts anything. scripts/db-setup.ts shrinks to
creating the database if missing and calling that same function;
scripts/dev.ts's report shrinks to match. apps/hub no longer depends on
@corbits/hub-api-client, which it never actually imported.
… doc

Deletes docs/package-migrations.md now that the migration shape it
described (ledger tables, an explicit apply order in scripts/db-setup.ts)
is gone; the remaining rule is one sentence in AGENTS.md, ARCHITECTURE.md,
CONTRIBUTING.md, and IMPLEMENTATION.md.
@corbits/connections and @corbits/evals were the only consumers of
@corbits/hub-api-client besides scripts/publish-tools.ts, and both are
gone from main now. Deletes the package, its now-orphaned CLI script and
package.json script entry, and the tsconfig.build.json/README references
to it. @corbits/tool-registry-publish already declared its own
structurally-compatible ApiCall type rather than importing hub-api-client's.
@TheGreatAxios
TheGreatAxios merged commit 4d9991c into main Sep 18, 2026
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