Skip to content

fix(find): bound uncached glob traversal - #4044

Merged
Yeachan-Heo merged 1 commit into
Yeachan-Heo:devfrom
larrabee-kor:fix/bounded-uncached-find
Aug 9, 2026
Merged

fix(find): bound uncached glob traversal#4044
Yeachan-Heo merged 1 commit into
Yeachan-Heo:devfrom
larrabee-kor:fix/bounded-uncached-find

Conversation

@larrabee-kor

Copy link
Copy Markdown
Contributor

Summary

  • match uncached sorted globs during traversal and retain only the newest K entries with deterministic mtime desc, path asc ordering
  • cap native progress delivery at 32 snapshots plus one final snapshot and keep FindTool progress state deduplicated and bounded to K
  • preserve cached complete-or-error scans, existing hidden/ignore/node_modules/symlink/file-type behavior, lazy native loading, MCP routing, and explicit .gjc/global-store routing

This is intentionally limited to the four files in the approved broad-find plan. It does not change shared fs-cache limits, Darwin session storage, runtime state, or global-store routing.

Related context: #3769 established the real large-root native scan ownership problem; #3780 added complete-or-error shared-scan bounds. This PR fixes the user-facing uncached find path that otherwise materializes that complete snapshot before applying K.

Verification

  • cargo test -p pi-natives glob --lib — 16 passed
  • bun run build:native — passed
  • bun test packages/natives/test/native.test.ts — 37 passed
  • bun test packages/coding-agent/test/tools.test.ts -t "find tool" — 8 passed, 17 assertions
  • bun run --cwd=packages/natives check — passed
  • bun run --cwd=packages/coding-agent generate-docs-index && bun run --cwd=packages/coding-agent check — passed
  • scoped Clippy with the six unchanged origin/dev computer/controller diagnostics allowed — passed with -D warnings
  • local 250,004-entry regression — returned exactly zz-target-c.txt, zz-target-b.txt, zz-target-a.txt; 4 callbacks for K=3
  • FS_SCAN_MAX_ENTRIES=10 contract probe — cached scan failed closed with FS_SCAN_LIMIT and zero callbacks; uncached scan returned the newest K=3

Base-only gate note

bun run check:rs currently fails on six denied Clippy diagnostics already present in origin/dev@3bddcc579, all in crates/pi-natives/src/computer/controller.rs. No changed file is implicated; the affected crate passes scoped Clippy after allowing only those three base-only lint classes.

Broad sorted finds built a complete native snapshot before applying the requested limit, so large roots failed at the shared scan budget despite narrow output.

Lore-id: 23cadfc5
Constraint: cached scans remain complete-or-error
Constraint: explicit hidden and global-store searches keep existing routing
Rejected: raising filesystem scan limits | preserves root-sized ownership
Tested: focused Rust glob, native package, FindTool, package type checks, 250004-entry local regression

@Yeachan-Heo Yeachan-Heo left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MERGE_READY at f94d105. Reviewed bounded newest-K selection, deterministic mtime/path ordering, callback caps, timeout mapping, cancellation handling, and native/TS coverage. Exact-head CI is green; no active repair overlap or owner gate found.

@Yeachan-Heo

Copy link
Copy Markdown
Owner

Contributor ledger — REVIEW. Admitted as the active native/find bounded-traversal lane. Its native + TypeScript boundary, deterministic top-K ordering, and progress cap have focused evidence and clean checks. Review must preserve cache/shared-scan semantics and native ABI behavior; it does not own the unrelated TUI/session census items.

@Yeachan-Heo
Yeachan-Heo merged commit 7cd764c into Yeachan-Heo:dev Aug 9, 2026
27 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.

2 participants