Repository navigation
fix(index): paginate per-profile rebuild/clear beyond search-page caps (MCP-3319) - #763
Conversation
GetToolsByServer capped a single Bleve search at 10000 hits and DeleteAll at 100000, so a server with >10k indexed tools or an index with >100k docs would silently drop the overflow during a per-profile rebuild/clear, leaving the profile index inconsistent with the shared index. Both now loop over search pages until exhausted, so coverage is never bounded by a single page: - GetToolsByServer paginates with From/Size, ending on a short final page. - DeleteAll deletes page-by-page from offset 0 (each batch removes the enumerated docs, surfacing the next page) until the index is empty. Page size is a configurable BleveIndex field (default 10000) so the regression tests exercise the loop with a small, fast corpus. Related #756. Follow-up to MCP-3240 Codex review (MCP-3307).
Deploying mcpproxy-docs with
|
| Latest commit: |
bda86fb
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://12ec5bf3.mcpproxy-docs.pages.dev |
| Branch Preview URL: | https://mcp-3319-bleve-pagination.mcpproxy-docs.pages.dev |
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
📦 Build ArtifactsWorkflow Run: View Run Available Artifacts
How to DownloadOption 1: GitHub Web UI (easiest)
Option 2: GitHub CLI gh run download 28119313231 --repo smart-mcp-proxy/mcpproxy-go
|
There was a problem hiding this comment.
✅ Gatekeeper approval — review verdict: ACCEPT (by ClaudeReviewer+KimiReviewer, model-diverse fallback).
This approval is posted automatically by the MCPProxy Gatekeeper App on behalf of ClaudeReviewer+KimiReviewer — the model-diverse reviewer-fallback reviewer of record (verdict lives in the Paperclip review thread). Author≠approver satisfied; QA + CI gates enforced separately.
Auto-approved per Model B (MCP-1249) + reviewer-fallback (MCP-3066).
Dumbris
left a comment
There was a problem hiding this comment.
ACCEPT — solid pagination fix for MCP-3319.
What the PR does:
- Replaces single-search-with-magic-cap in
DeleteAllandGetToolsByServerwith proper pagination loops. DeleteAllfetches from offset 0 each iteration after batch delete (correct — avoids stale offsets post-mutation).GetToolsByServeruses standardfrom-offset pagination for read-only iteration.searchPageSizefield (default 10000) overridable in tests; enables fast regression with small corpus.
Tests: Both BeyondPageCap tests pass; full internal/index suite passes.
No issues found. LGTM.
Summary
Backend robustness hardening — follow-up to the CodexReviewer
request_changesverdict on MCP-3307 (adversarial review of per-profile Bleve indexes, PR #756 / MCP-3240). The human merged #756 pragmatically; the two correctness gaps Codex flagged are fixed here.Findings fixed (both shipped to
maininf046f905)GetToolsByServersilently dropped tools beyond a 10000-hit search cap (internal/index/bleve.go). Sourced byManager.RebuildProfileFromShared→ a server with >10k indexed tools would have its overflow omitted from the rebuilt profile index.DeleteAllonly cleared the first 100000 docs (internal/index/bleve.go). On a profile rebuild (which callsDeleteAllfirst), stale docs beyond 100k could survive, leaving the profile index inconsistent with the shared index.Fix
Both operations now loop over search pages until exhausted, so coverage is never bounded by a single page:
GetToolsByServerpaginates withFrom/Size, ending on a short final page (fewer hits than the page size).DeleteAlldeletes page-by-page from offset0— each batch removes the docs just enumerated, so the next search surfaces the following page — until the index is empty (noFromoffset bookkeeping against a shrinking set).Page size is a configurable
BleveIndexfield (default10000) so the regression tests exercise the pagination loop with a small, fast corpus instead of indexing >10k docs.Tests (TDD)
TestBleveIndex_GetToolsByServer_BeyondPageCap— page size 3, 7 tools across 3 pages + an unrelated server; asserts all 7 returned and the term filter holds across pages. Fails before the fix (overflow dropped).TestBleveIndex_DeleteAll_BeyondPageCap— page size 3, 10 docs; assertsGetDocumentCount()==0afterDeleteAll. Fails before the fix (docs beyond a page survive).Verification
go test ./internal/index/... -race✅go test ./internal/runtime/ -run Profile -race✅ (profile rebuild/reconcile path)go build ./internal/...✅golangci-lint run --config .github/.golangci.yml ./internal/index/...→ 0 issues ✅Out of scope
DeleteServerToolscarries a similarSize = 1000per-server cap, but it was not part of the Codex findings and isn't on the profile-rebuild path. Noting it here as a candidate follow-up; left unchanged to keep this PR scoped to the two cited findings.Provenance
233fb835-22c7-4a44-a372-71b047eb879bon MCP-3307f046f905(PR feat(index): per-profile Bleve indexes (Profiles v2 T1) — MCP-3240 #756)Related #756.