Skip to content

Commit 72bee1e

Browse files
tae2089claude
andcommitted
Log fallback-scan truncation and drop dead blank-assignment block
- scanDBCandidates now warns when the fallback scan hits scanRowCap, so a silently truncated result set is observable instead of looking complete. - Remove the pointless `var ( _ = dbCandidateFloor; _ = dbCandidateCap )` block: both constants are used by DBCandidateLimit. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 61a01fe commit 72bee1e

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

internal/retrieval/retrieval.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,3 @@ const (
4141
// this behave identically to an uncapped scan; larger ones are truncated in stable order.
4242
scanRowCap = 5000
4343
)
44-
45-
var (
46-
_ = dbCandidateFloor
47-
_ = dbCandidateCap
48-
)

internal/retrieval/service.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"errors"
66
"fmt"
7+
"log/slog"
78
"os"
89
"sort"
910
"strings"
@@ -126,6 +127,11 @@ func (s *Service) scanDBCandidates(ctx context.Context, namespace, query string)
126127
Find(&nodes).Error; err != nil {
127128
return nil, fmt.Errorf("retrieve docs DB candidates: %w", err)
128129
}
130+
if len(nodes) == scanRowCap {
131+
// The scan hit its ceiling: matching nodes sorting after the cap are not considered.
132+
slog.WarnContext(ctx, "retrieve_docs fallback scan truncated at cap; some matches may be omitted",
133+
"namespace", namespace, "cap", scanRowCap)
134+
}
129135
if len(nodes) == 0 {
130136
return nil, nil
131137
}

0 commit comments

Comments
 (0)