Files
taskgraph_ts/tasks/implementation/schema/graph-schemas.md
glm-5.1 131e3e929b Decompose architecture into 28 atomic implementation tasks
Break the @alkdev/taskgraph architecture specs into dependency-ordered
implementation tasks across 8 component directories: setup, schema,
error, graph, analysis, cost-benefit, frontmatter, api, and review.
Each task has clear acceptance criteria referencing specific architecture
docs. Three review tasks serve as quality gates at critical junction
points (schemas-and-errors, graph-complete, complete-library). The
dependency graph is validated acyclic with 9 topological levels enabling
significant parallelism across independent work streams.
2026-04-27 08:30:05 +00:00

42 lines
1.8 KiB
Markdown

---
id: schema/graph-schemas
name: Define TaskGraphNodeAttributes, TaskGraphEdgeAttributes, and SerializedGraph
status: pending
depends_on:
- schema/enums
scope: narrow
risk: low
impact: component
level: implementation
---
## Description
Define graph attribute schemas and the serialized graph generic in `src/schema/graph.ts`. `TaskGraphNodeAttributes` carries only analysis-relevant metadata (no tags, assignee, due, etc.). `SerializedGraph` is a generic factory parameterized with node and edge attribute types.
## Acceptance Criteria
- [ ] `src/schema/graph.ts` exports:
- `TaskGraphNodeAttributes` schema: `name: Type.String()`, optional categorical enums (scope, risk, impact, level, priority, status) — **not** nullable on the graph (absent = not stored)
- `type TaskGraphNodeAttributes` derived
- `TaskGraphNodeAttributesUpdate = Type.Partial(TaskGraphNodeAttributes)` and type alias
- `TaskGraphEdgeAttributes` schema: `qualityRetention: Type.Optional(Type.Number())`
- `type TaskGraphEdgeAttributes` derived
- `SerializedGraph` generic factory parameterized with `<N extends TSchema, E extends TSchema, G extends TSchema>`
- `TaskGraphSerialized = SerializedGraph(TaskGraphNodeAttributes, TaskGraphEdgeAttributes, Type.Object({}))` and type alias
- [ ] `SerializedGraph` generic follows graphology JSON format: `attributes`, `options: { type: "directed", multi: false, allowSelfLoops: false }`, `nodes: [{ key, attributes }]`, `edges: [{ key, source, target, attributes }]`
- [ ] No schema version field on `TaskGraphSerialized` per spec
- [ ] Re-exported from `src/schema/index.ts`
## References
- docs/architecture/schemas.md — graph attribute schemas, SerializedGraph
- docs/research/typebox-patterns.md — section 6 (generic schema factories)
## Notes
> To be filled by implementation agent
## Summary
> To be filled on completion