MSSQL spike: scaffold spike directory and must-reject corpus #313

Closed
opened 2026-11-10 08:17:52 +00:00 by david · 1 comment
Owner

Summary

Create extensions/mssql/spike/ and a labelled corpus of SQL that the read-only guard must reject.

Background

The MSSQL extension's only write block is a T-SQL parser allowlist. The spike scores two parser candidates against two corpora; this step builds the must-reject corpus. The corpus is stored as data (one case per entry, with a label) so it becomes a permanent test later. No package.json registration and no tools in this stage.

Depends on: #312

Implementation Details

Create extensions/mssql/spike/corpus-reject.json (or .mjs exporting an array), each entry { "label": "...", "sql": "..." }. Cover at least: UPDATE, INSERT, DELETE, MERGE, DROP, TRUNCATE, ALTER, CREATE, SELECT ... INTO, EXEC/EXECUTE (including EXEC('...') and EXEC sp_...), OPENROWSET, OPENQUERY, OPENDATASOURCE, stacked statements (SELECT 1; DROP TABLE x), comment tricks (--, /* */, nested /* /* */ */, a write hidden after a comment, a ; hidden by a comment), a CTE whose body contains a write (WITH x AS (...) DELETE ..., WITH x AS (...) UPDATE ...), xp_cmdshell, WAITFOR, BULK INSERT, USE, GO batches, and variable/SET statements. Add any other cases you can find (mixed case, unicode whitespace, unusual line breaks, bracketed-identifier tricks). Each label must say what the case tests. Do not add parser code here.

Acceptance Criteria

  • extensions/mssql/spike/ exists with the reject corpus as data.
  • Every entry has a unique non-empty label and an sql string.
  • All categories listed above are represented, with at least 40 entries in total.
  • Comment-trick and CTE-with-write cases are included.
  • The file loads without error (node -e "import('./extensions/mssql/spike/corpus-reject.mjs')" or JSON parse).

Test Plan

Load the file in Node and print the entry count and the set of labels; confirm no duplicates and every category above appears.

## Summary Create `extensions/mssql/spike/` and a labelled corpus of SQL that the read-only guard must reject. ## Background The MSSQL extension's only write block is a T-SQL parser allowlist. The spike scores two parser candidates against two corpora; this step builds the must-reject corpus. The corpus is stored as data (one case per entry, with a label) so it becomes a permanent test later. No `package.json` registration and no tools in this stage. **Depends on:** #312 ## Implementation Details Create `extensions/mssql/spike/corpus-reject.json` (or `.mjs` exporting an array), each entry `{ "label": "...", "sql": "..." }`. Cover at least: `UPDATE`, `INSERT`, `DELETE`, `MERGE`, `DROP`, `TRUNCATE`, `ALTER`, `CREATE`, `SELECT ... INTO`, `EXEC`/`EXECUTE` (including `EXEC('...')` and `EXEC sp_...`), `OPENROWSET`, `OPENQUERY`, `OPENDATASOURCE`, stacked statements (`SELECT 1; DROP TABLE x`), comment tricks (`--`, `/* */`, nested `/* /* */ */`, a write hidden after a comment, a `;` hidden by a comment), a CTE whose body contains a write (`WITH x AS (...) DELETE ...`, `WITH x AS (...) UPDATE ...`), `xp_cmdshell`, `WAITFOR`, `BULK INSERT`, `USE`, `GO` batches, and variable/`SET` statements. Add any other cases you can find (mixed case, unicode whitespace, unusual line breaks, bracketed-identifier tricks). Each label must say what the case tests. Do not add parser code here. ## Acceptance Criteria - [ ] `extensions/mssql/spike/` exists with the reject corpus as data. - [ ] Every entry has a unique non-empty `label` and an `sql` string. - [ ] All categories listed above are represented, with at least 40 entries in total. - [ ] Comment-trick and CTE-with-write cases are included. - [ ] The file loads without error (`node -e "import('./extensions/mssql/spike/corpus-reject.mjs')"` or JSON parse). ## Test Plan Load the file in Node and print the entry count and the set of labels; confirm no duplicates and every category above appears.
david closed this issue 2026-11-10 22:26:36 +00:00
Author
Owner

pi-loop opened and merged a pull request for this issue: #335

pi-loop opened and merged a pull request for this issue: https://git.excelera.net/david/pi-extensions-and-skills/pulls/335
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
david/pi-extensions-and-skills#313
No description provided.