Add Fabric graph read model ingest

This commit is contained in:
2026-05-23 21:17:58 +02:00
parent 52d456a7a1
commit ec5742543c
10 changed files with 1439 additions and 5 deletions

View File

@@ -4,7 +4,7 @@ type: workplan
title: "Railiance Fabric Graph Read Model Ingest"
domain: custodian
repo: state-hub
status: ready
status: finished
owner: codex
topic_slug: custodian
created: "2026-05-23"
@@ -46,7 +46,7 @@ Current verified Fabric export baseline from 2026-05-23:
```task
id: STATE-WP-0050-T01
status: todo
status: done
priority: high
state_hub_task_id: "d80b74bd-57ee-4e7a-81d7-406c02da52bc"
```
@@ -65,11 +65,23 @@ Requirements:
- Make repeated ingest of the same export idempotent.
- Include migrations and repository/service helpers.
Result:
- Added `fabric_graph_imports`, `fabric_graph_nodes`, and
`fabric_graph_edges` read-model tables with import metadata, canonical
content hash identity, source metadata, validation state, raw payload
retention, and materialized node/edge query columns.
- Preserved canon metadata fields on materialized nodes and edges, including
canonical type/category/anchor, mapping fit, evidence state, and
display-only flags.
- Added service helpers that validate, hash, materialize, and idempotently
refresh latest markers for repeated graph imports.
## T02 - Ingest API and pull job
```task
id: STATE-WP-0050-T02
status: todo
status: done
priority: high
state_hub_task_id: "3a94655d-703a-4aec-b724-46cafce14fdb"
```
@@ -88,11 +100,21 @@ Requirements:
- Keep the integration explicit to `railiance-fabric` at first, while leaving
source metadata general enough for future graph producers.
Result:
- Added `POST /fabric/graph-exports` for direct `FabricGraphExport` payloads
and the documented wrapper shape.
- Added `POST /fabric/graph-exports/pull` with a default pull source of
`http://127.0.0.1:8765/exports/state-hub` and source repo
`railiance-fabric`.
- Invalid exports record failed import metadata and a `fabric_graph_import`
progress row without writing graph nodes or edges.
## T03 - Query surfaces and dashboard readiness
```task
id: STATE-WP-0050-T03
status: todo
status: done
priority: medium
state_hub_task_id: "6b4ed6fe-bc84-43c8-a4b0-55ee93918bac"
```
@@ -109,11 +131,22 @@ Requirements:
- Do not allow graph read-model queries to mutate State Hub workstreams,
tasks, messages, decisions, or progress rows.
Result:
- Added read-only query endpoints for import listing/latest status, graph
summary counts, graph nodes, and graph edges.
- Node queries filter by source repo, domain, repo, canonical category,
evidence state, mapping fit, and kind.
- Edge queries filter by source repo, canonical relationship, edge type,
evidence state, mapping fit, display-only state, and endpoints.
- Summary output includes dashboard-ready counts plus representative node and
edge examples.
## T04 - Verification with RAIL-FAB-WP-0016 export
```task
id: STATE-WP-0050-T04
status: todo
status: done
priority: high
state_hub_task_id: "fdf5275a-f04d-43a3-b18a-12cfe0dcc2f7"
```
@@ -131,6 +164,20 @@ Requirements:
- Document the operator command for refreshing the State Hub graph read model
after a Fabric reset/reingest.
Result:
- Verified against the live Railiance Fabric registry export on
`http://127.0.0.1:8765/exports/state-hub` via a temporary State Hub server:
latest import `130ffb56-7e30-4963-a3b1-b7527f685b45` stored 49 nodes and
58 edges.
- Verified idempotent live reingest returned the same import id.
- Confirmed relationship queries returned `exposes` 31, `depends_on` 15, and
`implements` 12.
- Added regression tests covering validation failure, idempotent reingest,
latest import selection, and read-only query behavior.
- Documented the operator refresh command in
`docs/fabric-graph-read-model.md`.
## Acceptance
- State Hub has a documented endpoint or job for importing the