fix(web): 校验失败的 message 给出可读原因 - #353
Merged
minorcell merged 1 commit intoAug 17, 2026
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Contributor
There was a problem hiding this comment.
审查结论
本次改动按 issue 约定从完整校验明细中提取第一条非空 msg,仅移除 Pydantic 自定义 ValueError 前缀,并保留原有 data 明细与兜底文案。检查了异常处理器、实际 custom_prompt 校验入口、前端业务错误消费路径及新增回归用例,未发现会阻碍合入的正确性或兼容性问题。
验证:固定 SHA 差异通过 git diff --check,修改的 Python 文件通过 py_compile;PR 的 lint-and-test、前端检查和 patch coverage 均通过。本地未重复运行 pytest,因为执行环境未安装 uv 及项目依赖。
minorcell
approved these changes
Aug 17, 2026
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.
Summary
请求参数校验失败时,
message恒为「请求参数校验失败」,真实原因只在data里。前端展示的是message,所以用户看到的是一句读不懂的通用文案,无法据此改正输入。改为取第一条校验错误的
msg原文,取不到时退回原文案。data不变。pydantic 会给自定义
ValueError的原文加上Value error,前缀,对用户是噪声,剥掉后再返回。以自定义动作为例:提交空
custom_prompt时,原来返回「请求参数校验失败」,现在返回「custom 动作必须提供 custom_prompt」。Closes #336
Test plan
uv run ruff check .→ All checks passeduv run lint-imports→ 2 kept, 0 brokenuv run python -m scripts.export_openapi && git diff --exit-code -- ../openapi.json→ 无漂移uv run pytest -q→ 718 passed, 14 skippedValue error,开头