fix(decision): replace fullwidth space (U+3000) in JSON

Critical bug: AI can output fullwidth space ( U+3000) between brackets:
Input:  [ {"symbol":"BTCUSDT"}]
        ↑ ↑ fullwidth space
After previous fix:
        [ {"symbol":"BTCUSDT"}]
         ↑ fullwidth space remained!
Result: validateJSONFormat failed because:
- Checks "[{" (no space) 
- Checks "[ {" (halfwidth space U+0020) 
- AI output "[ {" (fullwidth space U+3000) 
Solution: Replace fullwidth space → halfwidth space
-  (U+3000) → space (U+0020)
This allows existing validation logic to work:
strings.HasPrefix(trimmed, "[ {") now matches 
Why fullwidth space?
- Common in CJK text editing
- AI trained on mixed CJK content
- Invisible to naked eye but breaks JSON parsing
Test case:
Input:  [ {"symbol":"BTCUSDT"}]
Output: [ {"symbol":"BTCUSDT"}]
Validation:  PASS
Co-Authored-By: tinkle-community <tinklefund@gmail.com>
This commit is contained in:
ZhouYongyou
2025-11-04 23:59:20 +08:00
parent 40ba5865a4
commit 834285bb16
+3
View File
@@ -487,6 +487,9 @@ func fixMissingQuotes(jsonStr string) string {
jsonStr = strings.ReplaceAll(jsonStr, "", "]") // CJK右龟壳括号 U+3015
jsonStr = strings.ReplaceAll(jsonStr, "、", ",") // CJK顿号 U+3001
// ⚠️ 替换全角空格为半角空格(JSON中不应该有全角空格)
jsonStr = strings.ReplaceAll(jsonStr, " ", " ") // U+3000 全角空格
return jsonStr
}