Files
taskgraph_ts/tasks/implementation/graph/subgraph-and-validation.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

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
graph/taskgraph-class
graph/queries
schema/input-schemas
schema/graph-schemas
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.subgraph to extract matching nodes
    • Returns only edges where both endpoints are in the filtered set (internal-only) per ADR-007
    • Returns a new TaskGraph instance (not mutating the original)
  • validateSchema(): ValidationError[]:
    • Uses TypeBox Value.Check() and Value.Errors() on each node's attributes
    • Returns structured ValidationError[] with type: "schema", taskId, field, message, value
  • validateGraph(): GraphValidationError[]:
    • Runs findCycles() and checks for dangling dependency references
    • Returns structured GraphValidationError[] with type: "graph", category, message, optional details
    • Cycle category: "cycle" with cycle paths in details
    • Dangling reference category: "dangling-reference" with the referencing task ID
  • validate(): ValidationError[] — runs both validateSchema() and validateGraph(), returns combined array
  • ValidationError and GraphValidationError interfaces 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