Fan-out integration + fixes found by the test/acceptance pass: - FIX ring-buffer: chunks >= capacity skipped bytes now count into the monotonic offset (invariant: stream byte k lives at k % capacity) — window order was corrupted on unaligned big chunks - FIX auth: non-numeric cookie expiry no longer bypasses expiration - FIX protocol: safe-integer validation on ack.bytes / hello.protocol - FIX @fastify/websocket v11: websocket route must be registered in an encapsulated context after plugin load (handler got REST signature) - FIX flow-control deadlock found by e2e acceptance: client only ACKs on data receipt, so pausing with an unACKed residue in (LOW, ACK_EVERY] stalled both sides at 0.9 MB. ACK_EVERY now 64 KiB (<= LOW invariant, tested) + trailing debounced ACK in the web client - Web: Vue 3 + Vite + Pinia + Tailwind 4 + vue-i18n (EN/FR) + xterm 6 (fit + webgl fallback), multiplexed ws-client with reconnect/backoff and resync epochs - Tests: 100 vitest (protocol fuzz, ring edges, auth, pty-manager flow control with mocked pty, REST e2e) ; CI Node 22/24 + pack-smoke - scripts/acceptance-p1.mjs: real daemon + real WS client — boot, login, attach, stdin, 10 MB flood w/ ACK (13.7 MB/1.9s, RSS bounded), brutal disconnect + replay resync, kill broadcast, SIGTERM drain
22 lines
974 B
TypeScript
22 lines
974 B
TypeScript
import { describe, expect, it } from 'vitest';
|
|
import { FLOW, REPLAY_TAIL_BYTES } from '../src/index.js';
|
|
|
|
describe('invariants du flow control', () => {
|
|
// Le client n'ACK qu'à réception de données : si le serveur pouvait se mettre
|
|
// en pause avec un reliquat non-ACKé > LOW mais < pas d'ACK, plus rien ne
|
|
// progresserait (deadlock observé en acceptation P1 avec ACK_EVERY = 256 Kio).
|
|
it('ACK_EVERY_BYTES <= LOW_WATERMARK (anti-deadlock)', () => {
|
|
expect(FLOW.ACK_EVERY_BYTES).toBeLessThanOrEqual(FLOW.LOW_WATERMARK);
|
|
});
|
|
|
|
it('LOW < HIGH < LAGGING, tous strictement positifs', () => {
|
|
expect(FLOW.LOW_WATERMARK).toBeGreaterThan(0);
|
|
expect(FLOW.HIGH_WATERMARK).toBeGreaterThan(FLOW.LOW_WATERMARK);
|
|
expect(FLOW.LAGGING_BYTES).toBeGreaterThan(FLOW.HIGH_WATERMARK);
|
|
});
|
|
|
|
it('le replay tient dans la fenêtre lagging (resync ne re-déclenche pas lagging)', () => {
|
|
expect(REPLAY_TAIL_BYTES).toBeLessThan(FLOW.LAGGING_BYTES);
|
|
});
|
|
});
|