diff --git a/workplans/CUST-WP-0025-fos-hub-bootstrap.md b/workplans/CUST-WP-0025-fos-hub-bootstrap.md index 4723cd7..53c514d 100644 --- a/workplans/CUST-WP-0025-fos-hub-bootstrap.md +++ b/workplans/CUST-WP-0025-fos-hub-bootstrap.md @@ -257,95 +257,11 @@ Refactor the standalone `/home/worsch/state-hub` codebase: - Ensure all existing tests pass with the new import structure - Update pyproject.toml to depend on hub-core -Implementation start (2026-06-07): added `/home/worsch/hub-core` as an editable -`hub-core` dependency of `/home/worsch/state-hub`, synced `uv.lock`, and -converted State Hub's message and DoI response schema modules into -compatibility re-exports from `hub_core.schemas`. Added -`tests/test_hub_core_imports.py` to pin the import seam. Verification: -`python -m pytest` in State Hub passed with 349 tests. - -Implementation slice 2 (2026-06-07): aligned hub-core's TPSC schemas and GDPR -report payload with the existing State Hub contract, then converted State Hub's -`api.schemas.tpsc` module into a compatibility re-export from -`hub_core.schemas.tpsc`. Verification: hub-core `pytest` passed with 15 tests; -State Hub import/core-router/recently-on-scope focused tests passed. A full -State Hub run reached 349 passed / 1 failed; the lone recently-on-scope failure -passed when rerun alone and with the new import seam tests. - -Implementation slice 3 (2026-06-07): converted State Hub's base domain schemas -(`DomainCreate`, `DomainRead`, `DomainRename`, `DomainUpdate`) into imports -from `hub_core.schemas.domain` while keeping dev-hub-specific `DomainDetail` -and `DomainSummary` local. Verification: State Hub import/core-router focused -tests passed with 58 tests. - -Implementation slice 4 (2026-06-07): added host-model injection to -`hub_core.routers.messages.create_messages_router`, then replaced State Hub's -local `api.routers.messages` implementation with the hub-core factory while -injecting State Hub's own `AgentMessage` model. This is the first router import -that avoids importing hub-core SQLAlchemy metadata into State Hub. Verification: -hub-core `pytest` passed with 16 tests; State Hub import/core-router/MCP smoke -focused tests passed with 70 tests. - -Implementation slice 5 (2026-06-07): extended -`hub_core.routers.policy.create_policy_router` with an optional update callback, -then replaced State Hub's local `api.routers.policy` implementation with the -hub-core factory while keeping State Hub's policy path validation/read/write -callbacks local. Verification: hub-core `pytest` passed with 17 tests; State -Hub policy/import/MCP/core-router focused tests passed when split to avoid live -API test-DB contention. - -Implementation slice 6 (2026-06-07): added host-model injection to -`hub_core.routers.tpsc.create_tpsc_router`, then replaced State Hub's local -`api.routers.tpsc` implementation with the hub-core factory while injecting -State Hub's own repo and TPSC models. Verification: hub-core `pytest` passed -with 18 tests; State Hub TPSC/import/MCP focused tests passed with 17 tests and -core-router tests passed with 54 tests. - -Implementation slice 7 (2026-06-07): added host-model and schema injection to -`hub_core.routers.progress.create_progress_router`, then replaced State Hub's -local `api.routers.progress` implementation with the hub-core factory while -injecting State Hub's own progress model and schemas. The shared router now -preserves State Hub's topic/workstream/task filters and exposes the hub-core -risk/alert progress views. Verification: hub-core pytest passed with 19 tests; -State Hub MCP/import/core-router focused tests passed with 71 tests. - -Implementation slice 8 (2026-06-07): added host-model/schema injection, -optional update-route registration, and detail/archive callbacks to -`hub_core.routers.domains.create_domains_router`, then replaced State Hub's -local `api.routers.domains` implementation with the hub-core factory. State Hub -keeps its own domain detail counts and active-topic archive guard in local -callbacks. Verification: hub-core pytest passed with 20 tests; State Hub -core/import/MCP/recently-on-scope/capability focused tests passed with 102 -tests. - -Implementation slice 9 (2026-06-07): converted State Hub's matching generic -schema classes to hub-core imports: capability catalog create/patch/read, -capability request status/dispute, and repo path registration. State Hub's repo -create/read schemas now extend hub-core contracts while keeping dev-hub-only -fields local, and repo creation now persists `host_paths` from the shared -create contract. State Hub keeps dev-hub-specific capability request, reroute, -repo dispatch, onboarding, and scope-health schemas local. Verification: State -Hub import/capability/core/DoI scope/MCP focused tests passed with 100 tests. - -Implementation slice 10 (2026-06-07): added -`hub_core.routers.capabilities.create_capability_catalog_router` with host -domain/repo/catalog model injection, then replaced State Hub's local capability -catalog CRUD implementation with that hub-core factory. State Hub keeps the -capability request workflow routes local because they still enforce State Hub -flow transitions, notifications, rerouting, and task-unblock side effects. -Verification: hub-core pytest passed with 21 tests; State Hub -capability/import/MCP/core focused tests passed with 95 tests. - -Implementation slice 11 (2026-06-07): added -`hub_core.routers.capabilities.create_capability_request_read_router` with host -domain/request model and response-schema injection, then replaced State Hub's -local capability request list/detail routes with that hub-core factory. State -Hub keeps request creation, acceptance, status transitions, metadata patching, -dispute, and reroute routes local because they still enforce State Hub flow -transitions, notifications, and task-unblock side effects. Verification: -hub-core compile checks passed, hub-core pytest passed with 22 tests, the -post-format import slice passed with 14 tests, State Hub compile checks passed, -and State Hub capability/import/MCP/core focused tests passed with 95 tests. +Extracted child workplan (2026-06-07): T08 became complex enough to deserve its +own progress surface. Ongoing implementation and slice history now live in +`CUST-WP-0048 - Hub-Core State Hub Import Refactor`. This umbrella task remains +`in_progress` until the child workplan finishes and hands control back to the +Phase 2 dev-hub rename sequence. ### T09 — Rename MCP server state-hub to dev-hub diff --git a/workplans/CUST-WP-0048-hub-core-state-hub-import-refactor.md b/workplans/CUST-WP-0048-hub-core-state-hub-import-refactor.md new file mode 100644 index 0000000..3af52e3 --- /dev/null +++ b/workplans/CUST-WP-0048-hub-core-state-hub-import-refactor.md @@ -0,0 +1,187 @@ +--- +id: CUST-WP-0048 +type: workplan +title: "Hub-Core State Hub Import Refactor" +domain: custodian +repo: the-custodian +status: active +owner: custodian +topic_slug: custodian +created: "2026-06-07" +updated: "2026-06-07" +--- + +# Hub-Core State Hub Import Refactor + +## Goal + +Complete the CUST-WP-0025 T08 migration as its own tracked workplan: refactor +the standalone `/home/worsch/state-hub` codebase to import reusable generic +models, schemas, routers, and MCP surfaces from `/home/worsch/hub-core` while +keeping dev-hub-specific coordination behavior local. + +This is a child workplan of `CUST-WP-0025` Phase 2. The umbrella task +`CUST-WP-0025-T08` remains in progress until this workplan reaches `finished`. + +## Scope Boundary + +`hub-core` should own reusable hub primitives and factory-based router/MCP +surfaces. `state-hub` should keep development coordination concepts such as +topics, workstreams, tasks, decisions, dependencies, consistency checks, SBOM, +dashboard loaders, and workflow side effects. + +The migration should proceed by narrow seams: + +- Prefer schema re-exports before router replacement. +- Prefer router factories with host-model and host-schema injection. +- Keep State Hub callbacks for dev-hub behavior such as counts, validation, + notifications, flow transitions, and task-unblock side effects. +- Keep test coverage focused per slice, with full regression at the end. + +## Completed History + +- 2026-06-07: Added `/home/worsch/hub-core` as an editable dependency of + `/home/worsch/state-hub`, synced `uv.lock`, and converted message and DoI + response schemas into compatibility re-exports from `hub_core.schemas`. + Verification: full State Hub pytest passed with 349 tests. +- 2026-06-07: Aligned hub-core TPSC schemas and GDPR report payload with State + Hub, then re-exported `api.schemas.tpsc` from `hub_core.schemas.tpsc`. + Verification: hub-core pytest passed with 15 tests; focused State Hub tests + passed, and the lone full-run flake passed on rerun. +- 2026-06-07: Converted base domain schemas (`DomainCreate`, `DomainRead`, + `DomainRename`, `DomainUpdate`) to imports from `hub_core.schemas.domain`. + Verification: State Hub import/core-router focused tests passed with 58 tests. +- 2026-06-07: Added host-model injection to the hub-core messages router and + replaced State Hub's local messages router with the hub-core factory. + Verification: hub-core pytest passed with 16 tests; focused State Hub tests + passed with 70 tests. +- 2026-06-07: Extended the hub-core policy router with an optional update + callback and replaced State Hub's policy router with the hub-core factory + plus local path validation/read/write callbacks. Verification: hub-core + pytest passed with 17 tests; State Hub focused tests passed when split to + avoid live API test-DB contention. +- 2026-06-07: Added host-model injection to the hub-core TPSC router and + replaced State Hub's TPSC router with the hub-core factory. Verification: + hub-core pytest passed with 18 tests; focused State Hub tests passed with 17 + and 54 tests. +- 2026-06-07: Added host-model/schema injection to the hub-core progress router + and replaced State Hub's progress router while preserving topic/workstream/task + filters and shared risk/alert views. Verification: hub-core pytest passed with + 19 tests; State Hub focused tests passed with 71 tests. +- 2026-06-07: Added host-model/schema injection, optional update-route + registration, and detail/archive callbacks to the hub-core domains router, + then replaced State Hub's domains router. Verification: hub-core pytest passed + with 20 tests; State Hub focused tests passed with 102 tests. +- 2026-06-07: Converted generic capability catalog schemas, capability request + status/dispute schemas, and repo path registration schema to hub-core imports. + State Hub repo create/read schemas now extend hub-core contracts. Verification: + State Hub focused tests passed with 100 tests. +- 2026-06-07: Added `create_capability_catalog_router` with host model + injection and replaced State Hub's capability catalog CRUD routes. Verification: + hub-core pytest passed with 21 tests; State Hub focused tests passed with 95 + tests. +- 2026-06-07: Added `create_capability_request_read_router` with host + domain/request model and response-schema injection, then replaced State Hub's + capability request list/detail routes. Verification: hub-core compile checks + passed, hub-core pytest passed with 22 tests, the post-format import slice + passed with 14 tests, State Hub compile checks passed, and State Hub focused + tests passed with 95 tests. + +## T01 - Establish Editable Dependency And Schema Re-Exports + +```task +id: CUST-WP-0048-T01 +status: done +priority: high +``` + +Add hub-core as an editable State Hub dependency and convert the low-risk +generic schema modules to compatibility imports or extensions from hub-core. +This includes message, DoI, TPSC, base domain, capability catalog/status/dispute, +and repo path registration schemas. + +## T02 - Replace Low-Risk Generic Routers + +```task +id: CUST-WP-0048-T02 +status: done +priority: high +``` + +Replace State Hub's local generic router implementations with hub-core router +factories where host-model injection or callbacks are already sufficient: +messages, policy, TPSC, progress, and domains. + +## T03 - Replace Capability Catalog And Request Read Routes + +```task +id: CUST-WP-0048-T03 +status: done +priority: high +``` + +Move capability catalog CRUD and read-only capability request list/detail routes +behind hub-core factories. Keep request workflow writes local until their State +Hub flow-transition, notification, reroute, and task-unblock behavior has an +explicit adapter seam. + +## T04 - Resolve Repos Router Boundary + +```task +id: CUST-WP-0048-T04 +status: todo +priority: high +``` + +Review the State Hub repos router and split reusable repo registry behavior +from dev-hub-specific onboarding, dispatch, DoI, scope-health, SBOM, and state +sync behavior. Either replace the reusable subset with a hub-core factory or +document the adapter seam needed before replacement. + +## T05 - Resolve Capability Request Write Workflow Boundary + +```task +id: CUST-WP-0048-T05 +status: todo +priority: high +``` + +Review capability request creation, acceptance, status changes, patching, +dispute, and reroute routes. Decide which write paths can move to hub-core via +callbacks and which require a dev-hub extension table or context mapping for +workstream/task references. + +## T06 - Split Generic MCP Tool Registration + +```task +id: CUST-WP-0048-T06 +status: todo +priority: medium +``` + +Replace generic State Hub MCP tool registrations with `HubCoreMCPServer` +composition or inheritance while keeping dev-hub-only tools local. + +## T07 - Run Regression And Coupling Report + +```task +id: CUST-WP-0048-T07 +status: todo +priority: high +``` + +Run full hub-core and State Hub regression suites after the remaining seams are +resolved. Update `docs/hub-core-extraction-boundary.md` with any remaining +couplings, deferred adapter seams, and the next safe migration step. + +## T08 - Close Child Workplan And Return To Umbrella + +```task +id: CUST-WP-0048-T08 +status: todo +priority: medium +``` + +When T04-T07 are complete or explicitly deferred, mark this workplan finished +and update `CUST-WP-0025-T08` so the umbrella can proceed to the dev-hub rename +phase.