Skip to content

Validate drive/root consistency; accept drive id or name - #67

Closed
Light2Dark wants to merge 25 commits into
fsspec:masterfrom
marimo-team:sham/validate-drive-root-consistency
Closed

Light2Dark wants to merge 25 commits into
fsspec:masterfrom
marimo-team:sham/validate-drive-root-consistency

Conversation

@Light2Dark

Copy link
Copy Markdown
Collaborator

Summary

Follow-up to #7 (the issue #2 TODO).

  • Enforce that a scoped drive and root_file_id agree:
    • reject a folder root whose driveId differs from the configured drive (now requests driveId in the validation field mask);
    • raise ValueError on a shared-drive root_file_id that conflicts with an already-set drive (previously a silent no-op).
  • Resolve the drive argument by id or name (was name-only), via the new _resolve_drive_id; fix the misleading docstring that called it an "ID" while only accepting a name.
  • Minor: clearer "not found" error messages.

Test plan

  • uv run pytest tests/test_core.py — 42 passed, 4 integration deselected
  • uv run pyrefly check — 0 errors
  • Integration (-m integration, requires live Drive creds): folder root in a different drive is rejected; shared-drive-id drive resolves the same as its name

Made with Cursor

Light2Dark and others added 25 commits June 23, 2026 07:51
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Request mimeType and reject non-folder IDs so a regular file passed as
root_file_id no longer masquerades as an empty directory under ls("").
Add a TODO for the conflicting drive vs shared-drive root_file_id case
(issue #2) to handle in a follow-up.

Co-authored-by: Cursor <cursoragent@cursor.com>
Add integration tests asserting a file ID is rejected as root
(NotADirectoryError) and a folder ID lists its children. Introduce a
typed DriveConfig + make_fs factory fixture in conftest so live
filesystems are built from env in one place and tests can create
multiple instances with a shared teardown. Add tests to pyrefly
search-path and document Drive API constants.

Co-authored-by: Cursor <cursoragent@cursor.com>
Enforce that a scoped drive and root_file_id agree: reject a folder root
whose driveId differs from the configured drive, and raise on a
shared-drive root_file_id that conflicts with an already-set drive
(previously a silent no-op).

Also resolve the `drive` argument by id or name (was name-only) and
correct the docstring accordingly.

Co-authored-by: Cursor <cursoragent@cursor.com>
@Light2Dark

Copy link
Copy Markdown
Collaborator Author

Opened against the wrong repo; recreating on the Light2Dark fork.

@Light2Dark Light2Dark closed this Jun 28, 2026
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