Skip to content

feat(dataflow): DF4 — trace() + CLI + MCP for end-to-end data flow#7

Merged
smochan merged 1 commit into
mainfrom
feat/df4-trace
Apr 27, 2026
Merged

feat(dataflow): DF4 — trace() + CLI + MCP for end-to-end data flow#7
smochan merged 1 commit into
mainfrom
feat/df4-trace

Conversation

@smochan

@smochan smochan commented Apr 27, 2026

Copy link
Copy Markdown
Owner

Walks call graph + cross-layer edges. Entry can be qualname or 'METHOD /path'. New CLI subcommand and MCP tool. 15 new tests, 458 total.

trace(graph, entry, max_depth=6) walks the call graph + cross-layer edges
and returns a DataFlow with ordered hops. Entry can be a function qualname
or "METHOD /path" (for fetch-shape entry — uses match_route() from DF3).

Hop construction:
- args/kwargs come from incoming CALLS edge metadata (DF0)
- layer = frontend (.tsx/.jsx or COMPONENT role) | db (REPO role) | backend
- role propagated from node metadata
- READS_FROM/WRITES_TO emitted as terminal db hops
- FETCH_CALL → match_route → cross-layer transition
- Cycle-safe: visited set drops back-edges
- Confidence = min across hops

New CLI: codegraph dataflow trace <entry> [--depth N] [--format markdown|json]
New MCP tool: dataflow_trace (15 tools registered now, was 14)

15 new tests covering simple chains, cycles, max depth, layer assignment,
role propagation, fetch→route transition, db hops, confidence, CLI smoke
(markdown + json), MCP tool. Suite: 458 passed (was 443; +15).

Stack: ruff + mypy --strict clean.
@smochan smochan merged commit 9bf46e7 into main Apr 27, 2026
smochan added a commit that referenced this pull request May 30, 2026
The `mcp:` field in `.codegraph.yml` was never read by any code path.
Sitting next to the active `register_mcp: true`, it confused users into
thinking it had to be flipped on manually.

Removed from `CodegraphConfig`. `model_config = {"extra": "ignore"}`
keeps forward-compat: existing 0.1.x configs that still carry the
field load without error.

v0.1.2 backlog item #7.
smochan added a commit that referenced this pull request May 30, 2026
The `mcp:` field in `.codegraph.yml` was never read by any code path.
Sitting next to the active `register_mcp: true`, it confused users into
thinking it had to be flipped on manually.

Removed from `CodegraphConfig`. `model_config = {"extra": "ignore"}`
keeps forward-compat: existing 0.1.x configs that still carry the
field load without error.

v0.1.2 backlog item #7.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant