| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- {
- "name": "utils-repair-json",
- "description": "smartbotic.utils.repairJson, exercised against the exact reply that broke 35photo2anime - 791 characters taken verbatim from the stored execution, not retyped. The model dropped `{\"` as a pair, so the document begins at a key with no opening quote. jsonrepair 3.x does not fix this shape, and neither did the first version of this repairer - a reconstructed test string had put the quote back and hidden that. Also pins that valid JSON is left alone, that non-JSON is refused rather than guessed at, and that a brace inside a string value does not confuse the bracket count.",
- "nodes": [
- {
- "id": "n1",
- "name": "Trigger",
- "type": "click-trigger",
- "position": {
- "x": 0,
- "y": 0
- },
- "config": {}
- },
- {
- "id": "n2",
- "name": "Repair",
- "type": "code",
- "position": {
- "x": 0,
- "y": 100
- },
- "config": {
- "code": "// The reply minimax-m3:cloud actually returned on 2026-09-03, taken verbatim\n// from execution exec_a0cf664e. Not retyped: an earlier version of this test\n// used a hand-written approximation that had silently restored the opening\n// quote, so it passed against a repairer that could not fix the real thing.\nvar real = \"humanCount\\\": 0, \\\"people\\\": [], \\\"nsfw\\\": false, \\\"nsfwLevel\\\": \\\"none\\\", \\\"nsfwReason\\\": \\\"no people present\\\", \\\"description\\\": \\\"a black-backed jackal standing alert in tall golden-green savanna grass, its body angled to the right while its head turns back to look over its left shoulder, distinctive black and silver saddle across the back, rust-colored legs and flanks, pointed ears erect, muzzle closed, tall dry grass surrounding and partially obscuring its lower legs, natural outdoor setting\\\", \\\"person_count\\\": 0, \\\"genders\\\": [], \\\"eroticism_level\\\": \\\"none\\\", \\\"is_black_and_white\\\": false, \\\"face_visible\\\": false, \\\"described_image_content\\\": \\\"A black-backed jackal (Canis mesomelas) standing in tall savanna grass, body shown in profile with head turned looking backward. No humans present in the image.\\\"}\";\nvar a = smartbotic.utils.repairJson(real);\nvar b = smartbotic.utils.repairJson('{\"a\": 1}');\nvar c = smartbotic.utils.repairJson('not json at all <html>');\nvar d = smartbotic.utils.repairJson('{\"text\": \"a { brace\", \"n\": 1');\nreturn {\n realOk: a.ok,\n realRepairs: a.repairs.join('; '),\n realHumanCount: a.value ? a.value.humanCount : -1,\n realNsfw: a.value ? a.value.nsfw : null,\n validUntouched: b.ok && b.repairs.length === 0,\n brokenRefused: c.ok === false,\n braceInStringText: d.value ? d.value.text : ''\n};\n"
- }
- }
- ],
- "connections": [
- {
- "sourceNodeId": "n1",
- "sourceOutput": "main",
- "targetNodeId": "n2",
- "targetInput": "data"
- }
- ],
- "expect": {
- "n2": {
- "status": "completed",
- "output": {
- "result": {
- "realOk": true,
- "realRepairs": "added the missing opening brace and quote",
- "realHumanCount": 0,
- "realNsfw": false,
- "validUntouched": true,
- "brokenRefused": true,
- "braceInStringText": "a { brace"
- }
- }
- }
- }
- }
|