326: MSSQL: mssql_query and mssql_query_one tools #350
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!350
Loading…
Reference in a new issue
No description provided.
Delete branch "feature/issue-326/mssql-mssql-query-and-mssql-query-one-tools"
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?
326: MSSQL: mssql_query and mssql_query_one tools
Implements 326.
Generated in 1m 18s.
Review findings
Existing test expects no note with 2 rows; that's now intended behaviour, so I'll update it.# Review Findings — 326
Summary
I fixed the Medium and Low findings.
sanitiseErrorMessagenow also redacts ADO-style credentials.mssql_query_onenow runs withmaxRows: 1and appends a note when more rows exist. Its tool description now says only the first row is returned. I added tests for ADO redaction, the single-row truncation note and the timeout path, and commented thepool.querystub. After these changes the mssql tests pass (141 pass, 0 fail), andtsc --noEmitreports no mssql errors. The High finding is left open because wiring the extension intoindex.tsandpackage.jsonlooks like a later issue's scope, and I haven't confirmed that a follow-up issue exists.Critical
High
registerMssqlToolsis never called. The entry point is still an empty function, andextensions/mssql/index.tsis not in thepi.extensionslist inpackage.json. As a resultmssql_queryandmssql_query_oneare not available to users after this change. This may be deliberate if a later issue does the wiring, but the issue title implies the tools should exist. Suggested fix: confirm the wiring is covered by a follow-up issue. If it isn't, build the pool, read the settings, create the audit logger and callregisterMssqlToolsfromindex.ts, then register the extension inpackage.json.Medium
sanitiseErrorMessageonly redactsscheme://…URLs. Driver errors can also contain ADO-style connection strings such asPassword=…;orUser ID=…. Those pass through to both the tool output and the audit log. Suggested fix: also redact(password|pwd|user id|uid)\s*=\s*[^;\s]+case-insensitively, and add a test for it.mssql_query_oneruns the query with the fullmaxRowscap and then discards every row but the first. That wastes bandwidth and server work. Suggested fix: passmaxRows: 1torunQueryfor this tool.guardedQuerywould need amaxRowsoverride, and truncation should then be reported as "more rows exist" rather than as a cap hit.mssql_query_onereturnsdetails.truncatedwhen the cap was hit, but the text never tells the model that more rows exist, so it may read the first row as the only one. Suggested fix: append a short note whentruncatedis true, or document in the tool description that only the first row is returned.Low
pooltypeRequestPool & { query: () => never }is a workaround for the "never usepool.query" assertion. It does not appear to be checked against the realmssqlpool. Suggested fix: add a comment explaining the intent, or drop thequerystub and assert only onrequest().QueryTimeoutError) through the tools, so audit and message handling for timeouts is unverified. Suggested fix: add one test where the fake request never emitsdone, using a smallqueryTimeoutMs.