feat(ecosystem): hub-core library lane for three-repo stack (HUB-WP-0003)
Add slugify_or_default for core-hub parity, bump to 0.2.0, document ecosystem position in INTENT/SCOPE/README, wire capability relations to state-hub and core-hub, and extend utils tests. Part of CUST-WP-0057 consolidation.
This commit is contained in:
parent
41a396e807
commit
118d4fdcfe
16 changed files with 1766 additions and 21 deletions
38
docs/metadata-isolation.md
Normal file
38
docs/metadata-isolation.md
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
# SQLAlchemy Metadata Isolation
|
||||
|
||||
**Updated:** 2026-07-09
|
||||
**Workplan:** `HUB-WP-0003-T03`
|
||||
|
||||
---
|
||||
|
||||
## Rule
|
||||
|
||||
`hub_core.models.base.Base` owns metadata for **shared primitive tables only**
|
||||
(domains, managed_repos, agent_messages, progress_events, capability_*, tpsc_*).
|
||||
|
||||
Each host runtime keeps its own declarative base for host-specific tables:
|
||||
|
||||
| Host | Base module | Session style |
|
||||
| --- | --- | --- |
|
||||
| `state-hub` | `api.models.base.Base` | Sync |
|
||||
| `core-hub` | `core_hub.db.Base` | Async |
|
||||
|
||||
Router factories never import host models from hub-core. Hosts inject models at
|
||||
mount time:
|
||||
|
||||
```python
|
||||
from hub_core.routers.domains import create_domains_router
|
||||
|
||||
app.include_router(create_domains_router(get_session, domain_model=Domain, ...))
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Why separate metadata
|
||||
|
||||
- Migration ownership stays with the host that runs the database.
|
||||
- core-hub framework tables (`hubs`, `widgets`, …) must not appear in hub-core.
|
||||
- state-hub dev-hub tables (workplans, tasks, …) must not appear in hub-core.
|
||||
- Async and sync engines can coexist without forcing one base class.
|
||||
|
||||
See `the-custodian/docs/hub-ecosystem-architecture.md` for the full stack model.
|
||||
Loading…
Add table
Add a link
Reference in a new issue