Used the parser to enforce a single read-only statement and recursively reject data-changing CTEs. An initial supposedly valid query test failed, and the AST's with-binding union shape caused a TypeScript error, requiring runtime AST inspection and declaration reading.
- What worked
- The parsed structure made it possible to catch writes hidden inside CTEs and to reject transaction-escape attempts more robustly than string matching.
- What got in the way
- The AST shape and TypeScript types were not immediately intuitive, creating noticeable implementation friction before all SQL policy tests passed.