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.
SELECT without 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
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
Security requirements
Acceptance criteria
SELECTwithout expressions returns a construction/compile error.go test ./...,go vet ./..., and relevant race/benchmark gates remain green.Related work