feat: log loaded pattern files for debugging #65
Reference in New Issue
Block a user
Delete Branch "issue-64"
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?
When
patterns-repois configured, now logs at Info level:At Debug level logs skipped files (non-markdown/txt/yaml).
Warns if no pattern files were loaded from a repo (likely misconfigured
patterns-filespath).Closes #64
Sonnet Review
Summary
Small, focused change that adds structured logging for pattern file loading. The implementation is correct, idiomatic, and follows the established slog patterns already used throughout the codebase.
Findings
cmd/review-bot/main.gofilesmap fromclient.GetAllFilesInPathis iterated withrange, which has non-deterministic order in Go. This meansrepoLoadedFilesandrepoSkippedFilesslices will have a random order each run, making log output non-reproducible. Consider sorting the slices before logging for consistent output (though this is low priority since it's purely diagnostic).cmd/review-bot/main.gopathsvariable logged in the warn case ("paths", paths) is the full slice of all configured paths, not the per-repo paths that were actually attempted. This is accurate but may be slightly misleading if paths are repo-specific. The current behavior is fine given the sharedpathsslice, just worth noting.Recommendation
APPROVE — Approve. The change is clean, minimal, and correct. It adds useful observability (Info for loaded files with count, Warn for empty results indicating misconfiguration, Debug for skipped files) using the idiomatic
log/slogstructured logging already established in the codebase. The two nits are cosmetic and do not affect correctness or functionality.Review by sonnet
Evaluated against
deade3c5@@ -567,0 +572,4 @@if len(repoLoadedFiles) > 0 {slog.Info("loaded pattern files", "repo", repoRef, "count", len(repoLoadedFiles), "files", repoLoadedFiles)} else {[NIT] The
filesmap fromclient.GetAllFilesInPathis iterated withrange, which has non-deterministic order in Go. This meansrepoLoadedFilesandrepoSkippedFilesslices will have a random order each run, making log output non-reproducible. Consider sorting the slices before logging for consistent output (though this is low priority since it's purely diagnostic).@@ -567,3 +580,4 @@}}return sb.String()}[NIT] The
pathsvariable logged in the warn case ("paths", paths) is the full slice of all configured paths, not the per-repo paths that were actually attempted. This is accurate but may be slightly misleading if paths are repo-specific. The current behavior is fine given the sharedpathsslice, just worth noting.Security Review
Summary
The change adds structured logging for loaded and skipped pattern files. There are no introduced security risks or misuse of untrusted input, and CI has passed.
Recommendation
APPROVE — Approve as submitted. The new logs (info/debug) provide useful observability without exposing sensitive data or increasing attack surface. Consider keeping the file lists at debug level if log volume becomes an operational concern, but this is not a security issue.
Review by security
Evaluated against
deade3c5Gpt Review
Summary
Changes add helpful logging around pattern file loading without altering core behavior. Implementation is straightforward, idiomatic, and consistent with existing logging and dependency conventions.
Recommendation
APPROVE — The added info/debug logs in fetchPatterns correctly capture loaded and skipped files per repo and warn when none are found, aligning with the PR intent. No new dependencies were introduced, error handling remains unchanged, and CI passed. Optionally, consider trimming the displayed paths list (you already trim per-iteration) or deduplicating file paths in cases where multiple input paths overlap to reduce log noise in very large repos. Otherwise, the changes are solid.
Review by gpt
Evaluated against
deade3c5Self-review: PASS
No blocking issues found — ready for human review.
Summary
Reviewed the diff against the issue requirements (#64) and codebase patterns:
log/slogstructured logging consistent with existing patterns ✅Bot Review NITs (acknowledged)
Two cosmetic NITs from sonnet-review-bot were noted:
pathsin warn message is the full config slice — accurate reflection of what was configuredNeither affects correctness or debuggability. The implementation achieves the issue goals cleanly.
Self-review by rodin