Skip to content

fix(tool_google_workspace): make check_connection actually probe the API - #1700

Open
madhumitha-chandrasekaran-1 wants to merge 1 commit into
rocketride-org:developfrom
madhumitha-chandrasekaran-1:fix/RR-1694-check-connection-live-probe
Open

fix(tool_google_workspace): make check_connection actually probe the API#1700
madhumitha-chandrasekaran-1 wants to merge 1 commit into
rocketride-org:developfrom
madhumitha-chandrasekaran-1:fix/RR-1694-check-connection-live-probe

Conversation

@madhumitha-chandrasekaran-1

@madhumitha-chandrasekaran-1 madhumitha-chandrasekaran-1 commented Jul 28, 2026

Copy link
Copy Markdown

Summary

check_connection for gmail/drive/docs/sheets derived connection_ok entirely
from local checks (client object constructed, token's claimed scopes look
right) — it never called Google. calendar was the only service with a live
probe wired. That's why a disabled Google API on the caller's project was
invisible: connection_ok: true while every real call 403'd with
accessNotConfigured.

  • Wire a live probe for gmail (users().getProfile), drive (about().get),
    and docs/sheets (get() against a made-up resource id, swallowing the
    expected 404 — neither API has a list/about endpoint to probe cheaply).
  • _check_connection_impl no longer defaults connection_ok to True when
    no probe runs; it now reports 'unknown'. Also fixes a latent bug where the
    scope-coverage check (connection_ok and covered) could silently coerce
    that sentinel back to a bool.
  • execute() now attaches the structured Google reason code (e.g.
    accessNotConfigured vs forbidden vs rateLimitExceeded) to raised
    errors, surfaced as errorReason in the diagnostic output.
  • Updated README diagnostics bullets for the co-located docs contract.

Closes #1694

Test plan

  • pytest nodes/test/tool_google_workspace/ — 353 passed, 20 skipped
    (skipped tests require live Gmail OAuth creds, unrelated to this change)
  • ruff check / ruff format --check clean
  • Live-verified against real Google servers: built and ran the engine
    locally, then called check_connection with a syntactically-valid but
    fake OAuth token (httplib2 debug logging on). Confirmed a real HTTPS
    round-trip to gmail.googleapis.com and a genuine 401 from Google,
    with connection_ok correctly flipping to false. Re-ran the identical
    script against the pre-fix code (via a temporary git stash of just
    these two files) to confirm it silently returned connection_ok: true
    with zero network traffic — the exact bug in the issue.

Summary by CodeRabbit

  • New Features

    • Added live API connectivity checks for Google Docs, Drive, Gmail, and Sheets.
    • Connection diagnostics now report scope coverage, checks performed, and detailed error reasons.
    • Improved handling of invalid tokens and API access or configuration errors.
    • Enhanced rate-limit and quota error detection with clearer messages.
  • Documentation

    • Updated tool descriptions and guides to explain live connectivity and scope verification.
  • Tests

    • Added coverage for successful probes, expected not-found responses, and configuration failures.

connection_ok was derived only from local checks (client constructed,
token scopes claimed) for gmail/drive/docs/sheets, since check_connection
called _check_connection_impl() without a probe. calendar was the only
service with a live probe wired, so a disabled Google API on the caller's
project was invisible everywhere else — connection_ok: true while every
real call 403'd.

- Wire a live probe for gmail (users().getProfile), drive (about().get),
  and docs/sheets (a made-up-id get(), swallowing the expected 404 since
  neither API has a list/about endpoint to probe cheaply).
- _check_connection_impl no longer defaults to True when no probe runs;
  it reports 'unknown' instead, and fixes a bug where the scope-coverage
  check could silently coerce that sentinel back to a bool.
- execute() now attaches the structured Google reason code (e.g.
  accessNotConfigured vs forbidden vs rateLimitExceeded) to raised
  errors, surfaced as errorReason.

Closes rocketride-org#1694
@github-actions

Copy link
Copy Markdown
Contributor
🤖 Internal: Discord sync marker

