Skip to content

fix source routing for import and search#1168

Closed
tyad67-netizen wants to merge 1 commit into
garrytan:masterfrom
tyad67-netizen:fix/source-routing-import-search
Closed

fix source routing for import and search#1168
tyad67-netizen wants to merge 1 commit into
garrytan:masterfrom
tyad67-netizen:fix/source-routing-import-search

Conversation

@tyad67-netizen
Copy link
Copy Markdown

Summary

Fixes two source-routing bugs:

  • gbrain import --source <id> now routes imported pages/chunks to the requested source using the existing resolveSourceId chain.
  • gbrain search --source <id> now applies a source filter in both PGLite and Postgres keyword search paths.

Also:

  • Preserves programmatic opts.sourceId compatibility.
  • Guards missing --source values.
  • Updates CLI/docs help text.
  • Adds regression coverage for source-filtered keyword search.

Fixes #1167.

Test Plan

Local focused verification:

./bin/bun run typecheck
PATH="$PWD/bin:$PATH" ./bin/bun test test/source-id-tx-regression.test.ts test/build-llms.test.ts
# 27 pass / 0 fail
PATH="$PWD/bin:$PATH" ./bin/bun run build

Manual end-to-end smoke:

  • isolated temp GBRAIN_HOME
  • create sources alpha, beta
  • import vault A with --source alpha
  • import vault B with --source beta
  • verify search --source alpha only returns alpha
  • verify search --source beta only returns beta
  • verify search --source default does not return imported alpha/beta hits
  • verify missing --source value fails loudly

Real acceptance verification against local HermesClaude vault:

default               federated          0 pages
hermes-local-wiki     isolated           0 pages
hermesclaude-main     federated        567 pages
hermesintake          isolated           0 pages
openclaw-wiki         isolated           0 pages

Search query HermesClaude:

  • --source hermesclaude-main: returns hits
  • --source hermesintake: No results
  • --source openclaw-wiki: No results
  • --source default: No results
  • --source __all__: returns hits

@garrytan
Copy link
Copy Markdown
Owner

Closing in favor of #1253 (v0.37.7.0 fix wave) which re-implements source routing for gbrain import, gbrain extract, and gbrain query against current master.

Specifically your work informed the --source-id flag shape on import.ts; the v0.37.7.0 implementation lives at src/commands/import.ts with a regression test at test/import-source-id.test.ts.

Per the wave's "re-implement, credit, close" workflow, your contribution is acknowledged via Co-Authored-By: tyad67-netizen trailer in the import-source-id commit. Thank you for the fix and the time on this.

@garrytan garrytan closed this May 21, 2026
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.

bug: import --source and search --source silently ignore source routing

2 participants