Files
taskgraph_ts/docs/architecture/decisions/007-subgraph-internal-only.md
glm-5.1 bde1cc4e70 Decompose monolithic architecture.md into modular docs/architecture/ documents
The 751-line architecture.md violated the SDD process modular documentation
target (~500 lines). It also had duplicate TaskGraph class definitions (one
monolith, one decomposed) that directly contradicted each other, and embedded
consumer-specific tool dispatch mappings that belong in downstream projects.

Changes:
- Split into 8 focused documents + 7 ADR records + redirect page
- Removed the monolithic TaskGraph class (kept only decomposed version)
- Moved CLI→plugin dispatch mapping out (belongs in plugin architecture)
- Extracted implementation code (frontmatter splitter, findCycles, DAG
  propagation) into WHAT/WHY descriptions per architect role spec
- Added proper ADR format for all resolved design decisions
- Fixed review issues: C_fail mapping, DuplicateNodeError/DuplicateEdgeError
  types, ValidationError/GraphValidationError definitions, mutation error
  handling contract, enum naming convention, validation timing clarification
2026-04-26 06:38:52 +00:00

1.3 KiB

ADR-007: Subgraph returns internal-only edges

Status: Accepted

Context

When filtering a graph to a subset of nodes, what happens to edges where only one endpoint is in the filtered set? Options: include cross-boundary edges (external dependencies visible), or strict internal-only (only edges where both endpoints are in the filtered set).

Decision

Strict internal-only. subgraph(filter) returns a new TaskGraph with matching nodes and only edges where both endpoints are in the filtered set. This matches graphology-operators subgraph behavior and produces valid subgraphs for all algorithms (topo sort, betweenness, etc.).

Consequences

Positive

  • Result is always a valid (potentially disconnected) subgraph — all algorithms work correctly
  • Matches graphology's built-in subgraph behavior
  • No surprise external references in analysis results

Negative

  • External dependency information is lost — you can't see "what does this subgraph depend on outside itself" from the subgraph alone

Mitigation

External dependency information is available on the original graph via dependencies()/dependents(). A separate externalDependencies(filter) utility can be added later if consumers need "show me what this subgraph depends on outside itself."