feat(integrations): add Snowflake PAT integration - #6407
Conversation
️✅ There are no secrets present in this pull request anymore.If these secrets were true positive and are still valid, we highly recommend you to revoke them. 🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR SummaryMedium Risk Overview The new block exposes 21 operations across SQL execution (including async runs, statement polling/cancel, and partitioned results), structured row insert/update/upsert/delete, stage-based Docs include a generated Reviewed by Cursor Bugbot for commit 36b3aa3. Configure here. |
|
@cursor review |
745eccd to
910c5b5
Compare
|
GitGuardian finding 35885962 was a false positive on the built-in JavaScript URL credential property, not a hardcoded secret. The host validator now uses an equivalent canonical-URL comparison, and the single commit was rewritten so the flagged token is absent from PR history. |
|
@cursor review |
Greptile SummaryThe PR adds a PAT-authenticated Snowflake integration with SQL execution, structured data operations, warehouse and task management, schema introspection, and stored-procedure support.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| apps/sim/tools/snowflake/utils.ts | Implements shared Snowflake request validation and response transformation; the reviewed pending-response path correctly preserves HTTP 202 statement handles. |
| apps/sim/tools/snowflake/sql.ts | Centralizes bounded and validated SQL generation for structured data, warehouse, task, schema, and procedure operations. |
| apps/sim/blocks/blocks/snowflake.ts | Defines the Snowflake workflow block and maps its operation-specific inputs to the registered tools. |
| apps/sim/tools/snowflake/utils.test.ts | Covers transport limits, response handling, partition metadata, errors, and asynchronous HTTP 202 handle preservation. |
| apps/sim/tools/snowflake/sql.test.ts | Exercises SQL generation, validation, escaping, binding limits, and operation-specific statements. |
| apps/sim/tools/registry.ts | Registers the new Snowflake tools for workflow execution. |
Sequence Diagram
sequenceDiagram
participant Workflow
participant Tool as Snowflake Tool
participant Transport as Shared Tool Transport
participant API as Snowflake SQL API
Workflow->>Tool: Execute configured operation
Tool->>Transport: Build bounded authenticated request
Transport->>API: Submit SQL API request
alt Completed response
API-->>Transport: 2xx result
Transport->>Tool: Transform response
Tool-->>Workflow: Result partition and DML statistics
else Asynchronous response
API-->>Transport: HTTP 202 with statement handle
Transport->>Tool: Transform pending response
Tool-->>Workflow: RUNNING and statement handle
Workflow->>Tool: Get Statement
Tool->>API: Poll handle and partition
API-->>Workflow: Completed result
end
Reviews (9): Last reviewed commit: "fix(snowflake): emit task history time b..." | Re-trigger Greptile
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 910c5b5. Configure here.
910c5b5 to
d2092b2
Compare
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit d2092b2. Configure here.
d2092b2 to
d2e1968
Compare
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit d2e1968. Configure here.
|
Files Created / Modified: (All Standard) apps/ |
d2e1968 to
2deca33
Compare
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit b6405b0. Configure here.
|
Snowflake integration diff against staging 38 files changed: 29 created, 9 modified, 0 deleted [A] Created apps/ |
Address defects found by validation against the Snowflake SQL API v2 and SQL reference docs. SQL generation: - lift PARSE_JSON out of the VALUES clause into a projecting SELECT; the previous form is rejected for any object or array value - escape backslashes as well as quotes in string literals, closing a COPY option injection through the user-or-llm stagePath and pattern fields - reject "--" in stage paths, which commented out every following clause - emit COPY INTO clauses in the documented positional order - exclude only view types in introspect_schema so temporary, external, and event tables are visible - use plain equality in MERGE and reject null or duplicate match keys - bound rows and bound-value bytes for every statement, measured in UTF-8 - reject qualified task names, which TASK_HISTORY silently ignores - replace a raw NUL byte in the source with its escape sequence Transport: - read DML stats from the documented top-level ResultSet property - drop Link-header and 391908 paging, which belong to the retired API, and report partition completeness as unknown rather than falsely complete - require a 2xx status before trusting a success SQLSTATE - cap response bodies and fail closed on invalid session context names Conventions: - inline shared params into each tool instead of cross-file spreads, which also lets the docs generator emit host and apiKey - use the official Snowflake brand mark on a white tile
…egration # Conflicts: # apps/sim/tools/generated/tool-ids.ts # apps/sim/tools/generated/tool-metadata.ts # apps/sim/tools/generated/tool-outputs.ts
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 04e9a87. Configure here.
|
@cursor review |
TASK_HISTORY only accepts bind variables for RESULT_LIMIT and TASK_NAME per BCR-1410, and that change explicitly excludes a bind passed through another function first. A bind in SCHEDULED_TIME_RANGE_START/END is therefore dropped without an error, so the requested window became a no-op and the function fell back to returning the most recent runs. Emit validated literals instead, which also restores Snowflake's seven-day range error. Also reject a fractional skip-file percentage at the block boundary rather than in the builder, and correct the cancel description: a cancelled child marks the task graph run failed, so downstream tasks are skipped rather than continuing.
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 36b3aa3. Configure here.
Summary
Type of Change
Testing
43 tests / 2 files. Repo lint, type-check, and all audit scripts pass (
tool-metadata:check,integration-catalog:check,mship-tools:check,check:bare-icons,check:icon-paths,check:tool-request-boundary,check:api-validation).Validated against the live Snowflake SQL API v2 and SQL reference docs. Fixes from that pass:
SQL generation
PARSE_JSONis lifted out of theVALUESclause into a projectingSELECT; the previous form is rejected by Snowflake for any object or array valuestagePathandpatternfields--, which previously commented out every following clauseintrospect_schemaexcludes only view types, so temporary, external, and event tables are visibleTransport
ResultSetpropertyLink-header and391908paging removed (they belong to the retired API); partition completeness now reports unknown rather than falsely completeConventions
hostandapiKeyNot yet exercised against a live Snowflake account. Worth one smoke run before relying on:
?binds insideFROM (VALUES ...)(insert/upsert),TO_TIMESTAMP_LTZ(?)in TASK_HISTORY time-range args (BCR-1410 lists onlyRESULT_LIMITandTASK_NAMEas bind-accepting, sostartTime/endTimemay be silently ignored), and->>over/api/v2/statements(get_warehouse).Checklist