fix(realtime): evict dedupe entries FIFO and store hashed fingerprints (Q-6.4-6)
A full dedupe window (2,048 IDs / 4 MiB) used to trigger a full DEDUPE_OVERFLOW recovery on every event past capacity, so a steady 3.4 events/s stream re-fetched snapshots and reconnected every window. The coordinator now drops the oldest entry (Map insertion order equals apply order) and keeps applying; a replay pushed out of the window still drops as STALE_EVENT through the sequence check. The design doc row and the maxDedupeBytes contract comment now say eviction instead of recovery. The semantic fingerprint is now a 16-char 64-bit FNV-1a hash of the canonical envelope instead of the canonical text itself (up to 64 KiB each). The canonical-size EVENT_TOO_LARGE check only bounded that stored text, so it goes too; the wire-size check stays. pruneDedupe stops at the first unexpired entry instead of scanning every entry. The old "recovers instead of evicting" coordinator test encoded the bug and is replaced by an eviction test. RED: the eviction test (got RECOVERED/DEDUPE_OVERFLOW) and a fixed-size fingerprint codec test (got 3326 vs 333 bytes) failed before the change. Added a TTL prune characterization test (passes before and after). Gates: architecture, types app/test, lint, adapter-inventory, test:unit, test:component pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
cc906f08b4
commit
bc17ed4bd7
@@ -618,7 +618,8 @@ stream + epoch별 `lastAppliedSequence`를 기준으로 처리한다.
|
||||
| `sequence == lastApplied + 1` | 순차 적용 |
|
||||
| `sequence > lastApplied + 1` | gap; delta 적용 중지, `RESYNC_REQUIRED` |
|
||||
| unknown `streamEpoch` | old/new epoch를 섞지 않고 registered snapshot 또는 session rebuild |
|
||||
| dedupe/queue ceiling 초과 | 임의 eviction 후 계속 적용하지 않고 registered recovery |
|
||||
| dedupe window 가득 참 | 가장 오래된 항목부터 제거(FIFO)하고 계속 적용. 창에서 밀려난 재전송은 `sequence <= lastApplied`로 drop |
|
||||
| queue ceiling 초과 | 임의 eviction 후 계속 적용하지 않고 registered recovery |
|
||||
| captured old runtime generation | late callback safe drop + aggregate diagnostic |
|
||||
| current connection의 `scopeBinding` mismatch | effect/sequence/cursor 0, freshness `UNKNOWN`, close + session revalidation + registered recovery |
|
||||
|
||||
|
||||
Reference in New Issue
Block a user