X Tutup
Skip to content

fix(cli): Improve integrations pull command, handle issues more gracefully, reduce output pollution#313

Merged
tkislan merged 4 commits intomainfrom
tk/improve-integrations-pull-command
Feb 20, 2026
Merged

fix(cli): Improve integrations pull command, handle issues more gracefully, reduce output pollution#313
tkislan merged 4 commits intomainfrom
tk/improve-integrations-pull-command

Conversation

@tkislan
Copy link
Contributor

@tkislan tkislan commented Feb 20, 2026

Historically, some old integrations have metadata as empty strings ""
we don't need to validate that strictly when parsing the raw JSON response

Also updated logging

Some examples of debug output

[debug] Skipping invalid or unsupported integration "RNAcentral" (pgsql) [some-uuid]:
[debug]   invalid_type [metadata.host]: Required
[debug]   invalid_type [metadata.user]: Required
[debug]   invalid_type [metadata.password]: Required
[debug]   invalid_type [metadata.database]: Required


[debug] Skipping invalid or unsupported integration "OpenAI API key" (env) [some-uuid]:
[debug]   invalid_union_discriminator [type]: Invalid discriminator value. Expected 'alloydb' | 'athena' | 'big-query' | 'clickhouse' | 'databricks' | 'dremio' | 'mariadb' | 'materialize' | 'mindsdb' | 'mongodb' | 'mysql' | 'pandas-dataframe' | 'pgsql' | 'redshift' | 'snowflake' | 'spanner' | 'sql-server' | 'trino'

without debug, no longer spams output with failed validations

Fetching integrations from https://api.deepnote.com...
Found 295 integration(s).
Updated .env with 103 secret(s)
Successfully updated .deepnote.env.yaml
  Updated 92 existing integration(s)
  Stored 103 secret(s) in .env

Summary by CodeRabbit

  • Bug Fixes

    • Invalid or incompatible integrations are now skipped gracefully during merge operations instead of halting the process.
  • Improvements

    • More detailed debug logging for skipped integrations and validation issues to aid troubleshooting.
    • Integration metadata handling is more flexible, accepting a wider range of metadata structures.
  • Tests

    • Added tests verifying skipped integrations and corresponding debug messages, ensuring only valid integrations are persisted.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 20, 2026

No actionable comments were generated in the recent review. 🎉


📝 Walkthrough

Walkthrough

The changes relax the API integration metadata schema from z.record(z.unknown()) to z.unknown(). During integration merging, invalid or incompatible integrations are no longer logged as errors or abort the merge; they are skipped with debug-level logs. Each validation issue is emitted at debug level with its code, path, and message. Tests were added/updated to assert that invalid or unsupported integrations are skipped and that debug messages are produced.

Sequence Diagram(s)

sequenceDiagram
  participant CLI as CLI (command)
  participant Fetch as Fetch Integrations
  participant Validate as Validator
  participant Merge as Merge Integrations
  participant Output as Debug/Output
  participant FS as File System

  CLI->>Fetch: request integrations
  Fetch->>Validate: parse & validate (metadata now z.unknown)
  Validate-->>Fetch: integration objects
  Fetch->>Merge: provide integrations list
  Merge->>Validate: validate each integration
  alt valid
    Merge->>Merge: include in merged result
  else invalid/unsupported
    Merge->>Output: debug "skipping integration" + issues
    Merge-->>Merge: skip integration
  end
  Merge->>FS: write merged integrations (YAML)
  FS-->>CLI: write complete
Loading
🚥 Pre-merge checks | ✅ 3 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Updates Docs ⚠️ Warning PR implements feature improvements but does not update documentation files for integrations pull command changes. Update /docs/integrations.md and/or /packages/cli/README.md to document relaxed validation and improved error handling.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed Title directly describes the main change: improving integrations pull command with graceful error handling and reduced logging noise.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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

@codecov
Copy link

codecov bot commented Feb 20, 2026

Codecov Report

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

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #313      +/-   ##
==========================================
+ Coverage   82.63%   82.66%   +0.03%     
==========================================
  Files         114      114              
  Lines        6939     6941       +2     
  Branches     1914     1853      -61     
==========================================
+ Hits         5734     5738       +4     
+ Misses       1205     1203       -2     

☔ 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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/cli/src/integrations/fetch-integrations.ts`:
- Around line 66-68: The code unconditionally writes the API response to
"integrations-response.json" using fs.writeFileSync in fetch-integrations.ts,
which pollutes the cwd and blocks the event loop; either remove the import+write
line entirely or gate it behind a debug flag (e.g., if
(process.env.DEBUG_INTEGRATIONS) { await import('node:fs').then(fs =>
fs.promises.writeFile('integrations-response.json', JSON.stringify(json, null,
2))); }) and use the async fs.promises.writeFile API instead of writeFileSync to
avoid blocking; update/remove the reference to writeFileSync accordingly.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/cli/src/integrations/fetch-integrations.ts`:
- Line 13: The schema currently uses metadata: z.unknown(), which permits any
value; tighten this by replacing z.unknown() with a narrower union such as
z.union([z.record(z.unknown()), z.string()]) (or another union matching expected
shapes) to preserve type safety while supporting legacy cases; update the schema
entry named metadata and any dependent types/usages to handle the chosen union
(add guards or refinements where the code accesses metadata properties).

coderabbitai[bot]
coderabbitai bot previously approved these changes Feb 20, 2026
@tkislan tkislan marked this pull request as ready for review February 20, 2026 15:28
@tkislan tkislan requested a review from a team as a code owner February 20, 2026 15:28
@tkislan tkislan enabled auto-merge (squash) February 20, 2026 15:46
@tkislan tkislan merged commit b612ab7 into main Feb 20, 2026
21 checks passed
@tkislan tkislan deleted the tk/improve-integrations-pull-command branch February 20, 2026 15:49
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

X Tutup