open-code-review/internal/agent
Lei Zhang 482de7ac52
fix: skip binary review (#28)
* fix(agent): skip binary files during code review

Previously, binary files were passed through the review pipeline because
shouldReview only checked path/extension rules. This caused the agent to
incorrectly attempt reviewing binary content.

- Add ExcludeBinary reason to the exclusion filter
- Change shouldReview/whyExcluded to accept model.Diff instead of path
  string, enabling access to the IsBinary flag
- Check IsBinary as the first gate in whyExcluded
- Differentiate skip log messages for binary vs path-filtered files

* test: add unit tests for preview.go

* fix: normalize dash to em-dash in binary file skip log message

* test(agent): strengthen UserIncludePattern tests to cover additive semantics

- Document that include patterns are additive, not exclusive
- Add cases verifying include bypasses default-path exclusion
- Add cases for extension filter precedence over include logic
- Add TestWhyExcluded_IncludeBypassesDefaultPath for rescue semantics
- Add TestWhyExcluded_IncludeAndExcludeInteraction for priority order
2026-06-03 18:01:30 +08:00
..
agent.go fix: skip binary review (#28) 2026-06-03 18:01:30 +08:00
preview.go fix: skip binary review (#28) 2026-06-03 18:01:30 +08:00
preview_test.go fix: skip binary review (#28) 2026-06-03 18:01:30 +08:00