feat(trace): PR-TRACE-1a core BFS engine#244
Conversation
Code Review: PR-TRACE-1a Core BFS EngineBugs / Correctness1.
parent_edge = node_to_incoming_edge.get(src_id)
parent_edge_id = parent_edge.to_id if parent_edge else NoneSince Should be something like the composite edge key from 2.
3.
Design Concerns4. Duplicated code from
5. Budget consumed by visited nodes
6. The parameter is in the signature and the test passes trivially ( Style / Minor7. Tautological hop check in
8. Hardcoded Line 117: 9. Branch targets The plan states: "All PRs target Strengths
VerdictRequest changes on items 1 and 5. The |
Must-fix issues:
- parent_edge_id now stores edge IDs (format: from_id:to_id:edge_type:hop)
instead of node IDs, enabling proper tree reconstruction
- Budget counting now only counts newly discovered nodes; moved increment
after visited check
Suggestions addressed:
- test_trace_direction_required: now validates pydantic ValidationError
- test_trace_inbound_callers_depth_2: removed vacuous >= 0 assertion
- test_trace_parent_edge_id_chain: now verifies parent_edge_id format
and validates it references an edge that reaches the current node
- Tautological hop check: simplified to assert 0 in hops and hops <= {0, 1}
- Removed hardcoded row_kind from _edge_attrs_for_row
- Documented include_unresolved as 1a no-op (like prune_roles)
Tests: 22 passed, 1 skipped
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
4fdadd5 to
0ceaee7
Compare
Must-fix issues:
- parent_edge_id now stores edge IDs (format: from_id:to_id:edge_type:hop)
instead of node IDs, enabling proper tree reconstruction
- Budget counting now only counts newly discovered nodes; moved increment
after visited check
Suggestions addressed:
- test_trace_direction_required: now validates pydantic ValidationError
- test_trace_inbound_callers_depth_2: removed vacuous >= 0 assertion
- test_trace_parent_edge_id_chain: now verifies parent_edge_id format
and validates it references an edge that reaches the current node
- Tautological hop check: simplified to assert 0 in hops and hops <= {0, 1}
- Removed hardcoded row_kind from _edge_attrs_for_row
- Documented include_unresolved as 1a no-op (like prune_roles)
Tests: 22 passed, 1 skipped
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
Summary
mcp_trace.pywith core BFS traversal engine for multi-hop graph navigationImplementation
parent_edge_idTest plan
Next steps
🤖 Generated with Claude Code