Principle:2giosangmitom Sqmeow nvim Connection Definition
| Knowledge Sources | |
|---|---|
| Domains | Configuration, Connection_Management |
| Last Updated | 2026-10-16 14:00 GMT |
Overview
A configuration parsing principle that decouples connection definition reading from secret expansion and database access, ensuring credentials never leak through error messages.
Description
Connection Definition is the principle of reading database connection definitions from project-local TOML files without evaluating or interpolating their contents. The parser validates TOML syntax and the flat connection table shape, rejects shell exec directives in project connections, and preserves type information (strings, integers, booleans) across the RPC boundary so the editor can distinguish a port from a string and a boolean flag from a truthy value.
This principle solves the problem of safely loading connection configurations that may contain secret directives: parsing happens with no filesystem, environment, shell, or database access. Syntax errors identify the line number without including the source line, which may contain credentials. The parsed definitions are sent to the engine for secret expansion and connection establishment in subsequent steps.
Usage
Use this principle when designing configuration parsers for systems that handle credentials: separate parsing from evaluation, preserve type information, reject executable directives in shared/project files, and never include source content in error messages.
Theoretical Basis
The principle rests on the separation of parsing from evaluation:
- Parsing produces a structured representation (name → fields map) without side effects.
- Evaluation (secret expansion, tunneling, connection) happens later with the user's permissions.
- Type preservation ensures the editor makes correct decisions: a port is an integer, not a string that looks like one.
- Error safety means syntax errors report locations without echoing content that may contain passwords.
# Abstract pattern (NOT real implementation):
def parse(contents: str) -> dict:
# Validate syntax, reject exec directives, preserve types
tables = toml_parse(contents) # may contain credentials
for name, fields in tables.items():
for key, value in fields.items():
if isinstance(value, str) and "{{exec" in value:
raise Error("exec directives not allowed in project connections")
# Preserve int/bool/str types, not just strings
return {name: fields for name, fields in tables.items()}
# Errors report line numbers, never source content
Related Pages
Implemented By
- Implementation:2giosangmitom_Sqmeow_nvim_project_parse
- Implementation:2giosangmitom_Sqmeow_nvim_Args