zjncs opened a new pull request, #5734:
URL: https://github.com/apache/rocketmq-dashboard/pull/5734
### What
`PromptEnhancer` — the rewrite of a user's message into a structured prompt
before the agent run — had no test. This adds `PromptEnhancerTest` with 12
tests pinning the contract its own documentation calls load-bearing.
### What is pinned
- a blank prompt is returned untouched **without any model call**;
- an HTTP engine rewrites through the LLM client with the raw prompt
embedded in the meta-prompt template; a CLI engine rewrites through that
engine's provider (a CLI-only deployment needs no HTTP provider configured),
and the engine match is case- and whitespace-insensitive with null/blank
defaulting to HTTP;
- deltas stream to the caller **as they arrive**, and empty chunks are
skipped from both the stream and the accumulation;
- **failure is not fatal**: a throwing provider, an empty rewrite, a rewrite
that cleans to nothing, and a failing delta observer all leave the run with the
original message — losing a rewrite costs prompt quality, failing the turn
would cost the answer;
- `clean` strips the **markdown fence** a model sometimes wraps the rewrite
in (in a chat answer it is decoration; in the prompt handed to the agent it
reads as an instruction), while the live stream carries the raw chunks.
### Verification
- New tests on unmodified code: **12/12 green**, checkstyle clean (`mvn test
-Dtest=PromptEnhancerTest`).
- Discriminating mutations on `PromptEnhancer`, build result verified red
each time:
1. the failure fallback removed — red (the failing-provider, empty-rewrite
and failing-observer tests);
2. the fence stripping dropped from `clean` — red (three tests);
3. the engine routing inverted — red (five tests).
- Restored: 12/12 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]