You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(nl2sql): EXPLAIN dry-run pre-flight for translate_nl_to_sql
Second of the two remaining security-hardening.md items. Before returning
or executing the generated SQL, run a non-executing EXPLAIN (reusing
mcpg.query.explain_query, so it's SafeSqlDriver-validated) to catch queries
that pass the structural allowlist but reference a non-existent
column/table or mistype something:
- Planner rejection -> structured error='query invalid: <message>' with the
SQL returned for inspection; nothing executed.
- Pre-flight statement_timeout -> degrade to 'skip, proceed' (don't block a
valid translation).
- New explain_preflight tool arg (default on); bypassable per call.
Surface snapshot regenerated (translate_nl_to_sql gains explain_preflight).
2 new unit tests (invalid-query surfaced; bypass when disabled) + an EXPLAIN
route in the nl2sql test schema so the default-on pre-flight passes.
Completes security-hardening.md — both NL->SQL items now shipped.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0122yLZLJ8t4W43sdN6BmTZc
0 commit comments