fix: validate blank message submission / 修复空消息提交校验 - #34
Merged
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
The changes correctly block blank submissions before any API-key lookup and prevent unintended state transitions while matching the alerts validator contract (string return).
Pull request overview
Addresses a follow-up validation gap where blank submissions could still transition the chat into a “Streaming” flow (and mutate state) before input validation, and aligns the Reply prompt validator with the updated alerts contract by returning a string on success.
Changes:
- Make the Reply prompt validator return an empty string on success (and an error string on blank input).
- Add an alerts-based “Please enter text” alert and short-circuit blank submissions before API-key lookup / message submission.
- Ensure invalid (blank) input does not reset chat/session state or trigger streaming.
File summaries
| File | Description |
|---|---|
| calcit.cirru | Updates prompt validation and submit flow to block blank submissions early and display an alerts-based “Please enter text” without mutating chat/session state. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
English
Follow-up to #33: blank composer submissions could still reset the chat and enter Streaming before validation, while the prompt validator returned a non-string success value under the current alerts contract.
中文
这是 #33 的后续修复:空白输入仍会在校验前重置聊天并进入 Streaming,同时 Reply prompt validator 的成功分支在新版 alerts 契约下返回了非字符串值。
Validation / 验证
calcit edit formatcalcit --check-onlycalcit js127.0.0.1:5182: blank Submit shows the alert, does not enter Streaming, and logs no runtime error / 干净浏览器环境验证空提交只显示提示、不进入 Streaming、无运行时错误