Repository navigation
fix: SSL fields missing in some integration metadata schemas - #123
Conversation
📝 WalkthroughWalkthroughSchemas for AlloyDB, MariaDB, MindsDB, MySQL, and PostgreSQL now accept optional sslEnabled and caCertificateText alongside caCertificateName. Environment-variable generation excludes caCertificateText (only emits CACERTIFICATE_NAME). SQLAlchemy inputs reference filesystem paths derived from certificate names (sslrootcert / ssl.ca) rather than certificate text. MongoDB SSL injection (adding ssl options to the connection string) is moved into the per-key metadata mapping for connection_string. Tests were added/updated to assert these behaviors. Sequence DiagramsequenceDiagram
participant Client as Metadata Input
participant Validator as Schema Validation
participant Mapper as Metadata-Map Processing
participant EnvGen as Env Var Generation
participant SQLAlchemy as SQLAlchemy Input
participant Output as Env Output
Client->>Validator: submit metadata (sslEnabled?, caCertificateName?, caCertificateText?)
Validator-->>Mapper: validated metadata
rect rgb(240,248,255)
Note over Mapper: Per-integration key mapping
Mapper->>Mapper: build key/value pairs
Mapper->>Mapper: if integration==mongodb AND key==connection_string AND sslEnabled==true
Mapper->>Mapper: transform value via addSslOptionsToMongoConnectionString
end
rect rgb(245,245,220)
Note over EnvGen: Certificate handling
Mapper->>EnvGen: emit per-integration vars
EnvGen->>EnvGen: exclude caCertificateText from env vars
EnvGen->>EnvGen: include CACERTIFICATE_NAME (if present)
EnvGen->>SQLAlchemy: construct SQLAlchemy input using filesystem path from certificate name (not text)
end
EnvGen->>Output: environment variables (no CACERTIFICATE_TEXT)
SQLAlchemy->>Output: SQLAlchemy config references cert file path
Pre-merge checks✅ Passed checks (2 passed)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (4)
packages/database-integrations/src/database-integration-env-vars.test.ts(3 hunks)packages/database-integrations/src/database-integration-env-vars.ts(1 hunks)packages/database-integrations/src/database-integration-metadata-schemas.test.ts(6 hunks)packages/database-integrations/src/database-integration-metadata-schemas.ts(1 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
packages/*/src/**/*.test.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
packages/*/src/**/*.test.{ts,tsx}: Place test files next to the source files with .test.ts or .test.tsx extension
Use Vitest as the testing framework for all tests
Import { describe, expect, it } from 'vitest' in tests
Use dedent from ts-dedent for multiline string comparisons in tests
Follow existing test patterns (see packages/blocks/src/blocks/*.test.ts); write clear names, group with describe(), cover edge cases, errors, special characters, and verify exact output for code-generation functions
Files:
packages/database-integrations/src/database-integration-env-vars.test.tspackages/database-integrations/src/database-integration-metadata-schemas.test.ts
packages/*/src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
packages/*/src/**/*.{ts,tsx}: Use strict type checking and prefer type safety over convenience
Use const for immutable values
Avoid any; use proper type definitions and type guards
Files:
packages/database-integrations/src/database-integration-env-vars.test.tspackages/database-integrations/src/database-integration-metadata-schemas.test.tspackages/database-integrations/src/database-integration-metadata-schemas.tspackages/database-integrations/src/database-integration-env-vars.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.{ts,tsx}: Follow Biome's lint rules as configured in biome.json
Use literal keys (dot notation) instead of bracket notation when possible
Prefer single quotes for strings (except when avoiding escapes)
Files:
packages/database-integrations/src/database-integration-env-vars.test.tspackages/database-integrations/src/database-integration-metadata-schemas.test.tspackages/database-integrations/src/database-integration-metadata-schemas.tspackages/database-integrations/src/database-integration-env-vars.ts
packages/*/src/**/*
📄 CodeRabbit inference engine (CLAUDE.md)
Place source code under packages/*/src/
Files:
packages/database-integrations/src/database-integration-env-vars.test.tspackages/database-integrations/src/database-integration-metadata-schemas.test.tspackages/database-integrations/src/database-integration-metadata-schemas.tspackages/database-integrations/src/database-integration-env-vars.ts
🧬 Code graph analysis (2)
packages/database-integrations/src/database-integration-env-vars.test.ts (1)
packages/database-integrations/src/database-integration-env-vars.ts (1)
getEnvironmentVariablesForIntegrations(30-90)
packages/database-integrations/src/database-integration-env-vars.ts (1)
packages/database-integrations/src/index.ts (1)
EnvVar(4-4)
🪛 GitHub Actions: CI
packages/database-integrations/src/database-integration-env-vars.test.ts
[error] 183-183: CSpell: Unknown word CACERTIFICATETEXT
[error] 187-187: CSpell: Unknown word CACERTIFICATENAME
[error] 1383-1383: CSpell: Unknown word CACERTIFICATETEXT
[error] 1387-1387: CSpell: Unknown word CACERTIFICATENAME
[error] 1765-1765: CSpell: Unknown word CACERTIFICATETEXT
[error] 1769-1769: CSpell: Unknown word CACERTIFICATENAME
🔇 Additional comments (6)
packages/database-integrations/src/database-integration-metadata-schemas.test.ts (1)
764-764: LGTM!Test updates correctly verify that caCertificateText is accepted by the schemas.
Also applies to: 775-775, 816-816, 827-827, 868-868, 879-879
packages/database-integrations/src/database-integration-env-vars.ts (2)
46-72: LGTM!Filtering caCertificateText from env vars is correct since only the file path (derived from caCertificateName) is needed. MongoDB SSL injection refactored cleanly into the metadata-map flow.
92-115: LGTM!MongoDB SSL injection correctly uses caCertificateName to construct the filesystem path, not the certificate text itself.
packages/database-integrations/src/database-integration-env-vars.test.ts (3)
161-196: LGTM!Test correctly verifies that caCertificateText is excluded from env vars while caCertificateName remains, and that SQLAlchemy uses the filesystem path.
1361-1396: LGTM!MySQL test mirrors the AlloyDB pattern and correctly validates the exclusion behavior.
1743-1778: LGTM!PostgreSQL test correctly validates the behavior. CSpell errors for CACERTIFICATETEXT and CACERTIFICATENAME are false positives—these are valid uppercase environment variable names.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #123 +/- ##
==========================================
+ Coverage 95.24% 95.26% +0.01%
==========================================
Files 25 25
Lines 715 718 +3
Branches 207 210 +3
==========================================
+ Hits 681 684 +3
Misses 34 34 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
53b7102 to
8abdc03
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (6)
cspell.json(1 hunks)packages/database-integrations/src/database-integration-env-vars.test.ts(3 hunks)packages/database-integrations/src/database-integration-env-vars.ts(1 hunks)packages/database-integrations/src/database-integration-metadata-schemas.test.ts(6 hunks)packages/database-integrations/src/database-integration-metadata-schemas.ts(1 hunks)packages/database-integrations/src/database-integration-types.ts(1 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
packages/*/src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
packages/*/src/**/*.{ts,tsx}: Use strict type checking and prefer type safety over convenience
Use const for immutable values
Avoid any; use proper type definitions and type guards
Files:
packages/database-integrations/src/database-integration-env-vars.tspackages/database-integrations/src/database-integration-metadata-schemas.test.tspackages/database-integrations/src/database-integration-metadata-schemas.tspackages/database-integrations/src/database-integration-env-vars.test.tspackages/database-integrations/src/database-integration-types.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.{ts,tsx}: Follow Biome's lint rules as configured in biome.json
Use literal keys (dot notation) instead of bracket notation when possible
Prefer single quotes for strings (except when avoiding escapes)
Files:
packages/database-integrations/src/database-integration-env-vars.tspackages/database-integrations/src/database-integration-metadata-schemas.test.tspackages/database-integrations/src/database-integration-metadata-schemas.tspackages/database-integrations/src/database-integration-env-vars.test.tspackages/database-integrations/src/database-integration-types.ts
packages/*/src/**/*
📄 CodeRabbit inference engine (CLAUDE.md)
Place source code under packages/*/src/
Files:
packages/database-integrations/src/database-integration-env-vars.tspackages/database-integrations/src/database-integration-metadata-schemas.test.tspackages/database-integrations/src/database-integration-metadata-schemas.tspackages/database-integrations/src/database-integration-env-vars.test.tspackages/database-integrations/src/database-integration-types.ts
packages/*/src/**/*.test.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
packages/*/src/**/*.test.{ts,tsx}: Place test files next to the source files with .test.ts or .test.tsx extension
Use Vitest as the testing framework for all tests
Import { describe, expect, it } from 'vitest' in tests
Use dedent from ts-dedent for multiline string comparisons in tests
Follow existing test patterns (see packages/blocks/src/blocks/*.test.ts); write clear names, group with describe(), cover edge cases, errors, special characters, and verify exact output for code-generation functions
Files:
packages/database-integrations/src/database-integration-metadata-schemas.test.tspackages/database-integrations/src/database-integration-env-vars.test.ts
🧬 Code graph analysis (2)
packages/database-integrations/src/database-integration-env-vars.ts (1)
packages/database-integrations/src/index.ts (1)
EnvVar(4-4)
packages/database-integrations/src/database-integration-env-vars.test.ts (1)
packages/database-integrations/src/database-integration-env-vars.ts (1)
getEnvironmentVariablesForIntegrations(30-90)
🔇 Additional comments (8)
cspell.json (1)
43-44: LGTM!Spell-check vocabulary correctly extended for the new SSL certificate field names.
packages/database-integrations/src/database-integration-metadata-schemas.ts (1)
216-235: LGTM!SSL fields correctly added to MariaDB, MindsDB, and MySQL schemas. Pattern matches existing implementations (clickhouse, pgsql, alloydb). Optional without cross-validation as clarified in previous review.
Based on learnings
packages/database-integrations/src/database-integration-metadata-schemas.test.ts (3)
756-779: LGTM!MariaDB tests correctly validate optional SSL fields.
810-833: LGTM!MindsDB tests correctly validate optional SSL fields.
864-887: LGTM!MySQL tests correctly validate optional SSL fields.
packages/database-integrations/src/database-integration-types.ts (1)
28-28: LGTM!AlloyDB correctly added to SSL support list, aligning with its schema.
packages/database-integrations/src/database-integration-env-vars.test.ts (2)
161-196: LGTM!AlloyDB test correctly verifies caCertificateText exclusion, caCertificateName inclusion, and filesystem path usage in SQLAlchemy.
1361-1396: LGTM!MySQL test correctly verifies caCertificateText exclusion, caCertificateName inclusion, and filesystem path usage in SQLAlchemy.
| export type DatabaseIntegrationType = (typeof databaseIntegrationTypes)[number] | ||
|
|
||
| export const databaseIntegrationTypesWithSslSupport = [ | ||
| 'alloydb', |
There was a problem hiding this comment.
Adding AlloyDB here because our webapp UI supports configuring SSL for this integration type.
| .filter(([key]) => { | ||
| // Filter out caCertificateText - we only provide the path, not the cert text | ||
| return key !== 'caCertificateText' | ||
| }) |
There was a problem hiding this comment.
- We are only using the CA certificate name when constructing the SQL alchemy inputs.
- These variables are unnecessarily leaking the certificate contents as env variables. (If anyone thinks that would be desirable, speak up; as far as I know, we do not need this. The certs might also be pretty big.)
The
caCertificateTextfield should always accompany thecaCertificateNamefield.Summary by CodeRabbit
New Features
Bug Fixes / Behavior Changes
Tests
Chores