Skip to content

fix(#560): path_glob page fills from glob-filtered results instead of starving below the rank window#561

Merged
justrach merged 3 commits into
release/0.2.5825from
fix/issue-560-pathglob-starvation
Jun 10, 2026
Merged

fix(#560): path_glob page fills from glob-filtered results instead of starving below the rank window#561
justrach merged 3 commits into
release/0.2.5825from
fix/issue-560-pathglob-starvation

Conversation

@justrach

Copy link
Copy Markdown
Owner

Fixes #560.

Problem

handleSearch fetched offset+max_results+1 globally-ranked results and applied path_glob only at render time. An in-glob match ranking below the window yielded the self-contradicting 0 results … (more results — offset=20). Live repro: codedb_search query='searchContent' path_glob='src/explore.zig' → 0 results despite the function being defined there. Same filter-after-cap family as #547/#553.

Fix

Plain-search branch: with path_glob set, escalate the fetch window ×4 (existing 100000 cap) until the in-glob set fills the page or the index is exhausted, then page over the glob-filtered sequence — offset becomes a cursor into in-glob results and has_more reflects in-glob continuation. No behavior change when path_glob is unset (want_count == old fetch_count, paging over fetched as before). scope=/regex= branches share the bug shape; left for a follow-up per the issue.

Failing Test

test "issue-560: path_glob page must not be starved by higher-ranked out-of-glob files" (src/test_search.zig), committed red: 40 tying out-of-glob decoys ahead of src/gold.zig; pre-fix 67/68.

Validation

zig build test: all green (729 tests), including issue-recall path_glob and issue-422 header-count tests.

Note: trivial EOF conflict with #557 in src/test_search.zig if merged second (both append a test at file end).

🤖 Generated with Claude Code

justrach and others added 2 commits June 10, 2026 10:42
…glob files

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ot the global rank window

When path_glob is set, escalate the fetch window (x4, capped at the
existing 100000 bound) until the in-glob set fills the requested page
or the index is exhausted, then page over the glob-filtered view so
offset/max_results address in-glob results. Previously the handler
fetched offset+max_results+1 globally-ranked rows and filtered at
render time, so an in-glob match ranking below the window produced
'0 results' alongside a 'more results' hint.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

Benchmark Regression Report

Thresholds: 10.00% and 50,000 ns absolute delta

NOISE means the percentage threshold was exceeded, but the absolute delta was too small to fail CI.

Tool Base (ns) Head (ns) Delta Abs Delta (ns) Status
codedb_bundle 106765 111576 +4.51% +4811 OK
codedb_changes 11488 11622 +1.17% +134 OK
codedb_context 1168099 1170356 +0.19% +2257 OK
codedb_deps 327 401 +22.63% +74 NOISE
codedb_edit 51515 59466 +15.43% +7951 NOISE
codedb_find 10238 10311 +0.71% +73 OK
codedb_hot 28815 28564 -0.87% -251 OK
codedb_outline 35504 36341 +2.36% +837 OK
codedb_read 19552 17623 -9.87% -1929 OK
codedb_search 26353 26393 +0.15% +40 OK
codedb_snapshot 75424 76475 +1.39% +1051 OK
codedb_status 9616 10210 +6.18% +594 OK
codedb_symbol 50006 49630 -0.75% -376 OK
codedb_tree 50103 53127 +6.04% +3024 OK
codedb_word 12921 13491 +4.41% +570 OK

…+ 560)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@justrach justrach merged commit e8a7e01 into release/0.2.5825 Jun 10, 2026
1 check passed
@justrach justrach deleted the fix/issue-560-pathglob-starvation branch June 10, 2026 03:23
@github-actions

Copy link
Copy Markdown

Benchmark Regression Report

Thresholds: 10.00% and 50,000 ns absolute delta

NOISE means the percentage threshold was exceeded, but the absolute delta was too small to fail CI.

Tool Base (ns) Head (ns) Delta Abs Delta (ns) Status
codedb_bundle 114105 106079 -7.03% -8026 OK
codedb_changes 11762 11183 -4.92% -579 OK
codedb_context 1180050 1201909 +1.85% +21859 OK
codedb_deps 332 323 -2.71% -9 OK
codedb_edit 57404 53032 -7.62% -4372 OK
codedb_find 12576 10338 -17.80% -2238 OK
codedb_hot 30120 27731 -7.93% -2389 OK
codedb_outline 35279 35154 -0.35% -125 OK
codedb_read 17912 17645 -1.49% -267 OK
codedb_search 26471 25964 -1.92% -507 OK
codedb_snapshot 75726 70840 -6.45% -4886 OK
codedb_status 10520 9795 -6.89% -725 OK
codedb_symbol 51617 49187 -4.71% -2430 OK
codedb_tree 23742 23827 +0.36% +85 OK
codedb_word 13606 12649 -7.03% -957 OK

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