Context
internal/filescan/parallel.go is the shared parallel file-scanning utility used by the file-backed backends, but it has no dedicated test file. Its contract (result ordering, filtering, bounded concurrency) is currently only exercised indirectly through backend tests.
Task
- Read
internal/filescan/parallel.go and identify the exported API and its documented/implied contract.
- Create
internal/filescan/parallel_test.go with table-driven tests covering at least:
- results preserve input order regardless of goroutine completion order (use a callback that sleeps inversely to index to force out-of-order completion)
- empty input returns empty/nil without spawning work
- items the callback rejects (keep=false or error, per the actual API) are dropped while others survive
- single-item input
- input larger than the concurrency limit (e.g. 100 items) completes fully
- Ensure the ordering test would actually fail if order were broken (verify by temporarily breaking the implementation locally).
Acceptance criteria
go test ./internal/filescan passes.
go test -race ./internal/filescan passes (add it to the test invocation locally; CI already runs the suite).
- No changes to non-test code.
Context
internal/filescan/parallel.gois the shared parallel file-scanning utility used by the file-backed backends, but it has no dedicated test file. Its contract (result ordering, filtering, bounded concurrency) is currently only exercised indirectly through backend tests.Task
internal/filescan/parallel.goand identify the exported API and its documented/implied contract.internal/filescan/parallel_test.gowith table-driven tests covering at least:Acceptance criteria
go test ./internal/filescanpasses.go test -race ./internal/filescanpasses (add it to the test invocation locally; CI already runs the suite).