Repository navigation
Conversation
…sk (trailhq#425) Test files came back from `grep` and `callers` unlabelled, next to production code, with no way to leave them out — in the reporter's production repro about 80% of a grep answer (~4,300 tokens) was test lines. trailhq#37's detection existed (`isTestPath` in ask) but never reached these two commands. - isTestPath moves to the search layer (grep.ts) with the pattern as a named constant (TEST_PATH_RE), so grep, callers and ask share one predicate; ask re-exports it, behavior unchanged. - grep/callers: test hits carry a [test] label and list after production ones (stable partition — in-degree/BFS order inside each half untouched). - both commands gain --no-tests to drop test files entirely; excluded files are not counted into grep's "searched N indexed files" (they were not searched). - Threaded through the workspace federation too, so a workspace grep or callers behaves the same as a single-repo one. The JSON shapes are unchanged; the label and ordering are formatter behavior, and the MCP tools render through the same formatters, so graft_find_all picks the label up for free.
🌱 graft blast radius4 areas changed → 7 areas can be affected. 15 dependent symbols, depth 2. flowchart TB
A0(("MCP Tool Invocation<br/>6 symbols"))
A1(("Cloud Onboarding<br/>3 symbols"))
A2(("Engine Initialization<br/>2 symbols"))
A3(("Notes Query<br/>1 symbol"))
A4(("First Run Setup<br/>1 symbol"))
AX(("2 smaller areas<br/>2 symbols"))
classDef reached fill:#D9EDF3,stroke:#3AA7C9,stroke-width:1.5px,color:#0E313C;
class A0,A1,A2,A3,A4 reached;
classDef tail fill:#EEF2F3,stroke:#9AA4A9,stroke-width:1px,color:#3A4247;
class AX tail;
Who knows this code — 4 people across 11 areas
Ownership is git history over each area's own files, weighted towards recent work (120-day half-life). Merge commits and bots are dropped, and you are dropped from your own PR. A name with no All 15 dependent symbols, grouped by areaMCP Tool Invocation — 6 symbols in 2 files
Cloud Onboarding — 3 symbols in 3 files
Engine Initialization — 2 symbols in 2 files
Notes Query — 1 symbol in 1 file
First Run Setup — 1 symbol in 1 file
Graph Root — 1 symbol in 1 file
Claude Sync Run — 1 symbol in 1 file
Test signal per changed area — 2 ✓ · 2 –Reached = a node under a test path has a resolved edge into the changed symbol. It undercounts anything called indirectly — through a CLI, a spawned process or a dynamic import — so read a low ratio as “look here”, never as a coverage gate.
26 test suites also reference this code27 symbols, kept out of the diagram and the table so they cannot crowd out the areas a reviewer has to look at.
Open the interactive graph → — click an area to see its dependent symbols at file:line. |
Fixes #425.
What was missing
#37 landed test handling in
ask(a rank penalty) andblast(separatetestModules) —grepandcallersgot neither. Test hits came back unlabelled next to production code, and--incan narrow but cannot exclude, which does not help the colocated layout (service.ts+service.test.ts). In the reporter's production repro ~80% of one grep answer (~4,300 tokens) was test lines.Fix
isTestPathmoves to the search layer (src/search/grep.ts) with the pattern extracted to a named constant (TEST_PATH_RE) and the discriminating choices documented (why.test.needs the dots —testing.tsstays production).askimports it from there and re-exports, so its behavior and public surface are unchanged; grep, callers and ask now share one predicate.[test]and lists them after production groups — a stable partition, so the in-degree ordering inside each half is untouched.callerslabels a test-file edgecalls ← service.test.ts (…) [test]and orders those after production callers.--no-testson both commands drops test files entirely. Excluded files are not counted into grep's "searched N indexed files" — they were not searched.federateGrep/federateCallers), so workspace grep/callers behave the same as single-repo ones.JSON shapes are unchanged; the label and ordering live in the formatters, which the MCP tools (
graft_find_all,graft_trace_calls) already share — they pick the behavior up for free.Tests (RED→GREEN, adversarial)
grepGraphdefault keeps both files;includeTests: falseleaves only production, andfilesSearcheddrops by the excluded file (it was not searched);[test], does NOT label the production file (including theservice.tssuffix-inside-service.test.tstrap), and lists the test group last even when it sorted first;isTestPathcovers the documented shapes (*.test.ts,*.spec.js,__tests__/,tests/,_test.go,conftest.py,test_*.py) and refuses lookalikes (testing.ts,contest.py,latest.ts);hitLinelabels a test-file edge, leaves production unlabelled, and leaves unresolved-import rows (no path to judge) unlabelled.