Sonnet Review Bot sonnet-review-bot
  • Joined on 2026-04-24
sonnet-review-bot commented on pull request rodin/review-bot#106 2026-05-13 15:02:31 +00:00
feat(cmd): wire --provider and --base-url flags into CLI (Phase 5)

[NIT] The seen[personaName] = true simplification (replacing the if !seen[personaName] guard) is correct because assigning true to an already-true map entry is idempotent. This is a valid cleanup, but the original pattern was arguably more explicit about intent. No functional issue.

sonnet-review-bot commented on pull request rodin/review-bot#106 2026-05-13 15:02:31 +00:00
feat(cmd): wire --provider and --base-url flags into CLI (Phase 5)

[MINOR] supersedeOldReviews uses a provider string parameter and a switch that ultimately does a type assertion (client.(*gitea.Adapter)) for the Gitea path. This leaks a concrete type from the gitea package into what is otherwise a provider-agnostic function, and creates a tight coupling that will silently break if the adapter is ever wrapped (as the comment acknowledges). A cleaner design would be an optional interface (e.g., vcs.OldReviewSuperseder) that the Gitea adapter implements, similar to how ReviewerSelfRequester was handled, eliminating both the string switch and the type assertion.

sonnet-review-bot commented on pull request rodin/review-bot#106 2026-05-13 15:02:31 +00:00
feat(cmd): wire --provider and --base-url flags into CLI (Phase 5)

[MINOR] The client variable is declared as var client vcs.Client then assigned inside a switch with no default case. Since the provider switch was already validated a few lines above (exiting on invalid values), the compiler cannot see this — it will not warn if the two switches ever diverge. A default: panic(...) or at minimum a comment noting why the default is unreachable would make the invariant explicit and guard against future edits that add a provider to the validation switch but forget to add it to the initialization switch.

sonnet-review-bot commented on pull request rodin/review-bot#106 2026-05-13 14:46:18 +00:00
feat(cmd): wire --provider and --base-url flags into CLI (Phase 5)

[NIT] The type assertion client.(*gitea.Adapter) for the self-reviewer path is necessary but creates a direct dependency on a concrete type inside main. The comment explaining this is good. Consider whether RequestReviewer belongs on a provider-specific optional interface (similar to the http.Flusher optional interface pattern) for cleaner future extensibility — e.g., type SelfReviewer interface { RequestReviewerSelf(ctx, owner, repo string, pr int, user string) error }. Not blocking, just worth noting for the next phase.

sonnet-review-bot commented on pull request rodin/review-bot#106 2026-05-13 14:46:18 +00:00
feat(cmd): wire --provider and --base-url flags into CLI (Phase 5)

[NIT] The envOrDefaultBool function is defined and tested but never called in main.go (no usages in the diff or full file). It may be used elsewhere or kept for future use, but if unused it could be removed to keep the package clean.

sonnet-review-bot commented on pull request rodin/review-bot#106 2026-05-13 14:46:18 +00:00
feat(cmd): wire --provider and --base-url flags into CLI (Phase 5)

[MINOR] supersedeOldReviews has a vcsURL parameter that is documented as 'accepted unconditionally to keep the function signature uniform across providers' — but it is only used in the Gitea branch. While the comment explains the reasoning, this creates a leaky abstraction: callers must always supply a Gitea-specific URL even for GitHub. A cleaner approach would be to pass the URL only when needed (e.g. via a config struct or only for the Gitea case), or accept that the function is not truly provider-agnostic and name/document it accordingly. This is a minor design issue that could cause confusion for future maintainers.

sonnet-review-bot commented on pull request rodin/review-bot#106 2026-05-13 14:46:18 +00:00
feat(cmd): wire --provider and --base-url flags into CLI (Phase 5)

[MINOR] The default case in the supersedeOldReviews switch returns fmt.Errorf("supersedeOldReviews: unsupported provider %q", provider), but provider is already validated to be only "gitea" or "github" before this function is called. This dead code branch is fine for safety, but since the function also requires provider to be passed as a string (rather than a typed enum), there's a risk of typo/drift. A typed vcs.Provider constant (string type with defined values) would be safer — but this is a pre-existing design issue, not introduced by this PR.

sonnet-review-bot commented on pull request rodin/review-bot#106 2026-05-13 14:30:36 +00:00
feat(cmd): wire --provider and --base-url flags into CLI (Phase 5)

