Repository navigation
fix(azure): error instead of truncating silently at the pricing page cap - #2074
Conversation
…emaining pricing.FetchAll stopped after maxPages and returned the pages read so far with a nil error, so every Azure GetOfferingDetails consumer read a truncated price list as a complete one and reported a meter as absent when it was on a later page. The self-referential-link guard in the same loop already errors; the cap now does too. The cap stays at 50. Measured on 2026-09-08 the API pages at about 1,000 items, so 50 pages is roughly 50,000; the largest filter any client issues fits in one page and the whole VM catalogue for one region is 16. The DefaultMaxPages comment claimed 100 items per page; corrected. Closes #1963 Co-Authored-By: claude-flow <ruv@ruv.net> Claude-Session: https://claude.ai/code/session_01Fu9uWjxtDFx5HDKeMRt1jC
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (6)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughAzure pricing pagination now returns an error instead of silently returning truncated results when ChangesAzure pricing pagination
Priority: ➖ Normal — Impact reflects medium issue severity. Estimated code review effort: 2 (Simple) | ~10 minutes Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to Azure pricing retrieval now reports incomplete results at the pagination cap rather than silently using truncated data, while complete results exactly at the cap continue to succeed. The boundary behavior is covered and no current merge-blocking risk remains. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
What
Closes #1963.
pricing.FetchAllwalked the Azure Retail Prices API, stopped at its page cap, and returned the pages collected so far with a nil error, so every caller read a truncated price list as a complete one. The self-referential-link guard nine lines above already returned an explicit error for its failure mode; the cap did not. It now does.This is a latent-defect fix, and the PR should say so
No filter the code issues reaches page two of the API today, and
GetOfferingDetails, which every affected call site sits under, has no in-repo production caller. So no user-facing behaviour changes. What changes is that hitting the cap becomes an error instead of a silent truncation, which matters the moment either of those facts stops being true.The cap stays at 50, and the comment was wrong
The constant's comment claimed the API pages at 100 items. Measured live on 2026-09-08 against api-version
2023-01-01-preview, it pages at roughly 1,000, so the cap is about 50,000 items rather than 5,000.Nothing the code issues reaches page two, and the widest plausible shape is 16 pages against a 50-page cap. The cap stays as the runaway-chain defence it was meant to be, the comment is corrected, and the fix is the error alone rather than a number pulled from nowhere.
Verification
The regression test scripts a paginated response that still carries a page link when the cap is reached. It fails on the base commit with
An error is expected but got niland passes after, under-race.TestFetchAll_ExactlyMaxPagesSucceedsis a positive control, not evidence of the fix: a chain filling exactly the cap with no further link must still succeed, and it passes both before and after. It scripts a 3-page chain against a cap of 3, so it exercises the boundary itself rather than a page short of it.An independent reviewer ran six mutants of the fix and every one was killed, including an off-by-one on the page count, an inverted condition, a check against the wrong variable, and returning the partial slice alongside the error.
go test -count=1 -race ./...inproviders/azurego vet ./...,gofmt -lgocyclo -over 10on the touched fileFetchAll6 to 7)go build ./...from the rootNo live reproduction is possible, since no real query reaches the cap. The scripted-server unit test is the scenario.
Scope
Four service-client doc comments described the cap as a silent stop and are corrected. Those hunks are comment-only. Nothing else is touched.
Noted while reviewing, not fixed here
providers/azure/services/managedredis/client.go:355-357falls through toupfrontCost = totalCoston an unknown payment option, where the other six clients fail loud. Pre-existing and out of scope for this PR; filed separately.Summary by CodeRabbit
Bug Fixes
Documentation