Sonnet Review Bot sonnet-review-bot
  • Joined on 2026-04-24
sonnet-review-bot commented on pull request rodin/review-bot#67 2026-05-11 06:41:55 +00:00
docs: add read:user to required token scopes

[NIT] The header separator row changed from `

sonnet-review-bot approved rodin/review-bot#67 2026-05-11 06:41:55 +00:00
docs: add read:user to required token scopes

Sonnet Review

sonnet-review-bot commented on pull request rodin/review-bot#65 2026-05-11 06:38:00 +00:00
feat: log loaded pattern files for debugging

[NIT] The paths variable 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 shared paths slice, just worth noting.

sonnet-review-bot approved rodin/review-bot#65 2026-05-11 06:38:00 +00:00
feat: log loaded pattern files for debugging

Sonnet Review

sonnet-review-bot commented on pull request rodin/review-bot#65 2026-05-11 06:38:00 +00:00
feat: log loaded pattern files for debugging

[NIT] The files map from client.GetAllFilesInPath is iterated with range, which has non-deterministic order in Go. This means repoLoadedFiles and repoSkippedFiles slices 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).

sonnet-review-bot commented on pull request rodin/review-bot#63 2026-05-11 03:46:15 +00:00
fix: address remote persona review findings

[MINOR] The err2 variable name in the personaFile branch is a workaround for shadowing from the outer err in the personaName branch, but the two branches are mutually exclusive (else if). A cleaner approach would be to use a fresh err variable inside the else-if block with its own scope: if err := validateWorkspacePath(...); err != nil { ... } followed by persona, err = review.LoadPersona(resolvedPath) where err is declared at block scope. The current err2 naming is functional but slightly non-idiomatic.

sonnet-review-bot commented on pull request rodin/review-bot#63 2026-05-11 03:46:15 +00:00
fix: address remote persona review findings

[NIT] The processed counter increments only when a persona is successfully parsed, but the cap check if processed >= maxPersonaFiles happens at the top of the loop. This means the cap applies to successfully-loaded personas, not to total files iterated. If there are 100 entries where 49 are invalid YAML and 51 are valid, all 51 valid ones will be processed (the limit is checked against processed, which only increments on success). This is arguably the right behavior but might be surprising — consider a comment clarifying that the cap applies to successfully loaded personas, not files visited.

sonnet-review-bot approved rodin/review-bot#63 2026-05-11 03:46:15 +00:00
fix: address remote persona review findings

Sonnet Review

sonnet-review-bot commented on pull request rodin/review-bot#61 2026-05-11 02:46:05 +00:00
feat: load personas from target repo .review-bot/personas/

[MINOR] When LoadRepoPersonas returns an error, repoPersonas is nil and the code falls through to repoPersonas[*personaName]. The comment correctly notes this is safe in Go (nil map read returns zero value), but the variable err is declared via repoPersonas, err := ... and then reassigned in the else branch with persona, err = review.LoadBuiltinPersona(...). This works due to Go's scoping rules but the comment about nil map safety would be clearer if placed directly above the map indexing line rather than after the Warn log.

sonnet-review-bot commented on pull request rodin/review-bot#61 2026-05-11 02:46:05 +00:00
feat: load personas from target repo .review-bot/personas/

[MINOR] isNotFoundError relies on string matching (strings.Contains(err.Error(), "HTTP 404")) against the gitea client's error format. This is a brittle coupling: if the gitea package ever changes its error message format, this silently breaks (directory-not-found becomes a propagated error). A sentinel error or a typed error in the gitea package would be more robust, but given this is an internal package with a defined error format and the function is well-documented with the rationale, this is acceptable in context.

sonnet-review-bot commented on pull request rodin/review-bot#61 2026-05-11 02:46:05 +00:00
feat: load personas from target repo .review-bot/personas/

[NIT] MergePersonas is defined but never called in main.go — the main flow only calls LoadRepoPersonas and does a direct map lookup. MergePersonas and GetBuiltinPersonasMap are exported utility functions that are tested but unused by the current main flow. This is fine as they're part of the public API for future use, but worth noting in a follow-up if they remain unused.

sonnet-review-bot commented on pull request rodin/review-bot#61 2026-05-11 02:46:05 +00:00
feat: load personas from target repo .review-bot/personas/

[NIT] Trailing whitespace on the struct field alignment lines (extra spaces between name and string field definitions). Minor formatting issue — gofmt would normalize this.

sonnet-review-bot commented on pull request rodin/review-bot#61 2026-05-11 02:46:05 +00:00
feat: load personas from target repo .review-bot/personas/

[MINOR] Duplicate flag.Parse() call — the diff shows the old flag.Parse() was removed but the remaining one on line 81 is a leftover duplicate. The full file content shows flag.Parse() appears twice consecutively (lines 80-81). This is a copy-paste artifact from the diff. It is harmless since repeated flag.Parse() calls are idempotent, but it's noise and should be cleaned up.

sonnet-review-bot commented on pull request rodin/review-bot#61 2026-05-11 02:44:42 +00:00
feat: load personas from target repo .review-bot/personas/

[MINOR] Duplicate flag.Parse() call: the diff shows the original flag.Parse() was removed and a new one kept, but the full file content shows flag.Parse() appears only once. This appears to be a diff artifact (the - removed one and the context line shows the kept one). Verify the compiled binary doesn't call flag.Parse() twice — if it does, this should be fixed as double-parsing has undefined behavior for some flag types.

sonnet-review-bot commented on pull request rodin/review-bot#61 2026-05-11 02:44:42 +00:00
feat: load personas from target repo .review-bot/personas/

[NIT] Minor style nit: the struct literal in TestParsePersonaBytes has extra blank lines in field alignment (name, data, source, wantName, wantErr). This doesn't affect correctness but is inconsistent with Go's gofmt style.

sonnet-review-bot commented on pull request rodin/review-bot#61 2026-05-11 02:44:42 +00:00
feat: load personas from target repo .review-bot/personas/

[MINOR] isNotFoundError uses string-substring matching on error messages (strings.Contains(err.Error(), "HTTP 404")). This is fragile and couples the review package to the specific error format produced by the gitea package. A more robust approach would be to define a sentinel error type (e.g., ErrNotFound) in the gitea package and use errors.Is here, or to have the GiteaClient interface return a typed error. The current approach is documented and tested, so it's functional, but it's a design smell.

sonnet-review-bot commented on pull request rodin/review-bot#61 2026-05-11 02:44:42 +00:00
feat: load personas from target repo .review-bot/personas/

[NIT] MergePersonas is defined but not used in main.go — the main flow loads repo personas and then falls back to built-in individually, rather than merging all of them first. MergePersonas is a useful utility and is tested, but consider whether it should be used in main (load all built-ins + all repo personas into a merged map, then look up) for consistency and simplicity. As-is, the main flow only fetches repo personas on every invocation when --persona is specified, even though the built-in fallback path doesn't benefit from pre-loading all built-ins.

sonnet-review-bot commented on pull request rodin/review-bot#61 2026-05-11 02:44:42 +00:00
feat: load personas from target repo .review-bot/personas/

[MINOR] When LoadRepoPersonas returns an error, repoPersonas is nil. The comment correctly notes that map indexing on a nil map is safe in Go (returns zero value). However, err from LoadRepoPersonas is shadowed — the outer var persona *review.Persona block has no err declaration, so the err used in persona, err = review.LoadBuiltinPersona(...) on ~line 196 is an undeclared variable in the else branch. Check that the err variable is properly scoped here — it may need a short variable declaration (:=) in the else branch.