Implements graph attribute schemas and the SerializedGraph generic factory parameterized with <N, E, G> following the graphology JSON format. - TaskGraphNodeAttributes: name + optional categorical enums (scope, risk, impact, level, priority, status) — analysis-relevant metadata only - TaskGraphNodeAttributesUpdate: Type.Partial(TaskGraphNodeAttributes) - TaskGraphEdgeAttributes: optional qualityRetention number - SerializedGraph<N, E, G>: generic factory for graphology JSON format - TaskGraphSerialized: concrete instantiation with empty graph attributes - No schema version field per spec 35 new tests covering validation, rejection, and compile-time type safety.
2.8 KiB
id, name, status, depends_on, scope, risk, impact, level
| id | name | status | depends_on | scope | risk | impact | level | |
|---|---|---|---|---|---|---|---|---|
| schema/graph-schemas | Define TaskGraphNodeAttributes, TaskGraphEdgeAttributes, and SerializedGraph | completed |
|
narrow | low | component | 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.tsexports:TaskGraphNodeAttributesschema:name: Type.String(), optional categorical enums (scope, risk, impact, level, priority, status) — not nullable on the graph (absent = not stored)type TaskGraphNodeAttributesderivedTaskGraphNodeAttributesUpdate = Type.Partial(TaskGraphNodeAttributes)and type aliasTaskGraphEdgeAttributesschema:qualityRetention: Type.Optional(Type.Number())type TaskGraphEdgeAttributesderivedSerializedGraphgeneric factory parameterized with<N extends TSchema, E extends TSchema, G extends TSchema>TaskGraphSerialized = SerializedGraph(TaskGraphNodeAttributes, TaskGraphEdgeAttributes, Type.Object({}))and type alias
SerializedGraphgeneric 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
TaskGraphSerializedper 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
Follows the architecture spec in docs/architecture/schemas.md and the generic schema factory pattern from docs/research/typebox-patterns.md section 6. The SerializedGraph generic factory uses the recommended graphology JSON format with Type.Literal("directed"), Type.Literal(false), and Type.Literal(false) for the options. No default on qualityRetention in the graph schema (unlike DependencyEdge which has Type.Number({ default: 0.9 })) — the graph schema keeps it simple with Type.Optional(Type.Number()).
Summary
Implemented graph attribute schemas and serialized graph generic factory per spec.
- Created:
src/schema/graph.ts(TaskGraphNodeAttributes, TaskGraphNodeAttributesUpdate, TaskGraphEdgeAttributes, SerializedGraph generic, TaskGraphSerialized, and all type aliases) - Modified:
test/schema.test.ts(35 new tests for graph schemas: TaskGraphNodeAttributes, TaskGraphNodeAttributesUpdate, TaskGraphEdgeAttributes, SerializedGraph, and compile-time type verification) - Tests: 121 total, all passing;
tsc --noEmitclean