Loyal-Young opened a new pull request, #5179:
URL: https://github.com/apache/rocketmq-dashboard/pull/5179

   ## What changed
   
   Validate the JSON shape of AI run-stream `agent` frames before reading their 
event type. `null`, arrays, and scalar JSON values now raise the existing 
structured `llm.stream.malformed_event` error. Object payloads with an unknown 
`type` keep their distinct unknown-type error.
   
   Fixes #5178.
   
   ## Verification
   
   - Confirmed the new parameterized test failed on the old implementation: 
`null` raised a raw `TypeError`, while other non-object values returned the 
wrong error code.
   - `npx vitest run src/api/ai.test.ts` — 31 passed.
   - `npx tsc -b` — passed.
   - `npx eslint src/api/ai.ts src/api/ai.test.ts` — passed.
   - `git diff --check` — passed.
   
   Both touched files already fail the repository's Prettier check on 
unmodified `master`; this change stays focused on stream parsing.
   
   ## AI assistance
   
   An AI assistant helped inspect the run-stream parser, draft the shape guard, 
and write the parameterized regression test. The failing behavior was observed 
before the fix, and the checks above were run afterward.
   


-- 
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