Skip to content

chore(ibis): return v3 error instead of v2 error#1296

Merged
douenergy merged 3 commits intoCanner:mainfrom
goldmedal:chore/show-v3-error
Aug 22, 2025
Merged

chore(ibis): return v3 error instead of v2 error#1296
douenergy merged 3 commits intoCanner:mainfrom
goldmedal:chore/show-v3-error

Conversation

@goldmedal
Copy link
Copy Markdown
Contributor

@goldmedal goldmedal commented Aug 22, 2025

If the SQL fails in the v2 engine, we should return the v3 error instead of the v2 error. It's helpful for us to focus on fixing the v3 SQL syntax.

Summary by CodeRabbit

  • Bug Fixes
    • Improved error handling in v3 connector fallbacks: if a v2 fallback fails, the original v3 error is returned.
    • Applies to query, dry plan, dry plan for data source, and model substitution operations.
    • Users will see clearer, consistent error messages and will no longer encounter unrelated v2 errors during fallbacks.
    • No impact on successful requests or fallback conditions.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Aug 22, 2025

Warning

Rate limit exceeded

@goldmedal has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 1 minutes and 47 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between e760db9 and 57d3113.

⛔ Files ignored due to path filters (1)
  • ibis-server/resources/function_list/postgres.csv is excluded by !**/*.csv
📒 Files selected for processing (3)
  • ibis-server/app/routers/v3/connector.py (5 hunks)
  • ibis-server/tests/routers/v3/connector/postgres/conftest.py (3 hunks)
  • ibis-server/tests/routers/v3/connector/postgres/test_functions.py (1 hunks)

Walkthrough

Introduces inner try/except wrappers around all v2 fallbacks in the v3 connector. When a v2 fallback raises, the original v3 exception is re-raised. Applied to query, dry_plan, dry_plan_for_data_source, and model_substitute. No changes to signatures, parameters, or success-path logic.

Changes

Cohort / File(s) Summary
V3→V2 fallback error handling
ibis-server/app/routers/v3/connector.py
Wrapped v2 fallback calls for query, dry_plan, dry_plan_for_data_source, and model_substitute in inner try/except; on v2 failure, re-raise the original v3 exception; no other logic or API changes.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant C as Client
  participant V3 as V3 Router/Connector
  participant S as Service Logic
  participant V2 as V2 Connector (fallback)

  C->>V3: Request (e.g., query)
  V3->>S: Execute v3 path
  alt v3 succeeds
    S-->>V3: v3 result
    V3-->>C: 200 OK with result
  else v3 raises e
    Note over V3: Fallback to v2
    V3->>V2: Attempt v2 call (wrapped try/except)
    alt v2 succeeds
      V2-->>V3: v2 result
      V3-->>C: 200 OK with v2 result
    else v2 raises err_v2
      Note over V3: Re-raise original v3 error e (not err_v2)
      V3-->>C: Error (from v3)
    end
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

ibis, python

Suggested reviewers

  • douenergy

Poem

I'm a bunny with a try/except hop,
If v3 trips, to v2 I pop—
But should old v2 also fall,
I bring v3’s tale, truest of all.
Two paths, one burrowed end—
Errors returned, not made to pretend. 🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added ibis python Pull requests that update Python code labels Aug 22, 2025
Copy link
Copy Markdown
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: 4

🧹 Nitpick comments (1)
ibis-server/app/routers/v3/connector.py (1)

370-382: Consistency gap: validate fallback still surfaces v2 errors.

If the goal is “always return v3 error when v2 fallback fails,” consider aligning validate with the same pattern.

Proposed change:

-            headers = append_fallback_context(headers, span)
-            return await v2.connector.validate(
-                data_source=data_source,
-                rule_name=rule_name,
-                dto=dto,
-                java_engine_connector=java_engine_connector,
-                headers=headers,
-                is_fallback=True,
-            )
+            headers = append_fallback_context(headers, span)
+            try:
+                return await v2.connector.validate(
+                    data_source=data_source,
+                    rule_name=rule_name,
+                    dto=dto,
+                    java_engine_connector=java_engine_connector,
+                    headers=headers,
+                    is_fallback=True,
+                )
+            except Exception as ve:
+                logger.debug(
+                    "v2 fallback also failed for v3 validate; returning original v3 error: {}",
+                    str(ve),
+                )
+                raise e from None
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • 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 92a1c7d and e760db9.

📒 Files selected for processing (1)
  • ibis-server/app/routers/v3/connector.py (4 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
ibis-server/app/routers/v3/connector.py (1)
ibis-server/app/routers/v2/connector.py (4)
  • query (65-202)
  • dry_plan (312-329)
  • dry_plan_for_data_source (337-358)
  • model_substitute (366-398)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: ci

@goldmedal goldmedal requested a review from douenergy August 22, 2025 09:26
@douenergy douenergy merged commit f55a278 into Canner:main Aug 22, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ibis python Pull requests that update Python code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants