Repository navigation
fix(utils): preserve JSON response boundaries and string literals - #1415
Merged
Merged
Conversation
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
接续 #1408,修复 #1401:SQL 字符串中的
{、}不再干扰 JSON 提取,同时避免把非法或截断回答中的子对象、子数组当成完整回答。包含原作者 ExtremeNina 的提交
438a4ab7,以及补充回归修复60d4a5a7。仓库禁用 merge commit,使用 rebase merge 保留两条独立提交的作者与提交说明;合并后的 SHA 会变化。Evidence
Before: 在 fix(utils): ignore braces inside strings when extracting nested json (#1401) #1408 原提交上运行补充测试,12 项失败,例如
{"tables": [],} then {"success":true,"sql":"SELECT 1"}错误返回[],截断的预测数组错误返回内部对象。After: JSON 提取测试 34 项通过;原始花括号问题、转义字符、Markdown 包装、合法嵌套结构仍通过。
将
60d4a5a7与当前main的b78354c5在隔离 worktree 中合并验证,无冲突,以下命令从backend/执行,57 passed:使用既有 Python 3.11.17 环境(pytest 7.4.4、orjson 3.11.9),未同步依赖;确认导入来自验证 worktree。测试文件 Ruff 检查与格式检查通过,修改的解析函数格式检查通过;utils 文件剩余 32 项 lint 告警及整体格式问题已与原 PR 基线对照,无新增告警。
git diff --check通过。未运行真实数据库、LLM、浏览器或镜像部署验收。
Merge Danger
Door: two-way
仅修改提取函数和离线回归测试,无依赖或数据库迁移变更,可通过代码回退恢复。
Blast Radius: Chat
影响复用该函数的 SQL、图表、预测及问题建议解析。保持返回第一个合法对象或数组的语义,不按业务字段筛选;描述中未闭合的括号可能导致后续 JSON 一并被拒绝。