zjncs opened a new pull request, #5738:
URL: https://github.com/apache/rocketmq-dashboard/pull/5738
### What
`AiEventCodec` — the one place a `TimelineEvent` becomes
`rmq_ai_event.payload` and back — had no test. This adds `AiEventCodecTest`
with 9 tests pinning the two rules whose violation is silent corruption.
### What is pinned
- **the type column is read out of the serialised payload**, not from a
second switch over the sealed hierarchy: every subtype writes its own
discriminator (`user`, `error`, `notice`), so the column and the payload can
never disagree, and a new subtype needs no codec change;
- an event that serialises **without a type discriminator is not persisted
at all** — a payload without the polymorphic handle cannot be read back;
- a serialisation failure is empty, not fatal — it must not fail the run
that produced it;
- **a row that cannot be decoded is skipped, never thrown** (an older build,
a payload truncated by a full disk): the timeline read serves a whole
conversation and one bad row is not a reason to fail all of it;
- null rows and blank payloads are empty;
- the round trip preserves the subtype and its fields.
### Verification
- New tests on unmodified code: **9/9 green**, checkstyle clean (`mvn test
-Dtest=AiEventCodecTest`).
- Discriminating mutations on `AiEventCodec`, build result verified red each
time:
1. the type column hardcoded instead of read from the payload — red (two
tests);
2. the read-side skip replaced with a rethrow — red;
3. the discriminator guard dropped so type-less payloads persist — red.
- Restored: 9/9 green. Test-only change; no product code touched.
--
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]