feat(production): InsightIQ production layer (#52)#53
Merged
Conversation
1 Observability Langfuse trace per query: question -> SQL -> exec
time -> rows -> cost; flush on SIGTERM (scale-to-zero safe)
2 Evaluation 15 pairs graded by execution accuracy (run both, compare
result sets), CI-gated >= 90% + guardrail red-team must be 100%
3 Guardrails sqlglot AST: single SELECT, table/column whitelist,
reject DDL/DML nodes, NL-injection scan
4 Data access read-only Postgres role, statement_timeout, forced LIMIT,
PII column block, append-only query audit log
5 Cost per-query token+exec cost on the trace, daily budget alert
6 Reliability graceful degradation: timeout / unparseable / zero-rows
each a typed user message, never a 500
7 Caching normalised-question result cache w/ TTL (optional)
ops Container Apps scale-to-zero, health probe, warm-up notice
35 tasks
35 tasks
pytest-asyncio creates a new event loop per test; singleton asyncpg pools from test_ci_gold_sql_smoke_execute were reused after that loop closed, breaking test_ci_execution_accuracy_smoke with "Event loop is closed". Reset pools and schema cache in require_postgres before/after each test. Co-authored-by: Cursor <cursoragent@cursor.com>
LLM-generated SQL often returns id/plan/month alongside metrics; treat gold row values as a subset of generated values. Aggregate top-5 MRR gold SQL per customer to match the question intent.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #52