mirror of
https://github.com/purrgrammer/grimoire.git
synced 2026-04-09 15:07:10 +02:00
ce3a4a7322f35e2e14c05860d49053dac7e4849c
Critical Edge Case Fix: Previously, when all relays disconnected before sending EOSE, the state remained stuck in LOADING because overallEoseReceived stayed false. Solution: Check if all relays are in terminal states - Terminal states: eose, error, or disconnected - If all terminal AND no overall EOSE yet, derive state from events: * No events → FAILED * Has events, all disconnected, streaming → OFFLINE * Has events, all disconnected, non-streaming → CLOSED * Some active, some terminal → PARTIAL New Test Coverage (5 tests): 1. All relays disconnect before EOSE, no events → FAILED 2. All relays disconnect before EOSE, with events (streaming) → OFFLINE 3. All relays disconnect before EOSE, with events (non-streaming) → CLOSED 4. Some EOSE, others disconnect before EOSE → PARTIAL 5. Mix of EOSE and errors, all terminal → PARTIAL This fixes the user-reported issue where disconnected relays show LOADING instead of transitioning to appropriate terminal state. Tests: 639/639 passing (added 5 new edge case tests)
Languages
TypeScript
98.9%
CSS
0.8%
JavaScript
0.3%