Repository navigation
Open
Description
Summary
Harden the SQLok SST/compiler boundary after the initial CRUD and compiled-shape cache review.
The current implementation is a solid experimental foundation, but several correctness, security, and performance gaps must be resolved before the cache or public API is treated as production-ready.
Scope
- Derive canonical query shapes from SST structure instead of trusting caller-supplied cache keys.
- Include dialect, compiler version, and relevant model/schema descriptor versions in shape identity.
- Reject stale or structurally incompatible cached statements before execution.
- Define identifier validation and/or dialect-aware quoting for schema, table, and column names.
- Reject SELECT roots without a projection instead of emitting invalid SQL.
- Replace full AST argument traversal on cache hits with a real bind layout when practical.
- Reconcile LIMIT/OFFSET semantics with the documented ANSI portability decision.
- Clean up exported Go documentation and standardize benchmark APIs.
Security requirements
- Runtime values must remain outside SQL templates and cache keys.
- Dynamic identifiers must not be interpolated without validation or quoting.
- A cache hit must never return SQL from a different structural statement.
- Stale artifacts must be invalidated or rejected before an executor is called.
Acceptance criteria
- Equivalent statement structures with different values share a canonical shape.
- Different statement structures cannot collide silently.
- Shape identity accounts for dialect and compiler/model/schema versions where relevant.
- Invalid identifiers fail safely or are rendered through an explicit quoting policy.
SELECTwithout expressions returns a construction/compile error.- Cache-hit benchmarks measure automatic binding rather than a hand-written upper bound only.
- Regression tests cover wrong-key reuse, invalidation, identifier safety, empty SELECTs, and parameter mutation.
go test ./...,go vet ./..., and relevant race/benchmark gates remain green.
Related work
- Compiled statement cache: Cache compiled SQL statement shapes with parameter validation #15
- SQLok architecture and execution strategy documentation
Metadata
Metadata
Assignees
Labels
No labels
Activity
feat(cache): derive canonical statement shapes
feat(compiler): validate SQL identifiers
fix(dql): reject empty select projections
feat(cache): bind prepared shapes directly
docs(cache): clarify lazy artifact lifecycle
fix: validate offset before traversal
docs: record compiled cache research
feat(compiler): add dialect-aware bind slots
feat(sst): add explicit parameter slots
refactor(core): isolate dialect and execution
refactor(sst): return concrete select builders
test(cache): define statement artifact boundary
test(cache): make benchmark comparison honest
feat(cache): add stable plan lookup
refactor(cache): optimize immutable cache hits
docs(cache): document benchmark workflow
feat(api): expose compiler boundaries
feat(cache): add bounded statement cache
docs(cache): document bounded cache usage
fix(cache): bound eviction state
feat(compiler): bind named slots safely
test(cache): measure hardened paths