Elffuss BraidHub

utopia-ia/elffuss-code public

Test that a stopped task stays out of the speed panel's resolution rate

On main, the velocímetro block in pump() records every task with
ok: !huboError. A stopped turn emits no 'error', so next to the per-turn
stop it would have counted as a resolved task. The resolution recorded in
pump() skips the record when the turn was stopped ('aborted' event or an
aborted signal): a task the person cut is neither resolved nor failed.

tests/stopqueue.mjs 2b stops one task and lets the next one finish: the
stored task count stays the same after the stop and grows by one after
the normal task. With the skip removed the check fails.
Changeset84c950805a61c2f771a8ea52718085b87ee931eb931cc22866e9e0969d69ca7e
AuthorKikoCis <kikocisneros@gmail.com> · 2026-10-10 18:33 +02:00
CommitterKikoCis <kikocisneros@gmail.com> · 2026-10-10 18:33 +02:00
Parentse0342697fef5

Browse the files at this changeset

1 file changed

modified tests/stopqueue.mjs +22 −0
@@ -129,6 +129,28 @@
129129 ok('2 · …y se contesta', r2.respuesta === 'respuesta a la segunda', JSON.stringify(r2.respuesta));
130130 ok('2 · la cola queda vacía', r2.cola === 0, `${r2.cola}`);
131131
132+// 2b. La tasa de resolución del velocímetro no cuenta una tarea parada (ni como
133+// resuelta ni como fallida); una normal sí.
134+const r2b = await p.evaluate(async () => {
135+ const conv = await import('/js/conversations.js');
136+ const cuantas = () => { try { return (JSON.parse(localStorage.getItem('elffuss.velocimetro.v1') || '{}').tareas || []).length; } catch { return -1; } };
137+ const antes = cuantas();
138+ const prov = window.__lento({ pasos: 40 });
139+ conv.setProvider(prov);
140+ const V = conv.create();
141+ conv.send(V.id, 'esta se para');
142+ await window.__hasta(() => prov.llamadas.length >= 1);
143+ conv.stopActive();
144+ await window.__hasta(() => !V.pumping);
145+ await window.__dormir(100);
146+ const trasParar = cuantas();
147+ conv.send(V.id, 'esta no');
148+ await window.__hasta(() => !V.pumping);
149+ await window.__dormir(100);
150+ return { antes, trasParar, trasNormal: cuantas() };
151+});
152+ok('2b · el velocímetro no apunta la tarea parada y sí la normal', r2b.antes >= 0 && r2b.antes < 59 && r2b.trasParar === r2b.antes && r2b.trasNormal === r2b.antes + 1, JSON.stringify(r2b));
153+
132154 // 3. Parar y recargar → la cola guardada está vacía y el mensaje no se repite
133155 const r3 = await p.evaluate(async () => {
134156 const conv = await import('/js/conversations.js');