Skip to content

knowledge: support pluggable resource and graph stores - #2420

Draft
hyprh wants to merge 2 commits into
trpc-group:mainfrom
hyprh:work_knowledge_resource_interfaces
Draft

knowledge: support pluggable resource and graph stores#2420
hyprh wants to merge 2 commits into
trpc-group:mainfrom
hyprh:work_knowledge_resource_interfaces

Conversation

@hyprh

@hyprh hyprh commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add typed Stores / WithStores configuration for vector, graph, and resource backends
  • introduce resourcestore.Store plus Agent-facing APIs for listing sources, browsing directory trees, reading line ranges, and grepping persisted text
  • add the optional source.ResourceSource capability and implement it for file, directory, URL, auto, and repository sources
  • persist normalized source text before indexing its derived documents, then attach source_id, resource path, and best-effort line ranges to vector document metadata
  • keep resource state aligned across load, add, reload, recreate, and remove operations, including stale-resource cleanup after successful vector writes
  • support graph-native seed search through an optional graphstore.Searcher capability and close all configured stores once

Notes

  • existing WithVectorStore behavior remains supported
  • resource-only and graph-only Knowledge instances remain valid; document Search returns vector store not configured when no vector backend exists
  • resource identity is source_id plus a canonical source-relative path
  • the initial resource representation is normalized UTF-8 text; directory entries are derived from persisted file paths, so empty directories are not represented
  • ResourceStore and VectorStore do not share an atomic transaction; write and delete methods are required to be idempotent so interrupted imports can be retried safely

Testing

  • go test ./knowledge/... -count=1
  • go test -race ./knowledge ./knowledge/source/file ./knowledge/source/dir ./knowledge/source/url ./knowledge/source/auto ./knowledge/source/repo -count=1
  • go vet ./knowledge/...
  • typos
  • git diff --check

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 3099e4ad-807a-4cf0-ad94-4ef90660725a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

@codecov

codecov Bot commented Aug 5, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 69.49261% with 475 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.81025%. Comparing base (c808f1c) to head (fb2fa6c).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
knowledge/source/repo/repo_source.go 62.33766% 50 Missing and 37 partials ⚠️
knowledge/resource_default.go 69.40299% 46 Missing and 36 partials ⚠️
knowledge/source/dir/dir_source.go 55.71429% 32 Missing and 30 partials ⚠️
knowledge/source/url/url_source.go 64.63415% 31 Missing and 27 partials ⚠️
knowledge/resource_load.go 74.12935% 30 Missing and 22 partials ⚠️
knowledge/source/file/file_source.go 64.03509% 22 Missing and 19 partials ⚠️
knowledge/source/auto/auto_source.go 66.27907% 16 Missing and 13 partials ⚠️
knowledge/default.go 70.65217% 14 Missing and 13 partials ⚠️
knowledge/tool/searchtool.go 76.27119% 8 Missing and 6 partials ⚠️
knowledge/tool/resourcetool.go 89.74359% 4 Missing and 4 partials ⚠️
... and 3 more
Additional details and impacted files
@@                 Coverage Diff                 @@
##                main       #2420         +/-   ##
===================================================
- Coverage   89.94234%   89.81025%   -0.13210%     
===================================================
  Files           1203        1211          +8     
  Lines         218878      221075       +2197     
===================================================
+ Hits          196864      198548       +1684     
- Misses         13804       14082        +278     
- Partials        8210        8445        +235     
Flag Coverage Δ
unittests 89.81025% <69.49261%> (-0.13210%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

1 participant