Skip to content

fix(database-integrations): support legacy redshift metadata with undefined auth method - #146

Merged
saltenasl merged 2 commits into
mainfrom
ls/fix-legacy-redshift
Nov 13, 2025
Merged

saltenasl merged 2 commits into
mainfrom
ls/fix-legacy-redshift

Conversation

@saltenasl

@saltenasl saltenasl commented Nov 13, 2025 •

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • Bug Fixes

    • Added support for legacy Redshift integrations that lack an explicit authentication method; these now default to username and password authentication, ensuring backward compatibility with older configurations.
  • Tests

    • Expanded test coverage for Redshift metadata validation with legacy configuration scenarios.

@saltenasl
saltenasl requested a review from a team as a code owner November 13, 2025 15:16
@coderabbitai

coderabbitai Bot commented Nov 13, 2025 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

This PR adds backward compatibility for legacy Redshift integrations missing an explicit authMethod. A preprocessing step in the metadata schema now injects UsernameAndPassword as the default when authMethod is absent. The runtime logic in getRedshiftSqlAlchemyInput also defaults the field before federation checks, preventing undefined reference errors. Tests are expanded to verify this behavior for null, undefined, and missing cases.

Sequence Diagram

sequenceDiagram
    participant Input as Legacy/New Input
    participant Schema as Schema Validation
    participant Runtime as Runtime Processing
    participant Output as SQLAlchemy URL

    rect rgb(200, 220, 255)
    Note over Schema,Runtime: New Flow: Preprocessing + Default
    end

    Input->>Schema: Raw metadata (authMethod missing)
    Schema->>Schema: Preprocess: inject authMethod = UsernameAndPassword
    Schema->>Schema: Validate union (now matches first branch)
    Schema->>Runtime: Validated metadata
    Runtime->>Runtime: Guard: default authMethod if still missing
    Runtime->>Runtime: Federation checks (safe now)
    Runtime->>Output: Generate SQLAlchemy URL with port
    Output-->>Input: Success
Loading

Possibly related PRs

Suggested reviewers

  • Artmann

Pre-merge checks

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding support for legacy Redshift metadata when authMethod is undefined, which aligns with all file modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

📜 Recent 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.

📥 Commits

Reviewing files that changed from the base of the PR and between 880ece1 and c893e0d.

📒 Files selected for processing (4)
  • packages/database-integrations/src/database-integration-env-vars.test.ts (1 hunks)
  • packages/database-integrations/src/database-integration-env-vars.ts (1 hunks)
  • packages/database-integrations/src/database-integration-metadata-schemas.test.ts (3 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.ts
  • packages/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.ts
  • packages/database-integrations/src/database-integration-metadata-schemas.ts
  • packages/database-integrations/src/database-integration-metadata-schemas.test.ts
  • packages/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.ts
  • packages/database-integrations/src/database-integration-metadata-schemas.ts
  • packages/database-integrations/src/database-integration-metadata-schemas.test.ts
  • packages/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.ts
  • packages/database-integrations/src/database-integration-metadata-schemas.ts
  • packages/database-integrations/src/database-integration-metadata-schemas.test.ts
  • packages/database-integrations/src/database-integration-env-vars.ts
🧬 Code graph analysis (4)
packages/database-integrations/src/database-integration-env-vars.test.ts (2)
packages/database-integrations/src/database-integration-env-vars.ts (1)
  • getEnvironmentVariablesForIntegrations (17-77)
packages/database-integrations/src/index.ts (1)
  • getEnvironmentVariablesForIntegrations (9-9)
packages/database-integrations/src/database-integration-metadata-schemas.ts (1)
packages/database-integrations/src/sql-integration-auth-methods.ts (2)
  • DatabaseAuthMethods (26-29)
  • AwsAuthMethods (1-4)
packages/database-integrations/src/database-integration-metadata-schemas.test.ts (2)
packages/database-integrations/src/sql-integration-auth-methods.ts (1)
  • DatabaseAuthMethods (26-29)
packages/database-integrations/src/database-integration-metadata-schemas.ts (1)
  • databaseMetadataSchemasByType (265-284)
packages/database-integrations/src/database-integration-env-vars.ts (2)
packages/database-integrations/src/index.ts (1)
  • DatabaseAuthMethods (36-36)
packages/database-integrations/src/sql-integration-auth-methods.ts (1)
  • DatabaseAuthMethods (26-29)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov

codecov Bot commented Nov 13, 2025 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.45%. Comparing base (880ece1) to head (c893e0d).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #146      +/-   ##
==========================================
+ Coverage   95.41%   95.45%   +0.03%     
==========================================
  Files          26       26              
  Lines         742      748       +6     
  Branches      223      225       +2     
==========================================
+ Hits          708      714       +6     
  Misses         34       34              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Artmann Artmann left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@saltenasl
saltenasl merged commit 2cf6649 into main Nov 13, 2025
@saltenasl
saltenasl deleted the ls/fix-legacy-redshift branch November 13, 2025 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants