Skip to content

test(azure): pin exactly-cap pagination success in the cache, cosmosdb, database and synapse pagers - #502

Merged
cristim merged 1 commit into
mainfrom
test/249-azure-pager-exact-cap
Oct 17, 2026
Merged

cristim merged 1 commit into
mainfrom
test/249-azure-pager-exact-cap

Conversation

@cristim

@cristim cristim commented Oct 17, 2026

Copy link
Copy Markdown
Member

Summary

Test-only, item 2 of #249. The pagination cap tests for the Azure cache, cosmosdb, database and synapse pagers covered the endless-pager error and cancellation, but not the boundary success case: a listing of exactly the cap whose last page is partial and has no next link must succeed with every item.

One test per capped loop (6 loops):

  • cache fetchSKUCatalogue: returns all 2*(cap-1)+1 SKUs (distinct capacities, so dedupe cannot hide a lost page);
  • cosmosdb: the only account sits on the last page and is found;
  • database: the managed-instance walk counts 2*(cap-1)+1 with complete true; the servers walk finds the server on the last page;
  • synapse: recommendations (both variants) and reservations return 2*(cap-1)+1 items.

Each case also asserts the exact page-call count.

Refs #249. Item 1 (fetchSKUCatalogue degrading silently to zero shards on the cap, a fetch error or cancel) is a degrade-vs-error decision and stays open.

Evidence

Probes (temporary edits to each client.go, reverted):

  • >= to > on the cap check: caught by the existing *PageCap* tests (they assert calls == cap) in all 6 loops;
  • >= max to >= max-1: caught by both the existing *PageCap* test and the new exactly-cap test in all 6 loops.

make build, make vet, (cd providers/azure && GOWORK=off go test -race -short ./services/{cache,cosmosdb,database,synapse}/...) (730 passed), pinned golangci-lint v2.10.1 (0 issues), gofmt, and the commit/pre-push hooks pass. The diff touches only the four test files; no open PR edits them.

Local review: non-author review of the diff, no findings.

🤖 Generated with Claude Code

@cristim cristim added impact/internal Team-internal only type/chore Maintenance / non-user-visible priority/p3 Polish / idea / may never ship severity/low Minor harm urgency/eventually No deadline effort/s Hours triaged Item has been triaged labels Oct 17, 2026
@cristim

cristim commented Oct 17, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

  • Run on-demand review

This review includes 4 billable files and costs up to $1.00.

  • Ask an admin to make reviews automatic

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Or wait 6 minutes for your next included review.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 72 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository: LeanerCloud/cloud-commitments-go/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: f99481e4-35f3-4269-99b4-ab7c059dc2de
📥 Commits

Reviewing files that changed from the base of the PR and between 5910502 and c562ecc.

📒 Files selected for processing: 4
  • providers/azure/services/cache/pagination_cap_test.go
  • providers/azure/services/cosmosdb/pagination_cap_test.go
  • providers/azure/services/database/pagination_cap_test.go
  • providers/azure/services/synapse/pagination_cap_test.go
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@coderabbitai

coderabbitai Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@cristim

cristim commented Oct 17, 2026

Copy link
Copy Markdown
Member Author

Independent review verdict: CLEAN at 9e396a1

Reviewer: fresh Claude agent (Sonnet, high effort), not the author, cold brief. Coordinator: claude-cc-reviewer.

Blocking findings: none. This is test-only. Each test drives the real production pager through the client's injected-pager setter. The fake serves exactly cap pages, and the test asserts success, all items returned and calls == cap.

Service Function under test Cap
cache fetchSKUCatalogue → collectSKUsFromCaches (client.go ~:491) maxCachesPages = 20
cosmosdb fetchDominantAPIType → collectCapabilitiesFromAccounts maxAccountsPages = 20
database walkManagedInstances, hasRegularServers maxSQLListPages = 20
synapse GetRecommendations / GetExistingCommitments maxRecsPages = 10 / maxReservationsPages = 50

The cap+1 case is already covered by the existing endless-pager tests.

What was attacked and how:

  • Mutation: pageIdx >= cap changed to >= cap-1 in all four services fails the new ExactlyCap tests in each, plus the existing endless-pager tests. All files were restored.
  • go vet ./services/... is clean, and go test -race -count=1 ./services/... passes 10 packages.

Gate: p3. Merge once CI is green. (claude-cc-reviewer)

…b, database and synapse pagers

Each capped loop now has a case where the pager serves exactly the cap
number of pages, the last one partial with no next link. The case asserts
success, the full item count and the exact page-call count, so an
off-by-one that rejects the final allowed page fails.

Refs #249 (item 1, the cache catalogue degrade-vs-error decision, remains)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cristim
cristim force-pushed the test/249-azure-pager-exact-cap branch from 9e396a1 to c562ecc Compare October 17, 2026 03:07
@cristim

cristim commented Oct 17, 2026

Copy link
Copy Markdown
Member Author

Pure rebase onto main after go#500 merged. git range-diff of 9e396a1 against new head c562ecc shows the commit identical (=), so the CLEAN verdict carries. (claude-cc-reviewer)

@cristim
cristim merged commit 1c19492 into main Oct 17, 2026
15 checks passed
@cristim
cristim deleted the test/249-azure-pager-exact-cap branch October 17, 2026 03:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/s Hours impact/internal Team-internal only priority/p3 Polish / idea / may never ship severity/low Minor harm triaged Item has been triaged type/chore Maintenance / non-user-visible urgency/eventually No deadline

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant