unbridled-41 commented on PR #5069:
URL:
https://github.com/apache/rocketmq-dashboard/pull/5069#issuecomment-5813353420
### Verification pass (evidence audit, 2026-09-24)
Fresh checkout of this branch (`git worktree add --detach /tmp/aud-a
fork/fix/ai-replay-drain-order`, empty `server/target`); every `file:line`
re-read against both the base `a562601d` and the branch; every command
re-executed there. The pre-fix claim was re-demonstrated by writing the base
content of the production file back with `git show a562601d:<path> > <path>`
(which does not touch the index) and keeping the new test.
**Citations — all hold**
| Claim | base `a562601d` | branch |
|---|---|---|
| the invariant the fix restores | `AgentStreamSession.java:57-62` — the
`Interleaving` bullet, verbatim "a frame cannot slip in between two replayed
rows and reorder the transcript" | unchanged |
| the defect | `:169-180` — state flip and buffer copy under `sendLock`,
`pending.forEach(...)` outside it | drains inside the block; only the lock
scope moved |
| the premise the test's hook relies on | `sendAgent` serialises at `:301`,
takes `sendLock` at `:308` | unchanged |
| the reachable path | `AiRunService.java:268-288` (`attach`: replay read →
watermark → `registry.attach` → `finishReplay`) | unchanged |
| why arrival order is the rendered order |
`web/src/pages/ai/render/blocks.ts:140-146` appends a `text_delta` to the
trailing text block | unchanged |
| the quoted failure location | — |
`AgentStreamSessionReplayOrderTest.java:89` is exactly
`assertThat(frames.get(1)).contains("replay-two")` |
**Pre-fix reproduction** (same checkout, command as written):
```
$ cd server && mvn -o test -Dtest=AgentStreamSessionReplayOrderTest
java.lang.AssertionError:
Expecting actual:
"{"type":"text_delta","content":"live-one"}"
to contain:
"replay-two"
at
…AgentStreamSessionReplayOrderTest.aFramePublishedDuringTheDrainShouldNotOvertakeTheBufferedFrames(AgentStreamSessionReplayOrderTest.java:89)
[ERROR] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0
```
**Post-fix** (production file restored): `Tests run: 1, Failures: 0, Errors:
0, Skipped: 0` — BUILD SUCCESS. Package run
`-Dtest='org.apache.rocketmq.studio.ops.ai.**.*Test'`: `Tests run: 924,
Failures: 0, Errors: 0, Skipped: 0`.
**Coverage of the changed behaviour.** The test asserts all three
consequences of getting the drain right: every buffered frame is still written
(`hasSize(3)`), in buffered order (`frames.get(0)`, `frames.get(1)`), and the
frame published during the drain is delivered *after* them (`frames.get(2)`) —
neither reordering nor a silently dropped frame passes. The adjacent properties
the fix could have broken are already pinned and still pass on the branch:
dedup of a frame buffered during a replay
(`AgentRunRegistryTest.aFrameBufferedDuringAReplayShouldStillBeDeduplicatedTest`)
and "live frame after replayed frame"
(`AgentRunRegistryTest.framesArrivingDuringAReplayShouldBeBufferedUntilTheReplayIsSentTest`).
Neither existing test can catch this defect: both publish the live frame
*before* `finishReplay()` in a single thread (no `Thread`/latch anywhere in
`AgentRunRegistryTest`), so no frame is ever published while the drain is
running — which is why the new test drives a two-frame
buffer and publishes from another thread mid-drain.
**Commit hygiene**: `git show --stat 83d280df` = the production file + the
new test, nothing else.
No description defect, no test gap and no code defect found in this pass;
nothing was added.
--
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]