Fix QA nits: DomainID type, io.ReadAll limit, url variable naming #7
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/qa-nits-pr5"
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
Three small fixes identified during QA review of PR #5.
Changes
pkg/godaddy/domains.go: ChangedDomain.DomainIDfield type fromfloat64toint64to match the swagger specpkg/godaddy/client.go: Wrappedio.ReadAll(resp.Body)withio.LimitReader(resp.Body, 1<<20)to cap error response reads at 1MBpkg/godaddy/domains.go: Renamed local variableurltoreqURLinListDomainsto avoid shadowing thenet/urlimport, matching the convention used inGetDomainTest Plan
go build ./...passesgo vet ./...passesReview Checklist
go build ./...passesgo vet ./...passesRelated Notes
None — straightforward type/safety/naming fixes.
Related
Closes #6
PR #7 Review
DOMAIN REVIEW
Stack: Go / OpenTofu provider / HTTP API client
Three targeted fixes to
pkg/godaddy/client.goandpkg/godaddy/domains.go. All changes are minimal, well-scoped, and match the stated acceptance criteria from issue #6. No new functionality introduced -- these are correctness and safety improvements to existing code.1.
io.LimitReaderwrapping (client.go:67)Good safety improvement. Without the limit, a malicious or buggy upstream API could return an unbounded error response body, causing OOM. Capping at 1MB (
1<<20) is a reasonable ceiling for error payloads. The discarded error fromio.ReadAllis acceptable here since it is only used for diagnostic messaging inAPIError.Message.2.
DomainIDtype change:float64->int64(domains.go:13)The PR body states this change "matches the swagger spec." This is technically inaccurate --
swagger_domains.jsondefinesdomainIdastype: number, format: double, which maps to Go'sfloat64. That said, domain IDs are semantically integers, andint64is practically safer: no floating-point equality surprises, safe as map keys, and no precision loss for large IDs. The change is defensible but the commit message / PR body should not claim swagger conformance.3.
url->reqURLrename (domains.go:37-40)Clean variable rename to avoid shadowing the
net/urlpackage import. Matches the convention already used inGetDomain. No functional change.BLOCKERS
None.
NITS
PR body accuracy (DomainID claim): The PR body says the
DomainIDchange is to "match the swagger spec." The swagger spec actually saysnumber/double(=float64). The change is still reasonable (IDs are integers in practice), but the stated rationale is wrong. Consider rewording to "use int64 for domain IDs since they are semantically integers, despite the swagger spec using number/double."Test Plan is thin: The test plan lists only
go buildandgo vet. Since this PR changes struct field types, a note confirming that existing tests (if any) still pass with the type change would strengthen the plan. Not blocking because the changes are trivial and no test files are modified.SOP COMPLIANCE
fix/qa-nits-pr5-- descriptive, though not strictly6-...format)Closes #6present in PR bodyPROCESS OBSERVATIONS
VERDICT: APPROVED