pa-01 — Analysis
A design-review treatment of the service-graph analyzer and the decomposition decisions it informs.
What the analyzer must get right
- Sound cycle detection. Report exactly the strongly-connected components of size > 1 (plus self-loops); a clean DAG reports nothing.
- Correct blast radius. Transitive dependents (reverse edges), not dependencies; exclude the service itself; deterministic (sorted).
- Honest coupling metrics. Fan-in/out are direct-edge counts; blast-radius is the transitive version of fan-in.
- Enforceable layering rules. A rule is a (from-layer, to-layer) prohibition checked over every edge.
Design decisions
- Edge direction = "depends on." A→B means A needs B, so failure propagates against the edges (B's failure breaks A). Blast radius therefore walks edges in reverse. Getting this direction right is the whole correctness of the tool.
- Tarjan over naive DFS-coloring. Tarjan returns the actual SCCs (the cyclic groups), which is what you report to engineers — not just a boolean "has cycle." Deterministic via sorted iteration.
- Layers as free-form tags. Rather than hard-coding a layer model, a service carries a tag and rules are data, so the same engine enforces "domain↛infra," "no upward deps," or team-ownership rules. This is the hook for pa-10 fitness functions.
Tradeoffs worth flagging
- The graph is only as true as its source. Edges from a wiki are fiction; derive them from import graphs, call traces, or a service registry. Garbage in, confident-but-wrong out.
- Cycles aren't always fixable by splitting. Sometimes two services genuinely co-evolve and should be merged back into one. The tool flags the smell; the architect decides split vs merge vs async-break.
- Low coupling vs too many services. Driving fan-out to zero by splitting more creates nano-services (more hops, more contracts). The metric guides; it doesn't dictate.
- Static structure misses temporal coupling. Two services with no edge can still be coupled if they must change together for a feature. Pair the graph with change-coupling analysis (files/services that commit together).
What production adds beyond this lab
- Auto-derived graphs from tracing/mesh + git history (change coupling).
- Weighted edges (call volume, latency) for traffic-weighted blast radius.
- Contract-compatibility gates (pa-02) wired into the same CI as the cycle/layering fitness functions (pa-10).
- Ownership/team metadata (Conway's-Law analysis: do boundaries match teams?).