Skip to content

fix: skip scanner symlink cycles and map compile_batch panics - #3

Merged
undivisible merged 1 commit into
mainfrom
fix/scanner-symlink-and-batch-panic
Sep 15, 2026
Merged

undivisible merged 1 commit into
mainfrom
fix/scanner-symlink-and-batch-panic

Conversation

@undivisible

@undivisible undivisible commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Independent of #1 (load/compile hardening).

  • scan_directory and LibraryScanner skip symlinks so directory cycles cannot hang discovery
  • scanner also skips target, .git, build, and other non-source trees (matching detector)
  • compile_batch maps worker panics to CompileError instead of join().unwrap()

Test plan

  • cargo test --all-features
  • cargo clippy --all-targets --all-features -- -D warnings
  • cargo fmt --all -- --check
  • new tests: symlink skip, skip target/ headers

Note

Low Risk
Localized filesystem-walk and error-handling changes with tests; no auth, data, or API contract breaks beyond surfacing panics as errors.

Overview
Hardens directory discovery and parallel compilation so bad filesystem layouts and worker failures do not crash the process.

Discovery (scan_directory, LibraryScanner) now classifies entries with file_type() and ignores symlinks, so symlinked directory trees cannot cause infinite recursion or hangs. The library header scanner also skips the same non-source directories as the detector (target, .git, build, dist, zig-cache, nimcache, etc.) when recursing.

compile_batch no longer panics if a scoped worker thread panics: join() failures are turned into CompileError::Io with a clear message instead of propagating an unwrap panic.

Tests cover symlinked-dir skipping (Unix) and ignoring headers under target/.

Reviewed by Cursor Bugbot for commit f82581a. Configure here.

Library and source scanners no longer follow directory or file
symlinks, and skip target/.git/build trees. compile_batch reports
worker panics as CompileError instead of unwinding.

Amp-Thread-ID: https://ampcode.com/threads/T-01a0a631-cbad-764e-a59c-662f4c6e0902
Co-authored-by: Max Carter <undivisible@vk.com>
@capy-ai

capy-ai Bot commented Sep 15, 2026

Copy link
Copy Markdown

Capy couldn't review this pull request because Max's workspace is out of credits, add credits or enable auto-reload to resume automatic reviews.

Open in Capy

@cursor

cursor Bot commented Sep 15, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_5f32ba52-8171-41b1-b37c-b98aa8a43a74)

@mergify

mergify Bot commented Sep 15, 2026

Copy link
Copy Markdown

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@undivisible
undivisible merged commit d4314a1 into main Sep 15, 2026
8 checks passed
@undivisible
undivisible deleted the fix/scanner-symlink-and-batch-panic branch September 15, 2026 18:06
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