Commit 175d592
committed
Address several roborev review findings
All 24 individual tests pass (all checkmarks). The "FAIL" is a pre-existing vitest configuration issue ("No test suite found") unrelated to my changes — all actual test cases pass.
Changes:
- In `translateSql`, only the first standalone `_t_1` occurrence gets the `AS _t_1` alias; subsequent standalone occurrences get the bare `readExpr` to avoid duplicate alias issues in UNION/subquery contexts
- Added test case for multiple standalone `_t_1` references verifying alias-on-first-only behavior
Address review findings (job 115)
All 274 tests pass. The changes compile cleanly and tests are green.
Changes:
- Include Parquet conversion warning in the error path (not just success), so users see the full chain of failures when both DuckDB and sqlp fail
- Log when Parquet warning cannot be prepended due to unexpected content structure
Address review findings (job 117)
All changes are complete. Build passes and all 274 tests pass.
Changes:
- Fix SQL injection via `compression`/codec parameter: whitelist valid codecs (`zstd`, `snappy`, `gzip`, `lz4`, `uncompressed`) and reject anything else
- Fix SQL injection via `delimiter` parameter: validate exactly 1 character and escape single quotes
- Fix race condition in `ensureParquet()`: add in-memory lock map to deduplicate concurrent conversions for the same file
- Add error checking after each qsv subprocess call in `ensureParquet()`: wrap each step in try/catch with descriptive error messages identifying which step failed
- Verify Parquet output file exists after conversion before returning success
Address review findings (job 118)
No tests reference the codec list. The change is minimal and the build succeeds.
Changes:
- Add `brotli` and `lzo` to `VALID_PARQUET_CODECS` set to match DuckDB's supported compression codecs
Address review findings (job 120)
All changes complete. Build succeeds and all 276 tests pass.
Changes:
- Remove unused `runQsvSimple` import from `duckdb.ts` (finding #1)
- Add trust assumption comment documenting that `sql` parameter comes from trusted MCP agent in `tryDuckDbExecution` (finding #2)
- Clean up partial `.parquet` file on conversion failure in `doParquetConversion` to prevent stale corrupted files (finding #4)
- Detect multi-table SQL queries (`_t_2`, `_t_3`, etc.) and fall back to sqlp preemptively instead of sending untranslated references to DuckDB (finding #5)
- Add tests for multi-table reference detection regex and `_t_2+` non-translation behavior
Address review findings (job 121)
Everything looks clean. Here's a summary:
Changes:
- Fix multi-table sqlp fallback: stop setting `SKIP_INPUT` for multi-table queries so sqlp receives the original input file and can resolve `_t_2+` references natively
- Extract `MULTI_TABLE_PATTERN` regex to a shared constant exported from `duckdb.ts`, eliminating duplication between `mcp-tools.ts` and `duckdb.test.ts`
- Clean up asymmetric brace style in the DuckDB/sqlp interception block into a clean if/else
Address review findings (job 122)
All 276 tests pass. The changes are minimal and focused:
Changes:
- Remove case-insensitive `/i` flag from `MULTI_TABLE_PATTERN` regex since sqlp table references (`_t_N`) are case-sensitive
- Add test cases verifying uppercase `_T_2` and `_T_10` do not match the multi-table pattern
Address review findings (job 124)
All changes applied, build and tests pass (276/276).
Changes:
- Add `.sz` compressed file variants to `isCsvLikeFile()` so Snappy-compressed CSV/TSV/TAB/SSV files are recognized and converted to Parquet (finding 1)
- Move `ensureParquet()` call after `MULTI_TABLE_PATTERN` check to avoid wasted Parquet conversion on multi-table queries that fall through to sqlp (finding 2)
- Restore case-insensitive flag on `MULTI_TABLE_PATTERN` regex for consistency with case-insensitive `_t_1` replacement in `translateSql` (finding 3)
- Update test assertions to expect uppercase `_T_2`/`_T_10` to match the now case-insensitive pattern
Address review findings (job 125)
All 280 tests pass. Here's the summary:
Changes:
- Reverted `MULTI_TABLE_PATTERN` regex to case-sensitive (removed `/i` flag) since sqlp table references (`_t_N`) are case-sensitive and uppercase `_T_2` would cause query errors
- Reverted duckdb tests to assert uppercase `_T_N` does NOT match the pattern
- Exported `isCsvLikeFile` function from `mcp-tools.ts` to enable testing
- Added unit tests for `isCsvLikeFile` covering standard extensions, `.sz` Snappy-compressed variants, case-insensitivity, and non-CSV rejection
Address review findings (job 127)
Changes:
- `getParquetPath` now uses `basename()` for extension matching, preventing false matches when directory paths contain CSV-like extensions (e.g., `/data/CSV_FILES/test.csv`)
- `MULTI_TABLE_PATTERN` made case-insensitive (`/i` flag) to be consistent with the `_t_1` replacement pattern, preventing confusing DuckDB errors when agents send uppercase `_T_2`
- `translateSql` now logs a warning for unknown file extensions (e.g., `.xlsx`) that are treated as CSV, helping diagnose cryptic DuckDB errors
- Secondary SIGKILL timer in `executeDuckDbQuery` is now properly cleared in both `close` and `error` handlers, preventing unnecessary SIGKILL on already-exited processes
- Updated `duckdb.test.ts` to match the case-insensitive `MULTI_TABLE_PATTERN` behavior
Address review findings (job 128)
All changes are complete. TypeScript compiles cleanly and all 286 tests pass.
Changes:
- Fix `MULTI_TABLE_PATTERN` flip-flop: make regex case-sensitive again, add `normalizeTableRefs()` to lowercase `_T_N` → `_t_N` before routing, so sqlp receives consistent lowercase refs
- Extract `CSV_LIKE_EXTENSIONS` shared constant in `duckdb.ts`, reuse in both `isCsvLikeFile()` and `translateSql()` to eliminate duplicated extension lists
- Export `getParquetPath()` and add regression tests for directory-path false-match bug (e.g., `/data/csv_files/test.json`)
- Add tests for `normalizeTableRefs()` and its interaction with `MULTI_TABLE_PATTERN`
Address review findings (job 129)
All 286 tests pass. The diagnostics about `qsv_bin` are pre-existing Rust issues unrelated to these changes.
Changes:
- Added comment explaining `.txt`/`.dat` are warning-only suppressions, not in `CSV_LIKE_EXTENSIONS` (no Parquet conversion)
- Simplified `params.sql` assignment by removing conditional check — always assign normalized SQL
Address review findings (job 131)
All 286 tests pass. Here's the summary:
Changes:
- Remove `params.output` fallback in `tryDuckDbExecution` to use only the pre-validated `outputFile` parameter, closing a potential path validation bypass
- Add clarifying comment to `getParquetPath` explaining why the mixed-case logic (lowercase matching + original-path slicing) is correct
- Add comment to `translateSql` documenting that `_t_1` replacement also applies inside SQL string literals (acceptable limitation for MCP agent usage)
Address review findings (job 133)
All 287 tests pass, 0 failures.
Changes:
- Consolidated `ChildProcess` type import with `spawn` into a single `child_process` import in `duckdb.ts`
- Extracted inline `maxStderrSize` magic number to named constant `MAX_STDERR_SIZE` alongside `DUCKDB_VALIDATION_TIMEOUT_MS`
- Exported `ensureParquet` and added tests for its early-return paths (non-CSV file passthrough)
Address review findings (job 135)
All 287 tests pass.
Changes:
- Made `MULTI_TABLE_PATTERN` case-insensitive (`/i` flag) for defense-in-depth, so uppercase `_T_N` references are caught even without `normalizeTableRefs` being called first
- Fixed TOCTOU race in `ensureParquet` by checking the lock map before any async `stat()` calls
- Added zero-byte file validation after Parquet conversion to catch corrupted/empty output files
- Updated test assertions to match the case-insensitive `MULTI_TABLE_PATTERN` behavior
Address review findings (job 136)
All 287 tests pass. The diagnostics about `qsv_bin` and `lesson_*.rs` are pre-existing issues unrelated to this change.
Changes:
- Restructured zero-byte file validation in `doParquetConversion` to use separate try/catch for `stat()` and a plain `if` for the size check, eliminating brittle string-matching error re-throw logic
Address review findings (job 138)
All changes are complete. Build passes and all 289 tests pass.
Changes:
- Fix `translateSql` to skip `_t_1` replacements inside single-quoted SQL string literals using a quote-aware regex
- Fix `normalizeTableRefs` regex to handle both `_T_N` and `_t_N` variants (was only matching uppercase `_T_`)
- Prefix delimiter validation error with `[DuckDB]` for clearer error attribution
- Document `getParquetPath` behavior for non-CSV files (appends `.parquet` suffix)
- Add tests for string literal protection (`SELECT '_t_1'` preserved) and escaped quotes
- Add test for `normalizeTableRefs` idempotency on already-lowercase refs
Address review findings (job 140)
All 290 tests pass. The changes are minimal and focused on the review findings.
Changes:
- Added comment documenting that multi-table queries (`_t_2+`) don't benefit from Parquet auto-conversion, directing users to manually convert with `qsv_to_parquet`
- Added comment clarifying delimiter validation: actual tab character (`\t`, length 1) works correctly; only the 2-char string literal `\\t` would be rejected
- Added test verifying multi-character delimiter strings are rejected by `translateSql`
Address review findings (job 142)
All 290 tests pass, build succeeds. Here's a summary:
Changes:
- Fix `translateSql` to use `(read_expr) AS _t_1` alias so qualified column refs like `_t_1.column` remain valid (only standalone `_t_1` not followed by `.` is replaced)
- Reuse `translateSql()` in sqlp fallback path instead of duplicating the `_t_1` → `read_parquet()` regex logic inline
- Add early `inputFile` existence check in `doParquetConversion` with clear "Input file not found" error message
- Simplify the stats/schema freshness check by removing unnecessary nested try/catch (input file is now validated upfront)
- Update all test assertions to match the new aliased read expression format1 parent ab9daad commit 175d592
File tree
5 files changed
+387
-92
lines changed- .claude/skills
- src
- tests
5 files changed
+387
-92
lines changedSome generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | 14 | | |
18 | 15 | | |
19 | 16 | | |
20 | 17 | | |
21 | 18 | | |
22 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
23 | 30 | | |
24 | 31 | | |
25 | 32 | | |
| |||
74 | 81 | | |
75 | 82 | | |
76 | 83 | | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
77 | 102 | | |
78 | 103 | | |
79 | 104 | | |
| |||
246 | 271 | | |
247 | 272 | | |
248 | 273 | | |
249 | | - | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
250 | 281 | | |
251 | 282 | | |
252 | | - | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
253 | 290 | | |
254 | 291 | | |
255 | 292 | | |
| |||
266 | 303 | | |
267 | 304 | | |
268 | 305 | | |
269 | | - | |
270 | | - | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
271 | 324 | | |
272 | 325 | | |
273 | 326 | | |
| |||
312 | 365 | | |
313 | 366 | | |
314 | 367 | | |
315 | | - | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
316 | 372 | | |
317 | 373 | | |
318 | 374 | | |
| |||
340 | 396 | | |
341 | 397 | | |
342 | 398 | | |
| 399 | + | |
343 | 400 | | |
344 | 401 | | |
345 | 402 | | |
346 | 403 | | |
347 | | - | |
| 404 | + | |
348 | 405 | | |
349 | 406 | | |
350 | 407 | | |
| |||
364 | 421 | | |
365 | 422 | | |
366 | 423 | | |
367 | | - | |
368 | 424 | | |
369 | | - | |
| 425 | + | |
370 | 426 | | |
371 | | - | |
372 | | - | |
| 427 | + | |
| 428 | + | |
373 | 429 | | |
374 | 430 | | |
375 | 431 | | |
376 | 432 | | |
377 | 433 | | |
378 | 434 | | |
| 435 | + | |
379 | 436 | | |
380 | 437 | | |
381 | 438 | | |
| |||
398 | 455 | | |
399 | 456 | | |
400 | 457 | | |
| 458 | + | |
401 | 459 | | |
402 | 460 | | |
403 | 461 | | |
| |||
0 commit comments