Zero-Leak AI SQL Precheck & Submission Gate
Every DDL or DML change order in Yearning v4 must pass a two-stage Deterministic AST/Rule Check + AI Review Inspection before submission. Only runs that reach ready status with zero blocking findings pass the Submission Gate.

Batch Dual-Fingerprint Deduplication
Every statement is parsed with TiDB SQL Parser or pg_query_go/v6 into versioned Canonical and Dialect fingerprints. Homologous batches (e.g., 50,000 UPDATE statements differing only in values) collapse into 1 fingerprint group so deterministic rules inspect all statements while the AI Review Agent inspects 1 representative statement per group.
Dual-Track AI Privacy Isolation (default vs. san)
defaultTrack (Cloud OpenAI-Compatible APIs & Legacyv3.1): Strips all literals and comments, replaces schema/table/column identifiers with per-run tokens (schema_1,table_1,column_1), enforcesAssertZeroLeak(fail-closed2005), and automatically restores real identifiers in the UI exclusively for authorized viewers (review.identifier_displayedaudit log).sanTrack (Internal Self-Hosted vLLM / Ollama forSAN-2B/SAN-4B/SQL-Audit-Nano): Uses versionless compact Raw-SQL Native prompts on RFC1918 LANs protected byaddrguardSSRF checks, truncates literals over 256 chars, bindsPrivacyContractHashSAN, and strictly blocks raw payloads from falling back to clouddefaultendpoints.
5 Read-Only Metadata Tools
check_syntax: Dialect syntax and object resolution verification.describe_table: Live column types, nullability, defaults, and column comments.list_indexes: Primary keys, unique keys, and composite index column ordering.table_stats: Table size, row estimates, and index selectivity.safe_explain: Read-only execution plan inspection for full-table scans and lock risks.
Deterministic Critical Blocking
Missing or truncated metadata keeps the stage in partial status and blocks submission fail-closed until resolved.