zjncs opened a new pull request, #5667:
URL: https://github.com/apache/rocketmq-dashboard/pull/5667

   ### Problem
   
   `AiEventSink` — the single writer of one run's timeline, the class the whole 
seq scheme rests on (per its own design docs) — had **no test**.
   
   ### Change
   
   Add `AiEventSinkTest` with fourteen tests pinning:
   
   | Contract group | Pinned behaviour |
   | --- | --- |
   | seq allocation | seeded from `MAX(seq)` — first row lands on `seed+1`; 
contiguous across writes; negative seeds clamp at zero |
   | buffered writes | a text delta is **live-only** (seq 0 on the wire, 
nothing persisted, projector holds it pending); the next durability boundary 
flushes the buffer **ahead of itself** so persisted order is arrival order |
   | last_seq cache | refreshes only when the high-water mark moves — one 
update per move |
   | close() | flushes the buffer, idempotent, and a closed sink refuses 
further writes without touching the repository |
   | failure discipline | a generic persistence failure is logged and swallowed 
(run continues at the allocated seq) while **`DuplicateKeyException` escapes** 
— the unique key is the backstop for a wrongly seeded allocator; a failing live 
publisher and a failing cache refresh never fail the write |
   | emitError | publishes the live twin at the persisted seq |
   
   ### Verification
   
   - New tests: **14/14 green** against unmodified code.
   - Discriminating mutations on `AiEventSink` (build result verified): 
`DuplicateKeyException` swallowed like any other failure (**red**); close skips 
the buffer flush (**red**); closed sinks no longer refuse writes (**red**); 
negative seeds no longer clamped (**red**).
   - Restored: 14/14 green. No product code changed.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to