Skip to content

feat(drive): drive_search + drive_read — first additive service module#4

Merged
mabry1985 merged 1 commit into
mainfrom
feat/drive
Jul 3, 2026
Merged

feat(drive): drive_search + drive_read — first additive service module#4
mabry1985 merged 1 commit into
mainfrom
feat/drive

Conversation

@mabry1985

Copy link
Copy Markdown
Contributor

Makes good on the "built to grow" promise: Drive lands as one new module + two tool wrappers on the unchanged auth core.

What

  • gdrive.py: search() — free text escaped into fullText contains '…' and trashed = false (covers title + content; no orderBy — Drive rejects sorting on fullText). read() — Google-native files export as text (Docs → text/plain, Sheets → CSV, Slides → text), text/*/JSON/XML/YAML fetch alt=media, binary files return metadata + a readable refusal instead of mojibake. Content truncates at max_chars with a truncated flag.
  • auth.request(raw=True): exports/media aren't JSON; the raw path keeps the 401-retry + Google-error surfacing uniform.
  • Tools: drive_search(query, max) · drive_read(file_id, max_chars) — read-only, matching the pull-mode posture.
  • Default connect scopes already request drive.readonly (feat: one-click OAuth connect — consent flow, token persistence, Connect button #2), and www.googleapis.com was already in the manifest's network capability.

Test

43 passed (5 new), ruff clean, host-free.

🤖 Generated with Claude Code

- gdrive.py on the shared auth core: full-text search (escaped fullText query,
  trashed excluded), read-as-text (Docs -> text/plain, Sheets -> text/csv,
  Slides -> text/plain via export; text/* + JSON/XML/YAML via alt=media); binary
  files return metadata + a readable refusal, never mojibake
- auth.request grows raw=True for non-JSON bodies (exports/media) — 401 retry and
  error surfacing apply uniformly
- tools drive_search / drive_read (read-only, truncation with a truncated flag)
- default OAuth scopes already include drive.readonly; manifest/README updated

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@protoquinn

protoquinn Bot commented Jul 3, 2026

Copy link
Copy Markdown

👀 Quinn is reviewing — verdict (PASS / WARN / FAIL) + findings to follow.

@mabry1985 mabry1985 merged commit b4cfd8d into main Jul 3, 2026
1 check passed
@mabry1985 mabry1985 deleted the feat/drive branch July 3, 2026 08:46
@mabry1985 mabry1985 mentioned this pull request Jul 3, 2026

@protoquinn protoquinn Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QA Audit — PR #4 | feat(drive): drive_search + drive_read — first additive service module

VERDICT: WARN


CI Status

  • test: in_progress

Diff Review

  • auth.py: raw=True path added cleanly — backward-compatible (defaults False), error handling unchanged, returns resp.text for exports/media
  • gdrive.py (new): search() escapes user input correctly for Drive's fullText syntax; read() handles Google-native export, raw text fetch, and binary refusal with sensible mime-type dispatch
  • __init__.py: two new @tool wrappers follow the existing _run/_creds pattern consistently
  • Docs + manifest updated to reflect the new Drive tools

Observations

  • LOW: clawpatch structural review unavailable (502 — checkout cache couldn't resolve git ref); reviewed from diff alone
  • LOW: gdrive.search() passes max_results directly to min(int(max_results), 50) — a negative value would produce an invalid pageSize, but the tool wrapper caps at 50 and the default is 20, so this is unlikely in practice
  • LOW: gdrive.read() truncation on negative max_chars returns empty content with truncated=True — harmless but odd; consider max(1, int(max_chars)) if you want a floor

— Quinn, QA Engineer

@protoquinn

protoquinn Bot commented Jul 3, 2026

Copy link
Copy Markdown

Submitted COMMENT review on #4.

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