Repository navigation
docs(azure): correct two retry comments that #1767 made false - #1792
Conversation
Comment-only. Both make exhaustiveness claims that stopped being true when #1767 added a second retry trigger, and both now describe the current rule. purchase_test.go said doPurchase's error text is "the ONLY input to IsSessionTimeout, and DoPurchaseTwoStep retries only when that predicate matches". Neither half holds: the loop also retries on errors.Is(err, errRetryabilityUnknown). CodeRabbit flagged this on #1767; the PR merged before the fix landed, so the claim is live on main. DoPurchaseTwoStep's own doc had the same defect and nobody flagged it. It said retry happens on a "Session timed out" 400 and that "Other 4xx/5xx errors are returned immediately without retry", which omits the second trigger entirely. Found by sweeping the whole #1767 diff for the same class rather than fixing only the line that was reported. It now enumerates both cases and states that everything else -- including a cleanly read 4xx and any 5xx -- returns without retry. Rather than past-tensing the old text, each comment leads with the current rule and keeps the pre-fix explanation marked as the reason the test exists. A reader who stops after the first paragraph should come away with something true. Exhaustiveness claims are what readers rely on to decide they need not check, so a stale one is worse than none: #1757 (a live CSRF hole) survived behind a parity claim that was not true, and #1764's getAccountScope godoc described the inverse of its behavior after a change. Refs #1767, #1766 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe PR updates ChangesAzure purchase retry documentation
Estimated code review effort: 1 (Trivial) | ~3 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
Merging. Comment-only correction to two retry claims that #1767 falsified. CodeRabbit caught one; the sweep found the one that mattered more, and CR did not flag it. The reported line was a test function preamble. I initially escalated it, then downgraded on the reasoning that stale prose sitting next to a correct authoritative statement is not misleading. That reasoning was right and I applied it to the wrong file. // Other 4xx/5xx errors are returned immediately without retry.That is production documentation a caller reads from outside the package to decide whether a failure will be retried — precisely the thing someone relies on to skip a check. After #1767 it omitted the second retry trigger entirely. The distinction that matters, and the rule taken from it: a stale comment blocks when something relies on it to skip a check. Security-control claims, godoc on a seam, a named test guarantee. Explanatory prose adjacent to a correct current statement does not. Three real defects here came from the first category — #1757's live CSRF vulnerability survived because a comment asserted parity that did not exist; #1764's godoc asserted the inverse of what its function returned; #1758's docstring named a backstop that can never fire. The sweep is what found it. The finding was described as a class rather than a line, so the whole #1767 diff was swept rather than the reported site patched. The rest of its exhaustiveness language was then verified against the code — "the only scenario #1766 reports", "there is no recheck between attempts", "Success is decided by the status code alone", "and to nothing else" — all true, with the sentinel confirmed attached at exactly one site. That verification is what separates a sweep from a spot check. Both comments lead with the current rule rather than past-tensing. CR's proposed diff was accurate but would have left the reader with history and no rule; someone who stops after the first paragraph should still come away with something true. The pre-fix explanation stays, marked as the reason the test exists. The lint set diff is 589 vs 589, zero on either side — byte-identical, which is what a comment-only change must produce and the check that proves it is comment-only. Gates: |
Comment-only follow-up to #1767, which merged (
d6e60f637) before these two fixes landed. No behavior change; the lint set diff is byte-identical tomain.What was wrong
Both comments make exhaustiveness claims that stopped being true when #1767 added a second retry trigger.
1.
purchase_test.go— flagged by CodeRabbit on #1767, unfixed at merge time:Neither half holds. The loop also retries on
errors.Is(err, errRetryabilityUnknown).2.
DoPurchaseTwoStep's own doc — nobody flagged this one:That omits the second trigger entirely, in the production doc a caller reads to decide whether a failure will be retried. Found by sweeping the whole #1767 diff for the same class rather than fixing only the reported line.
What they say now
Each leads with the current rule and keeps the pre-fix explanation marked as the reason the test exists, rather than past-tensing the old text into history. A reader who stops after the first paragraph should come away with something true.
DoPurchaseTwoStepnow enumerates both retry cases and states plainly that everything else — including a cleanly read 4xx and any 5xx — returns without retry.Why this is worth its own PR
Exhaustiveness claims are what readers rely on to decide they do not need to check, so a stale one is worse than no comment. In this repo that class has already cost real defects: #1757, a live CSRF hole, survived behind a parity claim that was not true, and #1764's
getAccountScopegodoc described the inverse of its behavior after a change.#1767 spent two review rounds removing an assertion that read as a guarantee it did not provide. Leaving comments that read as guarantees they no longer provide is the same defect in prose.
Gates
providers/azure: gofmt clean, build, vet,go test -race -count=1 ./...green. Root: build, vet,gocyclo -over 10 -ignore "_test\.go" .exit 0 empty,golangci-lintv2.10.1 exit 0 with a genuine0 issues.line (both asserted).providers/azurelint set diff vsmain: 589 vs 589, zero only-in-HEAD, zero only-in-BASE — byte-identical, as a comment-only change should be.Summary by CodeRabbit