[MINOR] The VCS client switch has no default branch — the var client vcs.Client will remain nil if a new provider is added to the validation switch without also adding a case here. Since validation already exits on unknown providers, this is safe today, but the two switches must stay in sync. A default: panic("unreachable") in the client-init switch would make this invariant explicit and catch future drift at test time.

sonnet-review-bot commented on pull request rodin/review-bot#106 2026-05-13 14:30:36 +00:00
feat(cmd): wire --provider and --base-url flags into CLI (Phase 5)

[MINOR] The Gitea-specific RequestReviewer self-request uses a type assertion client.(*gitea.Adapter) to detect provider rather than checking *provider == "gitea". Both approaches work, but using the string flag is more consistent with how the rest of the code (e.g., supersedeOldReviews) already branches on provider. The type-assertion approach is also slightly fragile — if gitea.Adapter is ever wrapped in a decorator (as the comment in supersedeOldReviews also notes), this silently stops working.

sonnet-review-bot commented on pull request rodin/review-bot#106 2026-05-13 14:30:36 +00:00
feat(cmd): wire --provider and --base-url flags into CLI (Phase 5)

[NIT] The envOrDefaultBool function is defined and tested but never used in main.go after this refactor. It was presumably used before and left as dead code. Consider removing it to keep the file clean.

sonnet-review-bot commented on pull request rodin/review-bot#106 2026-05-13 14:30:36 +00:00
feat(cmd): wire --provider and --base-url flags into CLI (Phase 5)

[NIT] TestBuildPatternPaths duplicates the path-building logic from fetchPatterns inline rather than exercising the real function. This tests a copy of the logic, not the actual implementation. If fetchPatterns is ever refactored, this test could pass while the real code breaks. Consider extracting the path-building logic into a helper function in main.go and testing that directly, or restructuring fetchPatterns to be testable.

sonnet-review-bot commented on pull request rodin/review-bot#106 2026-05-13 14:15:32 +00:00
feat(cmd): wire --provider and --base-url flags into CLI (Phase 5)

[NIT] There is a spurious blank line before the closing brace of doRequestWithBody (after return c.doRequestCore(...)). Minor formatting issue that gofmt would not flag since it's inside a function body, but it's visually inconsistent.

sonnet-review-bot commented on pull request rodin/review-bot#106 2026-05-13 14:15:32 +00:00
feat(cmd): wire --provider and --base-url flags into CLI (Phase 5)

[NIT] The envOrDefaultBool function is declared and used in the file but does not appear to be called from main() in this diff — it may be leftover from a previous version. This is not a new issue introduced by this PR, just an observation.

sonnet-review-bot commented on pull request rodin/review-bot#106 2026-05-13 14:15:32 +00:00
feat(cmd): wire --provider and --base-url flags into CLI (Phase 5)

[MINOR] The supersedeOldReviews function's Gitea path does a client.(*gitea.Adapter) type assertion after already validating provider == "gitea" via a switch. The comment explains the !ok guard is for future-proofing against decorator wrappers. This is reasonable, but it means the abstraction boundary (vcs.Client) is broken for this function — it requires concrete knowledge of the gitea.Adapter type. A cleaner approach would be to add a SupersedeReview method to vcs.Client or define a narrower provider-specific interface. Not a bug in this PR, but worth noting as technical debt.

sonnet-review-bot commented on pull request rodin/review-bot#106 2026-05-13 14:15:32 +00:00
feat(cmd): wire --provider and --base-url flags into CLI (Phase 5)

[MINOR] supersedeOldReviews uses os.Exit(1) on error from the caller, but the function itself returns an error — this is correct and the caller handles it. However, the function signature accepts vcsURL unconditionally even for the GitHub path where it is unused. The comment explains this is intentional for API uniformity, which is acceptable, but it could be a source of confusion in future refactors. A more idiomatic approach might be to embed the URL into a Gitea-specific struct or pass it only to the Gitea path. This is a design nit, not a bug.

sonnet-review-bot commented on pull request rodin/review-bot#106 2026-05-13 13:49:35 +00:00
feat(cmd): wire --provider and --base-url flags into CLI (Phase 5)

[MINOR] The vcsURL flag captures the env-var-resolved default via a pointer dereference (*vcsURL) when registering the --gitea-url alias. The comment explains this, but the approach is subtle and fragile: if someone ever moves the flag.StringVar call before flag.String completes or wraps it in a helper, it silently uses the zero-value default. A simpler alternative would be to compute the default value once into a local variable (giteaURLDefault := envOrDefault(...)) and use it for both registrations, eliminating the ordering dependency entirely.