fix(patterns): default patterns-files to empty (fetch all) #77
Reference in New Issue
Block a user
Delete Branch "issue-71"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Change the default for
patterns-filesfrom"README.md"to empty string.When
patterns-filesis empty, fetch all files from the patterns repo root instead of only fetching README.md.This makes the common case work: users who set
patterns-repoexpect to get all pattern files, not just the README.Changes
patterns-filesto""instead of"README.md"patternsFilesis empty, treat it as "fetch all from root" by passing empty path toGetAllFilesInPathTestBuildPatternPathsto verify path-building logicTesting
[""](repo root)Fixes #71
Sonnet Review
Summary
Clean, focused change that fixes the default for
patterns-filesto empty string and adds proper path-building logic with whitespace trimming and empty-entry skipping. CI passes, tests cover the new behavior.Findings
cmd/review-bot/main_test.gobuildPatternPathsas a package-level function and testing that instead, or writing an integration-style test that exercises fetchPatterns with a mock client.Recommendation
APPROVE — The change is correct and well-implemented. The default change from
"README.md"to""resolves the described issue, the empty-path sentinel[""]cleanly represents "fetch from root" without a separate boolean, and whitespace trimming plus empty-entry skipping are defensive improvements over the oldstrings.Splitbehavior. CI passes. The one minor concern is that the test duplicates production logic rather than testing through the actual function, but this is not a blocker. Approve.Review by sonnet
Evaluated against
8b8168dc@@ -504,6 +504,52 @@ func TestIsPatternFile(t *testing.T) {}}// TestBuildPatternPaths verifies the path-building logic for fetchPatterns.[MINOR] TestBuildPatternPaths duplicates the path-building logic from fetchPatterns as a local closure rather than testing fetchPatterns directly. If the production logic in fetchPatterns changes, this test won't catch it. The test is testing a copy of the logic, not the function itself. Consider extracting
buildPatternPathsas a package-level function and testing that instead, or writing an integration-style test that exercises fetchPatterns with a mock client.Security Review
Summary
Changes adjust the default behavior for pattern fetching to include all files from the repo root when patterns-files is empty and add corresponding tests. No exploitable security vulnerabilities are introduced by these modifications.
Recommendation
APPROVE — The updated default and path-building logic are reasonable and do not introduce security issues in themselves. Ensure operationally that the configured patterns repository is curated and does not contain sensitive information (e.g., secrets in YAML files), since all included pattern files are sent to the LLM provider. Otherwise, the implementation and tests look good and CI has passed.
Review by security
Evaluated against
8b8168dcGpt Review
Summary
Change correctly defaults patterns-files to empty and updates fetch logic to treat empty as repo root. Implementation is straightforward, idiomatic, and covered by a targeted unit test; CI passed.
Findings
cmd/review-bot/main_test.goRecommendation
APPROVE — The changes are sound: the flag default and help text now match the intended behavior, and fetchPatterns builds paths robustly (empty means repo root; entries are trimmed and empty entries skipped). The added unit test exercises the key path parsing cases. CI is green. As a small improvement, extract the path-building logic used in fetchPatterns into a helper and use it in both production and tests to prevent duplication. Otherwise, this is ready to merge.
Review by gpt
Evaluated against
8b8168dc@@ -504,6 +504,52 @@ func TestIsPatternFile(t *testing.T) {}[MINOR] TestBuildPatternPaths re-implements the path parsing logic inline. Consider extracting the path-building into a small helper in production code (or a package-level unexported function) and testing that directly to avoid duplication and future drift.