Auto-managed by the Discord notification workflow. Stores the linked Discord message ID and forum thread ID. Do not edit or delete.

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Google Workspace connection diagnostics now perform service-specific API probes, report unknown status when no probe runs, validate OAuth scope coverage, and surface structured API error reasons across Docs, Drive, Gmail, and Sheets.

Changes

Google Workspace diagnostics

Layer / File(s) Summary
Structured Google API errors
nodes/src/nodes/tool_google_workspace/google_client.py
Structured error reasons now drive rate-limit detection, 403 messages, and exception metadata.
Connection-check status and scope reporting
nodes/src/nodes/tool_google_workspace/IInstance.py
Diagnostics track executed checks, distinguish verified and unknown states, validate token scopes, and report probe failures.
Service probes and validation
nodes/src/nodes/tool_google_workspace/{docs,drive,gmail,sheets}/..., nodes/test/tool_google_workspace/{docs,drive,gmail,sheets}/...
Docs, Drive, Gmail, and Sheets invoke live probes, update diagnostic descriptions, and test successful, 404, and API-configuration failure responses.

Estimated code review effort: 3 (Moderate) | ~30 minutes

Sequence Diagram(s)

sequenceDiagram
  participant check_connection
  participant _check_connection_impl
  participant GoogleWorkspaceAPI
  participant token_scope_report
  participant diagnostics

  check_connection->>_check_connection_impl: provide service-specific probe
  _check_connection_impl->>GoogleWorkspaceAPI: execute live API probe
  GoogleWorkspaceAPI-->>_check_connection_impl: success, 404, or structured error
  _check_connection_impl->>token_scope_report: validate required OAuth scopes
  token_scope_report-->>_check_connection_impl: coverage and missing scopes
  _check_connection_impl-->>diagnostics: connection_ok, checked, and errorReason
Loading

Possibly related PRs

Suggested reviewers: jmaionchi, rod-christensen, stepmikhaylov

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR covers Gmail, Drive, Docs, and Sheets probes plus unknown/no-probe reporting, but it does not implement the required Calendar probe for #1694. Add the Calendar live probe (calendarList().list) and ensure it feeds connection_ok and errorReason like the other Workspace tools.
Docstring Coverage ⚠️ Warning Docstring coverage is 58.62% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly states the main change: making check_connection actively probe the API.
Out of Scope Changes check ✅ Passed The changes stay focused on connection diagnostics, live probes, error reporting, and related documentation.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

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

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@nodes/src/nodes/tool_google_workspace/gmail/IInstance.py`:
- Line 150: Update the Gmail connection probe in the relevant instance method to
call execute with both the Gmail service descriptor and the users.getProfile
request, preserving the existing userId='me' request and _check_connection_impl
flow.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 738a1f45-287d-4890-83e0-6440320bf84b

📥 Commits

Reviewing files that changed from the base of the PR and between 1483794 and 49ca419.

📒 Files selected for processing (14)
  • nodes/src/nodes/tool_google_workspace/IInstance.py
  • nodes/src/nodes/tool_google_workspace/docs/IInstance.py
  • nodes/src/nodes/tool_google_workspace/docs/README.md
  • nodes/src/nodes/tool_google_workspace/drive/IInstance.py
  • nodes/src/nodes/tool_google_workspace/drive/README.md
  • nodes/src/nodes/tool_google_workspace/gmail/IInstance.py
  • nodes/src/nodes/tool_google_workspace/gmail/README.md
  • nodes/src/nodes/tool_google_workspace/google_client.py
  • nodes/src/nodes/tool_google_workspace/sheets/IInstance.py
  • nodes/src/nodes/tool_google_workspace/sheets/README.md
  • nodes/test/tool_google_workspace/docs/test_docs.py
  • nodes/test/tool_google_workspace/drive/test_drive.py
  • nodes/test/tool_google_workspace/gmail/test_gmail.py
  • nodes/test/tool_google_workspace/sheets/test_sheets.py

Comment thread nodes/src/nodes/tool_google_workspace/gmail/IInstance.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation module:nodes Python pipeline nodes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tool_google_workspace: connection_ok reports true when the Google API is disabled

2 participants