314: MSSQL spike: must-accept corpus #336
No reviewers
Labels
No labels
bug
chore
documentation
enhancement
feature
ready
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
david/pi-extensions-and-skills!336
Loading…
Reference in a new issue
No description provided.
Delete branch "feature/issue-314/mssql-spike-must-accept-corpus"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
314: MSSQL spike: must-accept corpus
Implements 314.
Generated in 1m 04s.
Review findings
SELECT INTO is already in the reject corpus. Now the edits.The BSD sed failed on the package.json edit, so I'll make it with the Edit tool.# Review Findings — 314
Summary
I resolved all five findings. The spike tests are now in the root
npm testglob. I added 11 accept-corpus entries: a trailing--comment with no newline, nested comments,''and]]escapes,NOLOCK,FOR JSON/XML,CROSS/OUTER APPLY,PIVOTandOPTION (RECOMPILE).SELECT INTOwas already in the reject corpus, so I didn't add it. The overlap check now normalises whitespace and case. I added a test that rejects data-modifying keywords outside comments and strings, and a comment noting the limits of the leading-keyword check. The spike tests pass 8 of 8. I did not run the fullnpm test, which also runs the penpot live-write stub. The repo has no build or lint script.Critical
High
Medium
npm testglob, so they never run undernpm test. Suggested fix: addextensions/mssql/spike/*.test.mjsto thenode --testlist inpackage.json, or document the manual command in the spike notes.\n, and the test only checks that the SQL is non-empty after trimming. The edge case is covered, but nothing asserts the guard handles a trailing--comment with no newline, which is the harder case. Suggested fix: add aSELECT Id FROM dbo.Orders -- no trailing newlineentry.WITH (NOLOCK), which starts with the keywordWITHmid-statement, andSELECT ... FOR JSON/XML. Others areCROSS APPLY/OUTER APPLY,PIVOT,OPTION (RECOMPILE),SELECT INTO(a write, so it belongs in the reject corpus), nested comments, an escaped''inside a string, and]]inside a bracketed identifier. Suggested fix: add entries for the read-only items, and confirmSELECT INTOis in the reject corpus.Low
WITH x AS (...) DELETE ...would pass it, though the corpus is meant to hold only read-only statements. Suggested fix: also assert that no accepted entry contains a data-modifying keyword outside comments and strings, or note the limitation in a comment.