test(messaging): wait for the applied callback counter in the dev end-to-end check

Abierto Apto para principiantes
#2,916 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
88/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
docker, postgresql, rust, shell
Área
backend, testing

Línea de trabajo

Lee products/messaging/scripts/test-dev.sh y encuentra dónde comprueba la métrica messaging_provider_callbacks_total{outcome="applied"} después de esperar al estado del SMS. Consulta la métrica periódicamente dentro de la espera acotada existente, mantén el recuento esperado en 1 e informa del último valor si se agota el tiempo de espera. Ejecuta el script con Docker y luego compruébalo con ShellCheck y shfmt -d; estará listo cuando la comprobación espere al contador y siga rechazando los callbacks duplicados.

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

Descripción

What fails

products/messaging/scripts/test-dev.sh can fail in the Messaging PostgreSQL runtime CI job with:

test-dev: GET /v1/messages/<sms>: status delivered
test-dev: GET /v1/messages/<email>: status submitted
test-dev: Mailpit holds 1 message
test-dev: 0 signed callbacks were applied, expected 1

It failed once on pull request #2913, in a run whose changes touch no Messaging code or script. The same job passed on the previous two runs.

Why

The script waits, with a bound, until the SMS reads delivered. It then reads messaging_provider_callbacks_total{outcome="applied"} once.

The runtime records that counter after the callback is handled. In crates/registry-messaging/src/callbacks.rs, the handler awaits receive_callback, which commits the status change, and then calls state.metrics.record_callback(outcome). A status read that lands between the commit and the counter update sees delivered while the counter is still 0. The single metrics read then fails the check.

The runtime behaviour is fine: the counter is eventually correct, and nothing reads it as a commit signal. The check is too strict about ordering.

Proposed change

Read the applied counter inside the same kind of bounded wait the script already uses for the message status. For example, poll $dev_metrics every 0.5 seconds until the applied count is 1 or settle_seconds passes, then fail with the last value read.

Keep the exact expectation of 1, so a duplicate callback still fails the check.

Verification

  • products/messaging/scripts/test-dev.sh passes locally with Docker.
  • ShellCheck and shfmt -d are clean on the script.
  • Optional: inject a short delay before record_callback in a local build and confirm that the check waits rather than fails.
Lenguaje dominante
Rust
Estrellas
2
Forks
0
Merge medio
13 h 7 min
PR fusionados (30 d)
119

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 registrystack/registry-stack

Todos los issues de registrystack/registry-stack

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.