Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

test: dequeue expiry contract test fails on slow Postgres

Cerrado Apto para principiantes
#997 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Ya se ha fusionado un pull request relacionado.

  • #1022 de @stromanni — fusionado

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
84/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
postgresql, rust

Línea de trabajo

Comienza con crates/flexiq-core/tests/rust/storage_tests.rs, especialmente con test_dequeue_reports_expired_jobs y la segunda llamada a dequeue_from_reporting; revisa postgres/jobs.rs::scan_dequeue_candidates y ejecuta el comando cargo test proporcionado contra Postgres alojado. La tarea está completada cuando la prueba de contrato pasa de forma fiable con Postgres lento y se alcanzan las pruebas de storage registradas posteriormente.

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

Descripción

postgres_storage_tests fails deterministically against a hosted Postgres (Neon, both the pooled and the direct endpoint), on master as well as on feature branches:

panicked at crates/flexiq-core/tests/rust/storage_tests.rs:204:5:
assertion `left == right` failed
  left: None
 right: Some("<live job id>")

The failing assertion is in test_dequeue_reports_expired_jobs, on the second half, the single-job dequeue_from_reporting call. The first half, the batch dequeue, passes.

Likely cause: the test, not the dequeue

The test reads now = now_millis() once at its start and dequeues at now + 1_000 in both halves. Each enqueued job's scheduled_at is the wall clock at the time it was enqueued, and the Postgres candidate scan (postgres/jobs.rs::scan_dequeue_candidates) keeps only scheduled_at <= now.

A hosted database adds a few hundred milliseconds per round trip. By the time the second pair of jobs is enqueued, more than a second has passed since now was read. Their scheduled_at is therefore later than now + 1_000, the scan returns no candidates, and the claim comes back None. A CI Postgres container answers fast enough that the window never closes, which is why CI stays green.

Why it matters

run_storage_tests stops at this panic. Every contract test registered after test_dequeue_reports_expired_jobs never runs against a hosted Postgres, so a regression in any of them goes unseen locally.

Suggested fix

Take a fresh now_millis() for each half, or pass now_millis() + 1_000 at the dequeue call itself. That keeps expires_at in the past and scheduled_at in the past relative to the dequeue time, however slow the backend is. Other tests that capture now once and dequeue later may share the pattern and are worth checking.

Repro

FLEXIQ_POSTGRES_TEST_URL=<hosted postgres url> \
  cargo test -j1 -p flexiq-core --features postgres --test rust -- postgres
Lenguaje dominante
Rust
Estrellas
20
Forks
2
Merge medio
7 h 19 min
PR fusionados (30 d)
89

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 ByteVeda/flexiq

Todos los issues de ByteVeda/flexiq

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.