Files
flowgraph/tasks/graph-construction-json.md
glm-5.1 466b121f77 decompose architecture into 38 atomic tasks across 12 parallel generations
Decompose the reviewed architecture specs into taskgraph-managed tasks:
- 2 setup tasks (project init, test infrastructure)
- 4 schema tasks (enums, node attrs, edge attrs, graph schemas)
- 1 error hierarchy task
- 6 graph tasks (FlowGraph class, 3 construction paths, queries, validation)
- 5 analysis tasks (type-compat, build-type-edges, ordering, template-validation, defaults)
- 5 component tasks (Operation, Sequential, Parallel, Conditional, Map)
- 2 host config tasks (GraphologyHostConfig, ReactiveHostConfig)
- 4 reactive tasks (WorkflowRoot, node-status, max-concurrency, retry-semantics)
- 3 review tasks (foundation, reactive-and-hosts, complete-library)
- 5 meta cluster tasks (schema, graph, component, reactive, analysis layers)
- 1 API exports task

Validated with taskgraph: zero cycles, 38 tasks, 12 parallel generations.
Critical path: 12 tasks through reactive execution layer.
2026-05-21 20:24:44 +00:00

40 lines
1.6 KiB
Markdown

---
id: graph/construction-json
name: Implement fromJSON and export/toJSON serialization for FlowGraph
status: pending
depends_on:
- graph/flowgraph-class
- schema/graph-schemas
scope: narrow
risk: medium
impact: component
level: implementation
---
## Description
Implement the serialization boundary: `FlowGraph.fromJSON()` for deserialization and `export()`/`toJSON()`/`toString()` for serialization. The round-trip `fromSpecs() → export() → fromJSON()` must be lossless.
## Acceptance Criteria
- [ ] `FlowGraph.fromJSON(data: FlowGraphSerialized): FlowGraph` — validates input against schema using `Value.Check()`, throws `InvalidInputError` (with `errors` array) on validation failure
- [ ] `fromJSON()` validates DAG invariants after deserialization — runs cycle detection, throws `CycleError` if cycles found (per ADR-002, even externally-provided data cannot produce cyclic graphs)
- [ ] `export(): FlowGraphSerialized` — returns graphology native JSON format
- [ ] `toJSON(): FlowGraphSerialized` — alias for export()
- [ ] `toString(): string``JSON.stringify(export())`
- [ ] Round-trip guarantee: `fromSpecs() → export() → fromJSON()` is lossless
- [ ] Round-trip guarantee: `fromCallEvents() → export() → fromJSON()` is lossless
- [ ] Unit tests: valid round-trips, invalid input throws InvalidInputError, cyclic input throws CycleError, empty graph round-trip
## References
- docs/architecture/flowgraph-api.md — fromJSON, export, toJSON, toString signatures
- docs/architecture/schema.md — SerializedGraph factory, FlowGraphSerialized variants
## Notes
> To be filled by implementation agent
## Summary
> To be filled on completion