Repository navigation
fix(scan): escape control characters and throw SqlError on lexer errors - #185
pyramation wants to merge 1 commit into
Conversation
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
|
Review complete. No blocking issues — approved ✅; 1 nitpick below. 🧹 Nitpicks (1) — 🟢 1 low
This PR hardens the parse-result JSON pipeline: the C WASM wrappers now escape control characters (0x00-0x1f) as backslash-u escape sequences before the result string is parsed in JS, and
Reviewed commit: 0e33eb7 |
|
Closing in favor of #183, which consolidates the v18 scan/fingerprint/normalize error fixes, including control-character escaping in build_scan_json and lexer errors as SqlError. |
Summary
scan/scanSync(v18) threw a raw JSONSyntaxErrorin two cases, in both the published 18.2.1 and 18.2.0:SELECT 'a\x01b',\b,\x1f):build_scan_jsononly escaped" \ \n \r \t, so the JSON was invalid. Other bytes< 0x20are now written as\u00XX, and the buffer budget goes from 2 to 6 bytes per input byte.SELECT 'unterminated,SELECT $$x,SELECT /* x,''):wasm_scanreturns the error text, but the wrapper only checked forsyntax error/ERRORprefixes, so the error text went toJSON.parse. Any non-JSON result now throwsSqlError:Edits are in
templates/full/;versions/18/src/was regenerated withcopy:templates.Evidence:
versions/18/test/scan.test.jsfail against the published 18.2.1wasm/and pass on this build. The full v18 suite passes (145/145).SyntaxErrorbefore now scan, and 39,212 now throwSqlErrorinstead ofSyntaxError.Link to Devin session: https://app.devin.ai/sessions/b32426e30a71409594f003cf94c9e560
Open in Devin Desktop: https://app.devin.ai/desktop/session/b32426e30a71409594f003cf94c9e560?variant=devin
Requested by: @pyramation