You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "zjncs (via GitHub)" <gi...@apache.org> on 2026/10/07 22:50:22 UTC

[PR] test(ai): pin the thinking source wire names and strict decode [rocketmq-dashboard]

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

   ### What
   
   `ThinkingSource` — the single field that keeps model reasoning apart from the prompt-enhancement rewrite — had no test. This adds `ThinkingSourceTest` with 6 tests.
   
   ### Why
   
   The enum's javadoc names the bug it exists to prevent: without a source, the UI coalesced both thinking streams into one block under a chain-of-thought heading — i.e. a prompt rewrite was presented to the user as model reasoning. The strict decode is the other half of that defense: an unknown wire name means the two sides drifted, and silently falling back to MODEL would reintroduce the bug.
   
   ### What is pinned
   
   - both wire names, `model` and `enhance`, lowercase;
   - both decode through `fromWireName`;
   - **an unknown wire name is rejected loudly** (`IllegalArgumentException`), never silently mapped;
   - the match is **case-sensitive**: `Model` and `ENHANCE` are drifts, not synonyms;
   - Jackson serialises the lowercase wire name in both directions (`@JsonValue`/`@JsonCreator`) and rejects an unknown one.
   
   ### Verification
   
   - New tests on unmodified code: **6/6 green** (`mvn test -Dtest=ThinkingSourceTest`).
   - Discriminating mutations on `ThinkingSource`, build result verified red each time:
     1. the `model` wire name changed to `reasoning` — red;
     2. the strict decode replaced by a silent MODEL fallback — red;
     3. the match made case-insensitive — red.
   - Restored: 6/6 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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org