the-custodian/docs/hub-ecosystem-async-base-decision.md
codex aab187937b
All checks were successful
CI Smoke / host-smoke (push) Successful in 0s
CI Smoke / container-smoke (push) Successful in 5s
docs(ecosystem): complete hub stack consolidation (CUST-WP-0057)
Publish ecosystem architecture, event mapping, capability bridge, and async-base
decision docs; add cross-repo regression script; update extraction boundary and
bootstrap status; archive WP-0058 touch-ups.
2026-07-11 01:26:53 +02:00

1.1 KiB

Hub Ecosystem — Async SQLAlchemy Base Decision

Updated: 2026-07-09
Workplan: HUB-WP-0003-T04
Decision: Defer shared async base; hosts keep separate metadata


Question

Should hub_core.models.base expose an async-compatible declarative base for core-hub (async SQLAlchemy) while state-hub remains on sync sessions?


Finding

  • state-hub uses sync SQLAlchemy with FastAPI dependency-injected sessions.
  • core-hub uses sqlalchemy.ext.asyncio with a separate core_hub.db.Base.
  • Router factories in hub-core accept host-injected models — they do not require a shared metadata registry across runtimes.
  • Merging bases would couple migration ownership and risk breaking State Hub's 400+ test regression without benefit for the first consolidation slice.

Decision

Defer. Each runtime keeps its own Base and Alembic history. hub-core documents metadata isolation in docs/metadata-isolation.md. Revisit only if a second async host needs to mount hub-core router factories with shared tables in the same database instance.