Skip to content
Source
Sign inSign up
TanStack/schemas

Retry each Azure retail price page on 429 #692

Mergedtombeckenhammerged 1 commit intomain from691-azure-retail-price-list-retry-429-on-each-pagemerged by tombeckenham View on GitHub

tombeckenhamcommented

Each page of the Azure Retail Prices list is fetched with fetchWithRetry, so one 429 no longer fails the models poll.

A page that still fails after the attempt budget throws with its URL. tryDocs keeps the stored cards, the same as a hard failure did before.

Tests cover page 2 returning 429 once and then succeeding, and page 2 staying 429 until the attempt budget is spent.

Fixes #691

Summary by CodeRabbit

  • Bug Fixes
    • Azure pricing requests now retry temporary rate limits and server errors, allowing pricing to load when a later attempt succeeds.
    • If a pricing page still fails after retries, models remain listed and the pricing failure is reported. Existing stored pricing cards are retained.
    1. tombeckenham linked this to fix #691

    2. ⚠️ No Changeset found

      Latest commit: a30de4710295c2a9b77b19930936aac827521ac6

      Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

      This PR includes no changesets

      When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

      Click here to learn what changesets are, and how to add one.

      Click here if you're a maintainer who wants to add a changeset to this PR

    3. Explain Change →

      No actionable comments were generated in the recent review.

      Walkthrough

      Azure retail price pages now use per-page retries for HTTP 429 and 5xx responses. Tests verify that a one-time throttle succeeds and persistent throttling reports a failure after five attempts.

      Changes: Azure retail pricing

      Layer / File(s)Summary
      Retry each retail price page
      src/server/providers/azure-pricing.ts, src/server/providers/adapters/azure.ts
      fetchMeters now uses fetchWithRetry to request each page and parse its response as RetailPage. The adapter documentation describes the retry behavior and the failure after retries are exhausted.
      Verify retry outcomes
      src/server/providers/adapters/azure.test.ts
      Tests cover a one-time 429 followed by a successful retry and persistent throttling that leaves pricing unavailable and reports the five-attempt failure.

      Estimated code review effort: 2 (Simple) | ~12 minutes

      Change: Bug fix · Severity of issue fixed: Medium

      Possibly related PRs

      Merge Risk: Minimal · up to a30de

      Azure retail price pages now retry on 429 and 5xx responses, so brief throttling no longer fails the models poll right away. A page that still fails after the retry budget throws and the stored cards are kept. No merge-blocking risk was found.

      Pre-merge checks: Passed 4

      Check nameStatusExplanation
      Description CheckPassedCheck skipped - CodeRabbit’s high-level summary is enabled.
      Title checkPassedThe title "Retry each Azure retail price page on 429" matches the main change. fetchMeters now sends each Azure Retail Prices API page through fetchWithRetry, so a 429 on any page is retried. The PR o…
      Linked Issues checkPassedIssue #691 requires four coding changes: (1) each Azure Retail Prices page uses the shared fetchWithRetry; (2) 429/5xx retries with backoff and Retry-After honored up to 15s; (3) exhausted retries…
      Out of Scope Changes checkPassedAll changed files relate to #691.

      - src/server/providers/azure-pricing.ts: the fetchWithRetry switch in fetchMeters, the RetailPage type, and the explanatory comment. These implement the issu…
      Full details: Title check

      Explanation

      The title "Retry each Azure retail price page on 429" matches the main change. fetchMeters now sends each Azure Retail Prices API page through fetchWithRetry, so a 429 on any page is retried. The PR objectives describe the same change, and the tests cover a single 429 on page 2 and persistent 429s. The title is specific and short, and it is one sentence.

      Full details: Linked Issues check

      Explanation

      Issue #691 requires four coding changes: (1) each Azure Retail Prices page uses the shared fetchWithRetry; (2) 429/5xx retries with backoff and Retry-After honored up to 15s; (3) exhausted retries still throw with the URL and do not fall back silently; (4) a test where page 2 returns 429 once and then succeeds.

      Requirement (1) is met. In src/server/providers/azure-pricing.ts, fetchMeters replaces the plain fetchJson call with fetchWithRetry(url, () => ({}), parse) for every page. The fetchJson import is removed. The RetailPage interface types the parsed body.

      Requirements (2) and (3) depend on fetchWithRetry in src/server/providers/types.ts. That function is not changed by this PR. The issue describes its retry, Retry-After, and throw-with-URL behavior. The PR description states that a page failing after the attempt budget throws with its URL, and that tryDocs keeps stored cards. I did not re-read the fetchWithRetry body within the inspection limit. The behavior rests on the issue text and the PR description.

      Requirement (4) is met by the test changes in src/server/providers/adapters/azure.test.ts, per the change summary. The test makes page 2 return 429 once and then succeed, and checks that pricing is retained. A second test keeps page 2 at 429 for five attempts and checks that the models lack pricing and report a pricing-documentation failure.

      No coding requirement is unmet on the evidence reviewed.

      Full details: Out of Scope Changes check

      Explanation

      All changed files relate to #691.

      • src/server/providers/azure-pricing.ts: the fetchWithRetry switch in fetchMeters, the RetailPage type, and the explanatory comment. These implement the issue.
      • src/server/providers/adapters/azure.test.ts: the throttling stub and the two tests described in the issue. These cover the required test and the exhaustion case.
      • src/server/providers/adapters/azure.ts: a documentation update to listModels that states per-page 429/5xx retry and retained cards on failure. This documents the new behavior.

      No change unrelated to the issue was found in the summary.

      Finishing Touches

      Generate unit tests (beta)

      • Commit to this branch
      • Create a new PR
      • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

      Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

      Share

      Recent review info

      Run configuration

      • Source mode: Auto
      • Repository: Unavailable
      • Branch: Unavailable
      • File: No configuration file from this repository applied
      • Commit: Unavailable
      • Layers: defaults
      • Review profile: CHILL
      • Plan: Advanced
      • Run ID: 8ed09d8a-e158-499b-b812-c6d5932863af
      Commits

      Reviewing files that changed from the base of the PR and between 69c259b8606482ab01f69920e8dab19988e81cc8 and a30de4710295c2a9b77b19930936aac827521ac6.

      Files selected for processing: 3

      • src/server/providers/adapters/azure.test.ts
      • src/server/providers/adapters/azure.ts
      • src/server/providers/azure-pricing.ts

      Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

    4. tombeckenham merged this72b9e02

    5. tombeckenham merged this72b9e02

    6. tombeckenham closed this

Sign in to join this conversation.