Skip to content

Expose index reconciliation and require explicit search synchronization - #8

Merged
hlubek merged 4 commits into
mainfrom
worktree-nhu
Sep 5, 2026
Merged

Expose index reconciliation and require explicit search synchronization#8
hlubek merged 4 commits into
mainfrom
worktree-nhu

Conversation

@hlubek

@hlubek hlubek commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR exposes search-index reconciliation through the public application runtime and makes search synchronization an explicit host policy.

  • Adds none, local, and all synchronization scopes for application and MCP searches.
  • Extracts reusable index reconciliation into a command handler with post-persistence progress callbacks.
  • Moves shared index types into an importable public types package while retaining application aliases.
  • Updates the CLI, MCP server, external example, documentation, and tests for the explicit policy.
  • The no-synchronization path still performs a graph-wide attachment scan before querying its warm index.

Confidence Score: 4/5

The PR appears safe to merge, with a non-blocking performance and availability concern in the SearchSyncNone path.

Synchronization scope and reconciliation behavior are coherent and well tested; the remaining concern is that no-sync vector searches still read every attachment before querying an already-warm index.

Files Needing Attention: pkg/application/vector_search.go

Important Files Changed

Filename Overview
pkg/application/vector_search.go Makes reconciliation conditional on synchronization mode, but still computes all attachment-backed entry hashes for SearchSyncNone.
internal/handlers/search_index.go Extracts entry-manifest and compatibility reconciliation into a reusable handler with callbacks after persistence.
pkg/application/search_index.go Exposes current-graph index reconciliation and synchronization constants on ProjectRuntime.
pkg/application/application.go Validates explicit synchronization intent and applies local versus dependency synchronization scope.
pkg/application/types/search_index.go Centralizes public index records, reconciliation callbacks, and synchronization-mode definitions.
pkg/mcpapp/server.go Requires embedding hosts to choose the synchronization policy used by all MCP searches.
pkg/mcpapp/tools.go Propagates the server's configured synchronization policy into application search requests.
pkg/application/search_index_test.go Covers reconciliation callbacks, failures, synchronization scope, validation, and warm-index querying, but not attachment I/O under SearchSyncNone.

Comments Outside Diff (1)

  1. pkg/application/vector_search.go, line 38-40 (link)

    P2 No-sync still scans attachments

    SearchSyncNone skips index reconciliation, but this call still computes hashes for every current entry before querying the existing index. That process reads every attachment in full, so searches over a warm index still incur graph-wide attachment I/O, and one unavailable attachment prevents the search from reaching the index. Avoid the full attachment scan in the no-sync path, such as by computing freshness information only for returned candidates.

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: pkg/application/vector_search.go
    Line: 38-40
    
    Comment:
    **No-sync still scans attachments**
    
    `SearchSyncNone` skips index reconciliation, but this call still computes hashes for every current entry before querying the existing index. That process reads every attachment in full, so searches over a warm index still incur graph-wide attachment I/O, and one unavailable attachment prevents the search from reaching the index. Avoid the full attachment scan in the no-sync path, such as by computing freshness information only for returned candidates.
    
    ---
    
    For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
Prompt To Fix All With AI
### Issue 1
pkg/application/vector_search.go:38-40
**No-sync still scans attachments**

`SearchSyncNone` skips index reconciliation, but this call still computes hashes for every current entry before querying the existing index. That process reads every attachment in full, so searches over a warm index still incur graph-wide attachment I/O, and one unavailable attachment prevents the search from reaching the index. Avoid the full attachment scan in the no-sync path, such as by computing freshness information only for returned candidates.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Reviews (1): Last reviewed commit: "Keep API documentation beside the implem..." | Re-trigger Greptile

@hlubek
hlubek merged commit 06d555a into main Sep 5, 2026
3 checks passed
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