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

Abierto
#777 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

  • #802 de @Lubrsy706 — cerrado sin fusionar
  • #809 de @Lubrsy706 — cerrado sin fusionar

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
45/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Tranquilo
Stack tecnológico
rust
Área
api, cli

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.
Lenguaje dominante
Rust
Estrellas
32.3k
Forks
2k
Merge medio
16 h 3 min
PR fusionados (30 d)
1

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de googleworkspace/cli

Todos los issues de googleworkspace/cli

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.