Fix QA nits from PR #8: error unwrapping, dead code, nil guard #10
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Type
Bug
What Broke
QA review of PR #8 (integration tests) found 5 non-blocking nits. Merged as-is to unblock progress; this ticket tracks the fixes.
Repro Steps
Expected Behavior
All nits resolved:
errors.Asinconsistency —dns_test.go: 404 checks afterretryOn429use direct type assertiongetErr.(*APIError)which won't match wrapped errors. Useerrors.Asconsistently (affectsTestAddAndDeleteRecordsandTestReplaceRecordsByType).dns_test.goTestReplaceRecordsByType:otherTXTvariable declared, populated via no-op, discarded. Remove or add TODO.dns_test.goTestReplaceAllRecords:append(existing, DNSRecord{...})may mutate backing array. Use copy pattern.domains_test.goTestGetDomain: accessesdomain.Domainwithout nil check.dns_test.goTestReplaceRecordsByType: only preserves@TXT records. Add comment documenting risk.Environment
Go test files in
pkg/godaddy/Lineage
Parent: none
Source: QA review of PR #8
Repo
godaddy-tofu
Acceptance Criteria
errors.Asinstead of direct type assertionotherTXTcode removed or marked TODOTestReplaceAllRecordsuses safe slice copy patternTestGetDomainhas nil guard before field accessTestReplaceRecordsByTypedocuments TXT preservation riskRelated
PR #8, issue #4
Scope Review -- Dottie
Reviewed the issue body against the actual source files at HEAD (
pkg/godaddy/dns_test.go,pkg/godaddy/domains_test.go,pkg/godaddy/client.go).1. Scope clarity and actionability
All 5 nits reference specific files (
dns_test.go,domains_test.go) and specific functions. File targets are correct -- both files exist inpkg/godaddy/. A dev agent can pick this up without additional context.2. Nit-by-nit verification
errors.AsinconsistencyTestAddAndDeleteRecordslines 92/97 andTestReplaceRecordsByTypeline 158 usegetErr.(*APIError)/err.(*APIError)direct assertions. Currently these work becauseclient.goreturns*APIErrorunwrapped, buterrors.Asis forward-compatible. Two functions affected, 3 assertion sites total.otherTXTcodeTestReplaceRecordsByTypedeclaresotherTXT, runs a no-opretryOn429that sets it to nil, then discards it with_ = otherTXT. Clear dead code -- ~8 lines to remove.TestReplaceAllRecordsline 214:replacement := append(existing, ...)reusesexisting's backing array. Fix isreplacement := make([]DNSRecord, len(existing)); copy(replacement, existing); replacement = append(replacement, ...). Note: this test ist.Skip'd so the risk is latent, but the fix is still correct practice.TestGetDomaindomains_test.goline 47:domain.Domainaccessed without checkingdomain != nil. IfGetDomainreturns(nil, nil)this panics. Simpleif domain == nil { t.Fatal(...) }guard needed before field access.TestReplaceRecordsByTypeonly fetches@TXT records before the full-type replace. Any non-@TXT records (except the test name) would be silently deleted. The ask is just a comment documenting this risk -- appropriate for a test-only concern.3. Acceptance criteria assessment
All 5 acceptance criteria are testable:
grepfor direct*APIErrorassertions -- should be zero after fixgrepforotherTXT-- should be absentTestReplaceAllRecordsdomain == nilguard present beforedomain.DomainaccessTestReplaceRecordsByTypeabout TXT preservation limitation4. Missing items (minor)
nit,test,code-quality)Verdict: APPROVED
The scope is well-defined, all 5 nits are verified against the actual source, file targets are accurate, and acceptance criteria are testable. A dev agent can implement this without ambiguity.