Sonnet Review Bot sonnet-review-bot
  • Joined on 2026-04-24
sonnet-review-bot commented on pull request rodin/review-bot#113 2026-05-13 18:45:29 +00:00
feat(github): add safeguards against accidental AllowInsecureHTTP use (#96)

[NIT] The alignment of struct literal fields in the return statement is inconsistent: allowInsecureHTTP: has extra spaces to align the colon with baseURL: and token:, but httpClient: is not similarly aligned. gofmt should handle this, but if the file was run through gofmt and this is what it produces, it's fine — just worth verifying the file is gofmt-clean.

sonnet-review-bot commented on pull request rodin/review-bot#113 2026-05-13 18:45:29 +00:00
feat(github): add safeguards against accidental AllowInsecureHTTP use (#96)

[MINOR] The env-gate silently ignores AllowInsecureHTTP (logs a warning but doesn't return an error) when REVIEW_BOT_ALLOW_INSECURE is absent. This is a deliberate design choice documented in the PR, but it's a subtle failure mode: a developer who calls AllowInsecureHTTP() expecting HTTP to work will instead get a 'refusing HTTP request' error from doRequest with no obvious connection to the silent warning at construction time. Returning an error from NewClient or panicking at construction time would make the misconfiguration immediately obvious. This is a design trade-off rather than a bug, but worth noting.

sonnet-review-bot commented on pull request rodin/review-bot#113 2026-05-13 18:36:00 +00:00
feat(github): add safeguards against accidental AllowInsecureHTTP use (#96)

[MINOR] The diff removes timer.Stop() from the case <-timer.C: branch. When the timer fires normally, the timer's goroutine is already done, but calling timer.Stop() after it fires is a no-op and not harmful — the original code was actually correct in calling it (the resource is already freed, but it's a safe call). The real concern is the missing call on the successful timer path: after <-timer.C fires, the GC will eventually collect the timer, but timer.Stop() on the fired case is idiomatic cleanup. This is extremely minor since a fired timer has no goroutine leak, only a small GC delay. Consider adding timer.Stop() back on both branches for explicitness, or using defer timer.Stop() before the select.

sonnet-review-bot commented on pull request rodin/review-bot#113 2026-05-13 18:36:00 +00:00
feat(github): add safeguards against accidental AllowInsecureHTTP use (#96)

[NIT] Double blank line before TestAllowInsecureHTTP_WithoutEnvVar_Rejected — minor inconsistency with the rest of the file's style.

sonnet-review-bot commented on pull request rodin/review-bot#113 2026-05-13 18:36:00 +00:00
feat(github): add safeguards against accidental AllowInsecureHTTP use (#96)

[NIT] Missing blank line between TestNoInsecureOption_RejectsHTTP and TestNoInsecureOption_RejectsUppercaseHTTP — minor formatting inconsistency compared to the rest of the file, but gofmt doesn't enforce blank lines between top-level declarations in the same way.

sonnet-review-bot commented on pull request rodin/review-bot#113 2026-05-13 18:25:10 +00:00
feat(github): add safeguards against accidental AllowInsecureHTTP use (#96)

[MINOR] clientConfig is an unexported helper struct that only exists to accumulate options before constructing the Client. The insecureIsTestBypass field is a boolean that flows only through NewClient's env-gate logic and is never stored on Client itself. This is fine, but the clientConfig type leaks the test/prod distinction up into the option application logic. An alternative would be two separate unexported option types (or a single exported sentinel constant), but the current approach is acceptable and idiomatic enough for a private config accumulator.

sonnet-review-bot commented on pull request rodin/review-bot#113 2026-05-13 18:25:10 +00:00
feat(github): add safeguards against accidental AllowInsecureHTTP use (#96)

[NIT] redactURL uses strings.IndexByte which is perfectly fine, but since the project already imports net/url, using url.Parse + clearing RawQuery would handle edge cases like fragment identifiers (#) and malformed URLs more robustly. Not a bug given the controlled usage context (internal URLs), just a note.

sonnet-review-bot commented on pull request rodin/review-bot#113 2026-05-13 18:25:10 +00:00
feat(github): add safeguards against accidental AllowInsecureHTTP use (#96)

[MINOR] The doc comment for AllowInsecureHTTP() says the option is 'silently ignored' but the very next sentence says 'a warning is logged'. These are contradictory — being warned in logs is not silent. The comment should say something like 'the option is ignored and a warning is logged via slog.Warn'.

sonnet-review-bot commented on pull request rodin/review-bot#113 2026-05-13 18:25:10 +00:00
feat(github): add safeguards against accidental AllowInsecureHTTP use (#96)

[MINOR] AllowInsecureHTTPForTest() is an exported function in the production package github. Per the export_test.go pattern (testing-advanced.md #11), test-only helpers that expose internals belong in an export_test.go file (package github, compiled only during tests), not in the main production code. As written, AllowInsecureHTTPForTest is callable by any consumer of the package, not just tests. This is a minor concern since the function is clearly named and documented, but it leaks a test helper into the public API surface.

sonnet-review-bot commented on pull request rodin/review-bot#113 2026-05-13 18:25:10 +00:00
feat(github): add safeguards against accidental AllowInsecureHTTP use (#96)

[NIT] TestAllowInsecureHTTPForTest_PermitsHTTP is functionally identical to TestDoRequest_Success (both create an httptest.NewServer, use AllowInsecureHTTPForTest, and check the body). While the duplication is harmless, consolidating or removing the redundant test would reduce noise.

sonnet-review-bot commented on pull request rodin/review-bot#113 2026-05-13 18:21:04 +00:00
feat(github): add safeguards against accidental AllowInsecureHTTP use (#96)

[NIT] hasHTTPSScheme is package-level but unexported and has a single caller. It's well-named and the allocation-avoidance justification is valid. Consider a brief comment noting it's case-insensitive for correctness (not just performance), since HTTP scheme comparison is case-insensitive per RFC 3986. The existing comment mentions performance but not the correctness motivation.

sonnet-review-bot commented on pull request rodin/review-bot#113 2026-05-13 18:21:04 +00:00
feat(github): add safeguards against accidental AllowInsecureHTTP use (#96)

[NIT] The three new TestDoRequest_RejectsHTTPWithToken* / TestDoRequest_AllowsHTTP* tests and the TestWithAllowInsecureHTTP_* tests each spin up a dedicated httptest.Server even when the server is never contacted (e.g., the 'rejects' tests). This is harmless but slightly wasteful. An alternative would be to test doGet directly against a static HTTP URL like "http://example.com/test" without a real server for rejection tests. Not a bug.

sonnet-review-bot commented on pull request rodin/review-bot#113 2026-05-13 18:21:04 +00:00
feat(github): add safeguards against accidental AllowInsecureHTTP use (#96)

[NIT] The doc comment on WithAllowInsecureHTTP says 'a warning is logged' when the env var is absent, but this is more precisely described as 'the option is silently ignored and a warning is emitted'. The current wording is slightly ambiguous about whether the option takes partial effect. Very minor — the comment in NewClient is accurate.

sonnet-review-bot commented on pull request rodin/review-bot#113 2026-05-13 18:10:59 +00:00
feat(github): add safeguards against accidental AllowInsecureHTTP use (#96)

[MINOR] The slog.Warn call for the 'option ignored' case concatenates strings at call time ("WithAllowInsecureHTTP option ignored: set "+envAllowInsecure+"=1 to enable"). This is a trivial allocation on an error path so it has no practical impact, but idiomatic slog usage would pass the env var name as a structured attribute rather than embedding it in the message string, e.g. slog.Warn("WithAllowInsecureHTTP option ignored", "hint", "set "+envAllowInsecure+"=1 to enable") or a literal string. This is purely stylistic.

sonnet-review-bot commented on pull request rodin/review-bot#113 2026-05-13 18:10:59 +00:00
feat(github): add safeguards against accidental AllowInsecureHTTP use (#96)

[MINOR] There is a double blank line between TestDoRequest_RejectsHTTPWithToken and TestDoRequest_RejectsHTTPWithToken_RedactsQueryParams. Similarly, there's a missing blank line before TestDoRequest_AllowsHTTPWithoutToken at line 556. These are minor formatting inconsistencies that gofmt would not catch (gofmt only enforces indentation, not blank lines between top-level declarations), but the repository style convention says 'Keep commits atomic and well-described' and the style pattern says one blank line between top-level declarations.

sonnet-review-bot commented on pull request rodin/review-bot#113 2026-05-13 18:10:59 +00:00
feat(github): add safeguards against accidental AllowInsecureHTTP use (#96)

[NIT] The testBypass field on clientConfig is an internal implementation detail that controls whether the env gate is bypassed. Since clientConfig is unexported and only accessible within the package, this is fine. However, the field comment // skip env gate (for tests only) could be strengthened to note that only WithAllowInsecureHTTPForTest (defined in export_test.go) should ever set this field, to make it clear no production code path should touch it.