ocr scan --path . silently selects no files

Author: strawberry-little-bearCreated Sep 28, 2026Updated Sep 28, 2026

OpenCodeReview Version

dev snapshot from main at ebb6983a3a2d25468b6a68ba6092b9b8fe6bcb0 (September 28, 2026)

Operating System

Windows (the path matching itself is platform-independent)

Installation Method

Built from source

LLM Provider

Not applicable; this reproduces during file enumeration with --preview.

Bug Description

Passing the repository root explicitly to ocr scan --path . selects no files, even though the same repository is scanned when --path is omitted. --path ./ has the same problem.

The scan provider strips a leading ./ and a trailing slash, but it leaves . as the path selector for --path .. File paths returned by git ls-files are relative paths such as main.go; the selector logic only matches an exact path or a child path with <selector>/, so neither form matches . The result is an empty selection rather than an error or a scan of the repository root.

Steps to Reproduce

  1. Create a small Git repository containing a tracked file, for example main.go.

  2. From that repository, run:

    ocr scan --path . --preview
  3. Compare it with:

    ocr scan --preview

A focused reproduction against the current source also showed that NewProvider(repo, []string{"."}, nil, 0).Enumerate(...) returns zero items while git ls-files returns the tracked file. The existing scan package tests pass; this is an uncovered root-selector case.

Expected Behavior

--path . and --path ./ should mean “scan from the repository root”, just like omitting --path. At minimum, the command should reject the selector instead of silently producing an empty scan.

A likely fix is to normalize . (and the empty result of normalizing ./) to the same internal representation as no path filter, with regression coverage for both spellings.

Logs / Error Output

There is no explicit error. The failure is silent: the selected file count is zero.

AI/LLM Disclosure

I used OpenAI Codex to help inspect the source and run the local reproduction. The behavior, affected code path, and report were checked against the source and the test result before filing this issue.

Additional Context

This is separate from selecting a named directory such as --path internal/agent, which works because those selectors match the relative paths emitted by Git. The workaround is to omit --path when the intended scope is the whole repository.

Source: alibaba/open-code-review