feat: FORCE_DIRECT_DB — force on-prem NLQ execution, block syntex (#126)#133
Merged
Conversation
- lib/config: isForceDirectDb, assertExternalDataApiAllowed, startup probe log - next.config env inlines FORCE_DIRECT_DB for client bundles - instrumentation.ts logs [transparency] line on server start when enabled - query-executor: force direct path when env set; guard before external fetch - prompt-analyzer: omit syntex queryString when forced - query page: disable API mode toggle when forced - env.example + ai-transparency syntex entry document flag - vitest: force-direct-db config tests Co-authored-by: Cursor <cursoragent@cursor.com>
- buildExternalAnalysisReadyUrl in config; prompt-analyzer uses it - query-executor: isForceDirectDb() || useDirectDB branch - query page: directDbForcedByEnv + clearer mode hint copy - tests for URL builder Co-authored-by: Cursor <cursoragent@cursor.com>
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.
Summary
Closes #126: deployment flag
FORCE_DIRECT_DB=trueforces allexecuteQuerypaths through/api/execute-sql, omits syntex URLs in the rule-based analyzer, and fails closed if code attempts to fetchschools.syntex-ai.com.Implementation
lib/config.ts:isForceDirectDb(),assertExternalDataApiAllowed(url),logForceDirectDbStartupProbe()next.config.ts:env.FORCE_DIRECT_DBso client components (query page,query-executor,prompt-analyzer) see the same value as the server at build/dev timeinstrumentation.ts: server startup log —[transparency] FORCE_DIRECT_DB=true; external data flows disabledlib/query-executor.ts:forceDirect || useDirectDB→ direct path;assertExternalDataApiAllowedbefore any externalfetchlib/prompt-analyzer.ts: emptyqueryStringwhen forced (no syntex URL string built)/query: DB mode switch disabled when forcedenv.example,content/ai-transparency.ts(syntex-data-api): documentedVerify
Closes #126
Made with Cursor