Skip to content

fix(deep): honor --only-dir in the concept pass (#252) - #262

Merged
shhdwi merged 1 commit into
trailhq:mainfrom
Frankie-Xu:fix/252-deep-honors-only-dir
Aug 31, 2026
Merged

shhdwi merged 1 commit into
trailhq:mainfrom
Frankie-Xu:fix/252-deep-honors-only-dir

Conversation

@Frankie-Xu

Copy link
Copy Markdown
Contributor

Summary

  • graft build --deep now applies the same --only-dir whitelist as the wiring walk (filterByOnlyDirs), so the concept pass no longer summarizes or synthesizes files outside the prefixes.
  • checkContext reads the same file set (CLI/API, else the fingerprint, matching checkGraph / probeDrift) so graft check does not report excluded files as coverage.
  • Wiring behavior is unchanged; --only-dir prefix / repeatable semantics are the same as feat: add --only-dir whitelist to graft build #149.

Closes #252

Test plan

  • node --import tsx --test test/context-only-dir.test.ts — concept summaries, multi --only-dir, fingerprint fallback, checkContext, Graft.init, wiring still scoped
  • node --import tsx --test test/graph-only-dir.test.ts — existing whitelist + fingerprint probe still clean
  • npm test — full suite (1065 passing locally)

Made with Cursor

The wiring walk already filtered by whitelist; the --deep concept pass
and checkContext still walked the whole repo, so excluded files were
summarized and re-synthesized. Apply the same filter, with fingerprint
fallback so a later --deep without the flag stays scoped.

Co-authored-by: Cursor <cursoragent@cursor.com>
@trailhq-graft

trailhq-graft Bot commented Aug 29, 2026 •

Copy link
Copy Markdown

🌱 graft blast radius

2 areas changed → 2 areas can be affected. 3 dependent symbols, depth 2.
Tests: 2 areas updated their tests.
Tag: @anirudhkumar-nanonets — 4 of 4 areas · @shhdwi — 4 of 4 areas

flowchart TB
  A0(("Workspace Splitting<br/>2 symbols"))
  A1(("MCP Tool Invocation<br/>1 symbol"))
  classDef reached fill:#D9EDF3,stroke:#3AA7C9,stroke-width:1.5px,color:#0E313C;
  class A0,A1 reached;
Loading
Can be affected Symbols Nearest hop Reached from
Workspace Splitting 2 src/graph/workspace-cli.ts:L49-L70 buildChild — calls, depth 1 Context Building, CLI Initialization
MCP Tool Invocation 1 src/mcp/tools.ts:L256-L338 callSingleTool — calls, depth 2 Context Building
Who knows this code — 2 people across 4 areas
Area Who knows it
Context Building · changed @anirudhkumar-nanonets — 5 commits, last 9d ago · @shhdwi — 3 commits, last 11d ago
CLI Initialization · changed @anirudhkumar-nanonets — 36 commits, last 2d ago · @shhdwi — 24 commits, last 16d ago
Workspace Splitting · affected @shhdwi — 6 commits, last 17d ago · @anirudhkumar-nanonets — 3 commits, last 18d ago
MCP Tool Invocation · affected @shhdwi — 14 commits, last 17d ago · @anirudhkumar-nanonets — 6 commits, last 18d ago

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 @ has no GitHub handle in its commit email — tag them by hand, or add a .mailmap entry. A suggestion from history, not a CODEOWNERS rule.

All 3 dependent symbols, grouped by area

Workspace Splitting — 2 symbols in 2 files

  • src/graph/workspace-cli.ts:L49-L70 — buildChild (calls, depth 1)
    66: if (opts.deep) await engine.init(childDir, { extensions: opts.extensions });
  • src/graph/workspace.ts:L493-L506 — splitWorkspace (calls, depth 2)

MCP Tool Invocation — 1 symbol in 1 file

  • src/mcp/tools.ts:L256-L338 — callSingleTool (calls, depth 2)
Test signal per changed area — 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.

  • ✓ Context Building — 2 of 4 reached · 1 test file changed here: test/context-only-dir.test.ts
    • not reached: listContextFiles, resolveOnlyDirs
  • ✓ CLI Initialization — 1 of 1 reached · 1 test file changed here: test/context-only-dir.test.ts
4 test suites also reference this code

4 symbols, kept out of the diagram and the table so they cannot crowd out the areas a reviewer has to look at.

  • test/context-checkpoint.test.ts
  • test/context.test.ts
  • test/covers.test.ts
  • test/utf16-source.test.ts

graft blast · origin/main...HEAD · depth 2 · 5 changed files

Open the interactive graph → — click an area to see its dependent symbols at file:line.

github-actions Bot added a commit that referenced this pull request Aug 29, 2026
@shhdwi

shhdwi commented Aug 31, 2026

Copy link
Copy Markdown
Collaborator

Verified locally on top of current main (clean merge incl. #254; build clean).

Reproduced #252 with an offline recording summarizer: graft build --deep --only-dir src on base main summarized the WHOLE repo (docs/c.ts, src/a.ts, tools/b.ts) — out-of-scope work + full re-synthesis. With this PR only src/a.ts is summarized/synthesized. Nice that listContextFiles/filterByOnlyDirs reads the CLI value else the graph fingerprint (mirroring probeDrift) and is shared by checkContext, so build and check can't disagree. context-only-dir 6/6, graph-only-dir 2/2, context+check 30/30. Fixes #252. Merging.

@shhdwi
shhdwi merged commit 3fe4218 into trailhq:main Aug 31, 2026
8 checks passed
github-actions Bot added a commit that referenced this pull request Aug 31, 2026
FrancescoMerenda pushed a commit to FrancescoMerenda/Graft that referenced this pull request Sep 7, 2026
…q#262)

The wiring walk already filtered by whitelist; the --deep concept pass
and checkContext still walked the whole repo, so excluded files were
summarized and re-synthesized. Apply the same filter, with fingerprint
fallback so a later --deep without the flag stays scoped.

Co-authored-by: Cursor <cursoragent@cursor.com>
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.

graft build --deep ignores --only-dir: concept pass walks the whole repo (out-of-scope summaries + full re-synthesis on any new file)

2 participants