the-custodian/docs/hub-ecosystem-async-base-decision.md

32 lines
1.1 KiB
Markdown
Raw Normal View History

# 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.