Skip to content

feat(snowflake): add Cortex Analyst operations to the Snowflake block - #8347

Merged
waleedlatif1 merged 3 commits into
stagingfrom
feat/snowflake-cortex-analyst
Sep 26, 2026
Merged

waleedlatif1 merged 3 commits into
stagingfrom
feat/snowflake-cortex-analyst

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • Add Snowflake Cortex Analyst to the existing Snowflake block. It uses the same programmatic access token credential, with no new auth.
  • Ask Cortex Analyst (POST /api/v2/cortex/analyst/message):
    • Takes a question and exactly one semantic source: a semantic view, a staged semantic model file, inline YAML, or several sources for Cortex Analyst to choose between (semantic_models).
    • Returns the interpretation, the SQL, the verified query used, suggestions (for ambiguous questions), warnings, question category and model names.
    • Returns a conversation output to pass back as history for multi-turn follow-ups. Analyst turns are echoed in the documented request shape (text plus SQL statement).
    • Optional Run Generated SQL chains the existing Execute SQL tool on the same credential. It runs in the semantic view's database and schema when those are fully qualified, and reuses the block's warehouse, role, max rows and timeout fields. Queries that are still running after 45 seconds come back as RUNNING, and Get Statement fetches the rows.
  • Send Cortex Analyst Feedback (POST /api/v2/cortex/analyst/feedback): request ID, required thumbs up/down, optional comment.
  • The question, history and inline semantic model YAML are declared as model input, since Cortex Analyst sends them to an LLM. View names and stage paths stay ordinary identifiers.
  • Three Slack-orchestration templates (thread-scoped analyst, multi-view router, KPI digest) and an ask-cortex-analyst skill.
  • Extended the Snowflake param-coercion contract fixture with the new JSON params (count 54 → 58).

Type of Change

  • New feature

Testing

  • Checked every request field, header and response path against the Cortex Analyst REST reference, the multi-turn and access-control docs, and the PAT authentication docs. An independent audit pass also checked them against the docs.
  • Ran the tools against the documented example payloads:
    • request bodies for all four sources, the exactly-one rule, and multi-turn history
    • the verified-query response and the suggestions response
    • conversation round-trips
    • the Run SQL chain, including returned and thrown failures
    • feedback bodies, and the block's source inference and clearing
  • bun run lint, type-check, check-block-registry, check:audits, docs-manifest:check, canvas sentences 32/32.
  • tools/snowflake + blocks/blocks.test.ts + tools/model-input-selectors.test.ts (99 passing). The updated coercion contract fails when the new coercion is removed.
  • Not run against a live Snowflake account.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing (new tests pass the test-audit authoring gate)
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
docs Ready Ready Preview Sep 26, 2026 10:35pm UTC

Request Review

@cubic-dev-ai cubic-dev-ai Bot 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.

All reported issues were addressed across 13 files

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread apps/sim/blocks/blocks/snowflake.ts
Comment thread apps/sim/tools/snowflake/cortex.ts Outdated
@greptile-apps

greptile-apps Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium risk] Adds Cortex Analyst question-answering operations to Snowflake integration.

The PR appears safe to merge based on the reviewed changes and resolved prior findings.

Summary

The PR adds Cortex Analyst questions and feedback to the Snowflake block, including conversation replay, optional execution of generated SQL, documentation, and integration metadata.

  • The latest changes infer the semantic-source selector for programmatically created blocks and use the selected source’s schema when executing SQL.
  • Previously raised findings are resolved or withdrawn; no new actionable issue was established.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Question and semantic source] --> B[Cortex Analyst]
  B --> C[Answer and conversation]
  C -->|Run Generated SQL enabled| D[Execute SQL in selected source context]
  C -->|Request ID| E[Send feedback]
Loading

Reviews (3) · Last reviewed commit: "fix(snowflake): run Cortex Analyst SQL w..."

Comment thread apps/sim/tools/snowflake/cortex.ts Outdated
Comment thread apps/sim/tools/snowflake/cortex.ts
Comment thread apps/sim/tools/snowflake/utils.test.ts
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 26, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot 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.

No issues found across 13 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

Comment thread apps/sim/tools/snowflake/cortex.ts Outdated
…hosen source's schema, and document access requirements
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 26, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot 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.

All reported issues were addressed across 13 files

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread apps/sim/tools/snowflake/cortex_analyst_ask.ts
@waleedlatif1
waleedlatif1 merged commit 045788f into staging Sep 26, 2026
32 checks passed
@waleedlatif1
waleedlatif1 deleted the feat/snowflake-cortex-analyst branch September 26, 2026 23:25

This branch was successfully deployed

1 active deployment
Preview — d691019b Deployed Sep 26, 2026 by vercel[bot]
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.

1 participant