fix(snowflake): add type assertion for SQL API response#334
fix(snowflake): add type assertion for SQL API response#334
Conversation
…6 errors Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
📝 WalkthroughWalkthroughAdded a type annotation for the Snowflake SQL REST API JSON response and added a new Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
Deploying bubblelab-documentation with
|
| Latest commit: |
0e08e4e
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://49dc9c84.bubblelab-documentation.pages.dev |
| Branch Preview URL: | https://zhubzy-fix-typecheck-errors.bubblelab-documentation.pages.dev |
…errors # Conflicts: # packages/bubble-core/package.json # packages/bubble-runtime/package.json # packages/bubble-scope-manager/package.json # packages/bubble-shared-schemas/package.json # packages/create-bubblelab-app/package.json # packages/create-bubblelab-app/templates/basic/package.json # packages/create-bubblelab-app/templates/reddit-scraper/package.json
There was a problem hiding this comment.
Pull request overview
This PR addresses TypeScript strict-mode typecheck failures in the Snowflake service bubble by asserting the expected Snowflake SQL REST API JSON response shape, and also bumps package/template versions to 0.1.254.
Changes:
- Add an explicit type assertion for
response.json()inSnowflakeBubble.executeStatementto resolve TS18046 (unknown) errors. - Bump versions across several packages to
0.1.254. - Update
create-bubblelab-apptemplates to depend on^0.1.254BubbleLab packages.
Reviewed changes
Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/bubble-core/src/bubbles/service-bubble/snowflake/snowflake.ts | Adds a JSON response type assertion for Snowflake SQL API responses to satisfy strict TS. |
| packages/bubble-core/package.json | Bumps @bubblelab/bubble-core version to 0.1.254. |
| packages/bubble-runtime/package.json | Bumps @bubblelab/bubble-runtime version to 0.1.254. |
| packages/bubble-shared-schemas/package.json | Bumps @bubblelab/shared-schemas version to 0.1.254. |
| packages/bubble-scope-manager/package.json | Bumps @bubblelab/ts-scope-manager version to 0.1.254. |
| packages/create-bubblelab-app/package.json | Bumps create-bubblelab-app version to 0.1.254. |
| packages/create-bubblelab-app/templates/basic/package.json | Updates template dependencies to ^0.1.254. |
| packages/create-bubblelab-app/templates/reddit-scraper/package.json | Updates template dependencies to ^0.1.254. |
| const result = (await response.json()) as { | ||
| resultSetMetaData?: { | ||
| numRows: number; | ||
| rowType: { name: string; type: string; nullable: boolean }[]; | ||
| }; | ||
| data?: (string | null)[][]; | ||
| statementHandle?: string; | ||
| }; |
There was a problem hiding this comment.
The Snowflake SQL API response shape is now duplicated inline as an anonymous type assertion. To reduce drift (especially since executeStatement already has an explicit return type), consider extracting a named type (e.g., SnowflakeStatementResponse) and reusing it here and in the function signature.
…_MODELS The FLAGSHIP alias was removed when model tiers were reorganized into provider-specific keys, but ai-agent.ts still references it for default model config, causing undefined at runtime and 9 test failures. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/bubble-shared-schemas/src/ai-models.ts (1)
44-69: Reminder: Runpnpm build:coreafter modifying shared schemas.As per coding guidelines, shared schemas in
/packages/bubble-shared-schemasrequire rebuilding since it is a separate package and types need to be regenerated. Ensurepnpm build:coreis run after this modification.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/bubble-shared-schemas/src/ai-models.ts` around lines 44 - 69, After changing the shared schema constant RECOMMENDED_MODELS in packages/bubble-shared-schemas/src/ai-models.ts, run the package build to regenerate types and artifacts by executing pnpm build:core; this ensures the updated RECOMMENDED_MODELS (and any exported types like AvailableModel) are compiled and the dependent packages receive the updated schema artifacts.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@packages/bubble-shared-schemas/src/ai-models.ts`:
- Around line 44-69: After changing the shared schema constant
RECOMMENDED_MODELS in packages/bubble-shared-schemas/src/ai-models.ts, run the
package build to regenerate types and artifacts by executing pnpm build:core;
this ensures the updated RECOMMENDED_MODELS (and any exported types like
AvailableModel) are compiled and the dependent packages receive the updated
schema artifacts.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 1ed267ac-9a20-42c4-b605-8e4a59cfc920
📒 Files selected for processing (1)
packages/bubble-shared-schemas/src/ai-models.ts
Summary
The Snowflake bubble's
executeStatementmethod calledresponse.json()which returnsunknownin strict TypeScript, causing three TS18046 errors that were failing CI on main. This adds a type assertion matching the Snowflake SQL REST API response shape.Related Issues
Fixes CI typecheck failures on main.
Type of Change
Checklist
pnpm checkand all tests passScreenshots (Required)
N/A — type-only fix, no UI changes.
Additional Context
The three errors were all in
snowflake.tsat lines 205, 209, and 210:Summary by CodeRabbit
New Features
Refactor