Surface Retry-After header in error envelope for rate-limited responses

Ouverte
#777 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

  • #802 par @Lubrsy706 — fermée sans fusion
  • #809 par @Lubrsy706 — fermée sans fusion

Évaluation

Difficulté
4/5
Temps estimé
3-5 jours
Accessibilité débutants
45/100
Type d'issue
Fonctionnalité
Clarté
Plutôt claire
Activité
Calme
Stack technique
rust
Domaine
api, cli

Piste de recherche

No source file or test is named. Start by locating the gws HTTP error-envelope handling and existing tests for forwarded API errors; then determine where Retry-After is available and how error fields are serialized. Done means 429, rate-limit 403, 500, and 503 responses preserve the header as seconds-from-now, while responses without it remain unchanged.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

Feature request

When a Calendar API call returns a rate-limit response (HTTP 429, or 403 with reason rateLimitExceeded / userRateLimitExceeded), Google often returns a Retry-After response header indicating when the client may safely retry. Currently gws does not surface that header value to callers - the error JSON it forwards on stderr only carries Google's standard error envelope:

{"error":{"code":429,"message":"...","errors":[{"reason":"rateLimitExceeded"}]}}

Downstream tools that wrap gws for retry have no way to honor Retry-After and must fall back to a fixed exponential schedule.

Suggested shape

Add retry_after_seconds (or retryAfter - whatever fits gws conventions) to the error envelope when the response carried a Retry-After header. Empty/absent when the header was not present.

{"error":{"code":429,"message":"...","errors":[{"reason":"rateLimitExceeded"}],"retryAfterSeconds":17}}

Or, alternatively, a top-level sibling field outside error:

{"error":{...},"retryAfterSeconds":17}

The header can be either an integer number of seconds OR an HTTP-date; gws should normalize to seconds-from-now to keep downstream parsing simple.

This would also be useful for 500/503 responses, where Google sometimes returns Retry-After to throttle clients during incidents.

Notes

  • Header name in Google's responses is Retry-After. RFC 7231 §7.1.3.
  • Calendar API documents the header in their usage limits and rate-limiting docs.
  • No security or backwards-compat concern - this is purely additive to the error envelope.
Langage dominant
Rust
Étoiles
32.3k
Forks
2k
Merge moyen
16 h 3 min
PR mergées (30 j)
1

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de googleworkspace/cli

Toutes les issues de googleworkspace/cli

Issues similaires

Plus d'issues Rust

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.