Skip to content

Restructure to make document be able to trace by llm - #29

Merged
hungpham10 merged 3 commits into
mainfrom
feature/restructure-to-make-document-be-able-to-trace-by-llm
Sep 12, 2026
Merged

hungpham10 merged 3 commits into
mainfrom
feature/restructure-to-make-document-be-able-to-trace-by-llm

Conversation

@hungpham10

Copy link
Copy Markdown
Owner

No description provided.

The document tools were unusable end-to-end due to four latent bugs:

- parsers: parent->children links were never persisted (nodes cloned into
  Document.nodes before children wiring), so hydrate could never descend.
- graph: path token chains were built in reverse order (root ended up last),
  so full-path queries never matched; also node cache was materialized after
  trie insertion, so the first ingest interned no keys.
- graph: the four trie projections shared one storage without namespace —
  radix root pointers collided per shard, leaving only the last-written trie
  reachable. Add shard_bias to Radix/Search (default 0) and give each docs
  trie a distinct shard range.
- graph: the string interner was RAM-only while tries persisted, so interned
  token payloads dangled after restart. Persist the interner blob alongside
  docs and restore it in open(); doc ids move to their own id range (>=6e11)
  so they no longer collide with node ids.

MCP/CLI wiring:
- doc_search now parses dotted patterns into token chains via the interner,
  with a case-insensitive key-scan fallback for non full-path queries.
- new tools: doc_search_value (scalar substring scan), doc_ingest_dir
  (recursive bulk ingest with limit), doc_remove.
- doc_hydrate takes max_depth to keep LLM payloads small; doc_list returns
  per-doc metadata (doc_id, path, format, root_node_id, nodes) instead of
  bare counts; search results include key/index.
- CLI: fix `doc ingest` clap panic (positional `path` clashed with the
  global --path arg, renamed to `file`); doc search uses the same real
  pattern resolution.
@coderabbitai

coderabbitai Bot commented Sep 12, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 50cf583b-6288-42ae-a7b2-2265f1c6ec89


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@hungpham10
hungpham10 merged commit 6a75ca7 into main Sep 12, 2026
18 checks passed
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 46.94656% with 278 lines in your changes missing coverage. Please review.
✅ Project coverage is 73.83%. Comparing base (b1d6a3d) to head (c68bedd).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
crates/codegraph-mcp/src/tools.rs 0.00% 155 Missing ⚠️
crates/codegraph-docs/src/graph.rs 79.46% 54 Missing ⚠️
crates/codegraph-mcp/src/lib.rs 0.00% 38 Missing ⚠️
crates/codegraph/src/main.rs 0.00% 31 Missing ⚠️

❌ Your patch status has failed because the patch coverage (46.94%) is below the target coverage (100.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #29      +/-   ##
==========================================
- Coverage   74.01%   73.83%   -0.19%     
==========================================
  Files          87       87              
  Lines       18837    19286     +449     
==========================================
+ Hits        13942    14239     +297     
- Misses       4895     5047     +152     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@codspeed

codspeed Bot commented Sep 12, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 28 untouched benchmarks


Comparing feature/restructure-to-make-document-be-able-to-trace-by-llm (c68bedd) with main (b1d6a3d)

Open in CodSpeed

@hungpham10
hungpham10 deleted the feature/restructure-to-make-document-be-able-to-trace-by-llm branch September 12, 2026 13:44
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.

2 participants