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.
2.4 KiB
2.4 KiB
id, name, status, depends_on, scope, risk, impact, level
| id | name | status | depends_on | scope | risk | impact | level | ||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| graph/subgraph-and-validation | Implement TaskGraph subgraph and validation methods | pending |
|
narrow | low | component | implementation |
Description
Implement the subgraph() method and the three validation methods (validateSchema, validateGraph, validate) on TaskGraph.
Per ADR-007, subgraph returns only edges where both endpoints are in the filtered set.
Per errors-validation.md, validation methods collect issues and return arrays — never throw.
Acceptance Criteria
subgraph(filter: (taskId: string, attrs: TaskGraphNodeAttributes) => boolean): TaskGraph:- Uses
graphology-operators.subgraphto extract matching nodes - Returns only edges where both endpoints are in the filtered set (internal-only) per ADR-007
- Returns a new
TaskGraphinstance (not mutating the original)
- Uses
validateSchema(): ValidationError[]:- Uses TypeBox
Value.Check()andValue.Errors()on each node's attributes - Returns structured
ValidationError[]withtype: "schema",taskId,field,message,value
- Uses TypeBox
validateGraph(): GraphValidationError[]:- Runs
findCycles()and checks for dangling dependency references - Returns structured
GraphValidationError[]withtype: "graph",category,message, optionaldetails - Cycle category:
"cycle"with cycle paths indetails - Dangling reference category:
"dangling-reference"with the referencing task ID
- Runs
validate(): ValidationError[]— runs bothvalidateSchema()andvalidateGraph(), returns combined arrayValidationErrorandGraphValidationErrorinterfaces defined (may be in error module or co-located)- Unit tests: subgraph filtering, subgraph excludes external edges, validateSchema catches invalid enums, validateGraph catches cycles and dangling refs
References
- docs/architecture/api-surface.md — validation API, subgraph
- docs/architecture/errors-validation.md — validation levels, return types
- docs/architecture/decisions/007-subgraph-internal-only.md — subgraph semantics
Notes
To be filled by implementation agent
Summary
To be filled on completion