--- id: drift/reference-modules name: Create reference graph type Modules (call-graph, secret-graph) status: pending depends_on: - drift/metagraph-module - drift/bridge-functions scope: moderate risk: medium impact: component level: implementation --- ## Description Create concrete graph type Modules that compose from `Metagraph` via `Import()` and `Type.Composite()`. These serve as reference implementations and validation that the Module pattern works end-to-end with the bridge functions. Per metagraph-module.md Phase 3, start with: - `call-graph.ts` — mirrors `@alkdev/flowgraph`'s `CallNodeAttrs`/`CallEdgeAttrs` schemas - `secret-graph.ts` — the encrypted data graph type from encrypted-data.md Each Module uses `Metagraph.Import("BaseNode")` and `Metagraph.Import("BaseEdge")` for base composition (ADR-010: same-package Modules use `Import()` directly). ## Acceptance Criteria - [ ] `src/graphs/modules/call-graph.ts` exports `CallGraph` as `Type.Module({...})` with entries: `Config`, `CallNode`, `SubcallNode`, `TriggeredEdge`, `DependsOnEdge`, `TriggeredEdgeConstraints`, `DependsOnEdgeConstraints`, `CallStatus`, `Identity` - [ ] `CallGraph.Config` uses `Type.Literal` values (frozen config: directed, not multi, no self-loops) - [ ] `CallGraph.CallNode` composes `Metagraph.Import("BaseNode")` with call-specific attributes via `Type.Composite` - [ ] `CallGraph.TriggeredEdge` composes `Metagraph.Import("BaseEdge")` with `type: Type.Literal("triggered")` - [ ] Edge constraint entries follow `*EdgeConstraints` naming convention with `edgeType`, `allowedSourceTypes`, `allowedTargetTypes` - [ ] `src/graphs/modules/secret-graph.ts` exports `SecretGraph` with: `Config`, `SecretNode`, `ClientNode`, `HasSecretEdge`, `HasSecretEdgeConstraints` - [ ] `moduleToDbSchema(CallGraph)` produces valid `DbSchema` rows compatible with the sqlite metagraph tables - [ ] `moduleToDbSchema(SecretGraph)` produces valid `DbSchema` rows - [ ] `validateNode(CallGraph, "CallNode", validData)` returns `true` - [ ] `src/graphs/modules/index.ts` barrel re-exports all Module definitions - [ ] `deno check mod.ts` passes ## References - docs/architecture/metagraph-module.md — "Concrete Graph Type Modules" and "Edge Type Constraints" sections - docs/architecture/encrypted-data.md — SecretGraph Module definition - docs/architecture/decisions/010-metagraph-import-for-same-package.md ## Notes > To be filled by implementation agent ## Summary > To be filled on completion