Skip to content

fix: properly handle set_cloud_connection_table_prefix tool within safe mode#847

Merged
Aaron ("AJ") Steers (aaronsteers) merged 1 commit into
mainfrom
aj/mcp/fix/table-prefix-changes-are-descructive
Oct 25, 2025
Merged

fix: properly handle set_cloud_connection_table_prefix tool within safe mode#847
Aaron ("AJ") Steers (aaronsteers) merged 1 commit into
mainfrom
aj/mcp/fix/table-prefix-changes-are-descructive

Conversation

@aaronsteers

@aaronsteers Aaron ("AJ") Steers (aaronsteers) commented Oct 24, 2025

Copy link
Copy Markdown
Member

In a thorough stress test of the new safe mode (including static code analysis), this was the one finding.

Summary by CodeRabbit

  • Bug Fixes

    • Enhanced session validation for cloud connection operations.
  • New Features

    • Added destructive operation safeguards with improved confirmation requirements and detailed response messages.
  • Documentation

    • Added caution warnings for potentially destructive operations.

@github-actions

Copy link
Copy Markdown

👋 Greetings, Airbyte Team Member!

Here are some helpful tips and reminders for your convenience.

Testing This PyAirbyte Version

You can test this version of PyAirbyte using the following:

# Run PyAirbyte CLI from this branch:
uvx --from 'git+https://github.com/airbytehq/PyAirbyte.git@aj/mcp/fix/table-prefix-changes-are-descructive' pyairbyte --help

# Install PyAirbyte from this branch for development:
pip install 'git+https://github.com/airbytehq/PyAirbyte.git@aj/mcp/fix/table-prefix-changes-are-descructive'

Helpful Resources

PR Slash Commands

Airbyte Maintainers can execute the following slash commands on your PR:

  • /fix-pr - Fixes most formatting and linting issues
  • /poetry-lock - Updates poetry.lock file
  • /test-pr - Runs tests with the updated PyAirbyte

Community Support

Questions? Join the #pyairbyte channel in our Slack workspace.

📝 Edit this welcome message.

@coderabbitai

coderabbitai Bot commented Oct 24, 2025

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

The set_cloud_connection_table_prefix tool in the cloud ops module is marked as destructive. The function now validates the connection ID against the session context and returns a confirmation message with the new prefix and connection URL instead of silently performing the operation.

Changes

Cohort / File(s) Change Summary
Destructive tool marking and validation
airbyte/mcp/cloud_ops.py
Decorator updated to destructive=True on set_cloud_connection_table_prefix method; added session-guid validation for connection_id; modified return behavior to provide success confirmation with new prefix and connection URL; expanded docstring with destructiveness caution.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

The change is localized to a single method with straightforward additions: a decorator flag, validation logic, and return value modification. No complex logic patterns or multi-file refactoring involved.

Possibly related PRs

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The pull request title directly aligns with the main changes in the changeset. The title states the fix is about "properly handle set_cloud_connection_table_prefix tool within safe mode," and the changeset implements exactly this by marking the tool as destructive, adding session validation, and ensuring explicit confirmation before changes are made. The title is specific, concise, and clearly communicates the primary purpose of the PR without unnecessary details or vagueness.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch aj/mcp/fix/table-prefix-changes-are-descructive

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 70f55a3 and bfd2c94.

📒 Files selected for processing (1)
  • airbyte/mcp/cloud_ops.py (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
airbyte/mcp/cloud_ops.py (1)
airbyte/mcp/_tool_utils.py (1)
  • check_guid_created_in_session (48-62)
⏰ 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). (6)
  • GitHub Check: Pytest (All, Python 3.10, Ubuntu)
  • GitHub Check: Pytest (All, Python 3.11, Windows)
  • GitHub Check: Pytest (All, Python 3.10, Windows)
  • GitHub Check: Pytest (All, Python 3.11, Ubuntu)
  • GitHub Check: Pytest (Fast)
  • GitHub Check: Pytest (No Creds)
🔇 Additional comments (3)
airbyte/mcp/cloud_ops.py (3)

942-946: LGTM! Appropriate classification as destructive.

Marking this tool as destructive makes sense since changing the table prefix affects where data lands in the destination, which could break downstream queries, dashboards, or ETL processes. This classification is consistent with similar operations like set_cloud_connection_selected_streams, wdyt?


957-970: LGTM! Proper safe mode implementation.

The addition of the caution note in the docstring and the check_guid_created_in_session call are spot-on. This ensures that when AIRBYTE_CLOUD_MCP_SAFE_MODE=1, the function will only modify connections created in the current session, preventing accidental changes to pre-existing infrastructure. The implementation pattern matches other destructive operations in this module nicely.

Based on learnings


970-973: Clear and informative return message.

The success message provides all the essential details: connection ID, the new prefix value, and the connection URL for quick verification. Nice and consistent with the other tools in this module!


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

@github-actions

Copy link
Copy Markdown

PyTest Results (Fast Tests Only, No Creds)

304 tests  ±0   304 ✅ ±0   6m 24s ⏱️ +35s
  1 suites ±0     0 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit bfd2c94. ± Comparison against base commit 70f55a3.

@github-actions

Copy link
Copy Markdown

PyTest Results (Full)

373 tests  ±0   357 ✅ ±0   26m 0s ⏱️ + 1m 38s
  1 suites ±0    16 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit bfd2c94. ± Comparison against base commit 70f55a3.

@aaronsteers Aaron ("AJ") Steers (aaronsteers) merged commit cbb0717 into main Oct 25, 2025
24 checks passed
@aaronsteers Aaron ("AJ") Steers (aaronsteers) deleted the aj/mcp/fix/table-prefix-changes-are-descructive branch October 25, 2025 05:46
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