You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: read TESTED_BY edges in the parser's direction everywhere
The parser emits TESTED_BY as production -> test (parser.py, all five
language blocks): source is the tested symbol, target is the test.
Half the consumers read the edge the other way around (test -> production),
so they silently returned nothing on real graphs:
- tools/query.py tests_for: queried incoming edges of the production
node and returned edge sources. Real graphs never have TESTED_BY
edges targeting production code, so the edge-based path always came
up empty and only the test_<name> naming fallback ever fired.
- graph.py get_transitive_tests (direct, bare-name fallback, and
transitive blocks): same inversion, so direct and transitive test
coverage was always empty. This also silently zeroed the test
coverage factor in compute_risk_score, which calls it.
- graph.py load_flow_adjacency: has_tested_by collected edge targets
(the tests) instead of sources (the tested code), so flow
criticality's tested_count was always 0.
- changes.py test-gap detection: checked incoming edges, so every
changed function was flagged as a test gap regardless of coverage.
- enrich.py: the Tests: context line never listed anything.
- refactor.py dead-code detection: has_test_refs looked for incoming
TESTED_BY edges and bare-name matches on the target column; both are
impossible under the emitted direction. Test references are the
node's outgoing TESTED_BY edges (with a bare-source fallback, since
the edge source inherits an unresolved CALLS target name).
Consumers that already read the emitted direction (risk_index in
tools/build.py, knowledge gaps and suggested questions in analysis.py,
review context in tools/review.py) are unchanged.
Test seeds in test_changes, test_enrich, test_graph and
test_integration_v2 seeded the inverted direction to match the
inverted consumers; they now seed what the parser emits. New
regression tests pin the direction at both ends: the parser must emit
production -> test (test_parser), and tests_for must find a test whose
name defeats the naming-convention fallback, via the edge alone
(test_tools).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
0 commit comments