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

prune_kv_values_updated_before emits actions in HashMap order; replay fails with `kv clear mismatch`

Abierto
#57 1 comentario 0 reacciones 0 asignados Ver en GitHub

@akhil9tiet ya está trabajando en esto.

Desde el 4/10/2026.

  • #62 de @akhil9tiet — abierto

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
25/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Estancado
Stack tecnológico
node.js, rust

Línea de trabajo

Start in src/lib.rs at prune_kv_values_updated_before (around lines 3411-3427), then inspect get_kv_all_keys around lines 3360-3362 and the kv_metadata declaration around line 1715. Reproduce the Node.js SDK scenario with multiple matching keys and verify that replay emits and consumes KV actions in a consistent order.

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

Descripción

bug

Summary

An orchestration that prunes two or more KV keys in one turn fails on a later replay with nondeterministic: kv clear mismatch. The orchestration code is deterministic. The order of the actions that the runtime emits is not.

Where

A HashMap has a random seed per map. So the iteration order differs between two replays of the same turn, also inside one process.

How it fails

  1. Execution 1 writes the keys a to f and continues as new.
  2. Execution 2 calls prune_kv_values_updated_before(cutoff). All six keys match. The turn records six KeyValueCleared events in some order.
  3. A later turn replays the same code. The six ClearKeyValue actions come out in a different order.
  4. The replay engine compares the first action with the first event, finds another key, and fails the orchestration.

Reproduction

Reproduced with duroxide 0.1.30 on SQLite, through the Node.js SDK:

runtime.registerOrchestration('Prune', function* (ctx, input) {
  if (!input || !input.second) {
    for (const k of ['a', 'b', 'c', 'd', 'e', 'f']) ctx.setValue(k, 'x');
    yield ctx.continueAsNew({ second: true });
    return '';
  }
  const now = yield ctx.utcNow();
  const pruned = ctx.pruneKvValuesUpdatedBefore(now + 60_000); // clears all six keys
  yield ctx.utcNow();
  yield ctx.utcNow();
  return `pruned ${pruned}`;
});

6 of 6 instances failed, for example with:

nondeterministic: kv clear mismatch: action=ClearKeyValue { key: "d" } vs event=KeyValueCleared { key: "a" }

Impact

  • An orchestration that calls prune_kv_values_updated_before with more than one matching key can fail for good. With n keys, two replays agree on the order with a chance of 1 in n!.
  • get_kv_all_keys and get_kv_all_values hand the same random order to orchestration code. Code that loops over the result and schedules work per key is nondeterministic for the same reason.

Suggested fix

  • Sort the keys in prune_kv_values_updated_before before the actions are emitted.
  • Return sorted keys from get_kv_all_keys, or keep the KV state in a BTreeMap.

Tracked in #55.

Lenguaje dominante
Rust
Estrellas
221
Forks
61
Merge medio
3 d 5 h
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 microsoft/duroxide

Todos los issues de microsoft/duroxide

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.