Skip to content

feat: Google native file export (RFC 0003)#72

Merged
rmanibus merged 1 commit into
mainfrom
feat/google-native-documents
Mar 8, 2026
Merged

feat: Google native file export (RFC 0003)#72
rmanibus merged 1 commit into
mainfrom
feat/google-native-documents

Conversation

@rmanibus
Copy link
Copy Markdown
Contributor

@rmanibus rmanibus commented Mar 8, 2026

Summary

Implement RFC 0003 by exporting Google-native files (Docs/Sheets/Slides/etc.) during backup so they are represented as real content in snapshots.

What Changes

  • Google Drive source enhancements:
    • detect native document MIME types
    • add export handling for native files
    • wire export path into normal source walk/change flows
  • Backup scan integration updates for native export handling.
  • CLI backup flow updates related to Google native handling.
  • Tests added/expanded for native export behavior and backup scan integration.

Files of Interest

  • pkg/source/gdrive_native.go
  • pkg/source/gdrive_native_test.go
  • pkg/source/gdrive.go
  • pkg/source/gdrive_changes.go
  • internal/engine/backup_scan.go
  • internal/engine/backup_scan_test.go
  • pkg/source/gdrive_test.go

Behavior Notes

  • Google-native documents are exported into supported formats before content-addressed storage.
  • Non-native files continue through the existing download path.

Tracking

@rmanibus rmanibus force-pushed the feat/google-native-documents branch from de0dc2b to f78d2a0 Compare March 8, 2026 12:11
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 8, 2026

Codecov Report

❌ Patch coverage is 57.14286% with 36 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pkg/source/gdrive.go 40.00% 24 Missing ⚠️
cmd/cloudstic/cmd_backup.go 33.33% 8 Missing ⚠️
pkg/source/gdrive_changes.go 33.33% 4 Missing ⚠️

📢 Thoughts on this report? Let us know!

@rmanibus rmanibus force-pushed the feat/google-native-documents branch from f78d2a0 to 8faa747 Compare March 8, 2026 12:38
@rmanibus rmanibus merged commit b358217 into main Mar 8, 2026
5 of 6 checks passed
@rmanibus rmanibus deleted the feat/google-native-documents branch March 8, 2026 12:47
@rmanibus rmanibus changed the title feat: support google native documents export feat: Google native file export (RFC 0003) Mar 15, 2026
@rmanibus rmanibus added the enhancement New feature or request label Mar 15, 2026
@rmanibus rmanibus linked an issue Mar 15, 2026 that may be closed by this pull request
@rmanibus rmanibus requested review from Copilot March 16, 2026 07:27
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR implements RFC 0003 by adding support for exporting Google-native files (Docs, Sheets, Slides, etc.) during backup. Native files, which cannot be downloaded directly from Google Drive, are now exported to standard formats (e.g., .docx, .xlsx, .pptx) before content-addressed storage. Change detection uses headRevisionId instead of size/hash comparisons, which are unreliable for exported files.

Changes:

  • New gdrive_native.go with MIME type detection, export format mapping, and extension helpers; integrated into Walk, WalkChanges, toFileMeta, and GetFileStream flows.
  • Change detection in backup_scan.go uses headRevisionId-based fast path for native files, carrying forward content metadata when unchanged.
  • CLI --skip-native-files flag to opt out of native file export for both gdrive and gdrive-changes source types.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
rfcs/0003-google-native-file-export.md Status updated to Implemented; section renumbered
pkg/source/gdrive_native.go New file: native MIME detection, export MIME/extension mapping
pkg/source/gdrive_native_test.go Tests for native helper functions
pkg/source/gdrive.go GDriveSource gains mimeTypes map, skipNativeFiles option, export routing in GetFileStream, native name/metadata handling in toFileMeta and visitEntryWithPath
pkg/source/gdrive_changes.go WalkChanges initializes mimeTypes, adds headRevisionId to fields, skips native files when opted out, records MIME in changeToFileChange
pkg/source/gdrive_test.go Comprehensive tests for toFileMeta, visitEntryWithPath, changeToFileChange, and option wiring
internal/engine/backup_scan.go detectChange native fast-path using headRevisionId; new isGoogleNativeMeta helper
internal/engine/backup_scan_test.go Tests for native change detection, empty revID, and metadata carry-forward
cmd/cloudstic/cmd_backup.go --skip-native-files CLI flag; initSource updated for both gdrive source types

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

}

// Record MIME type for GetFileStream export routing.
if ch.File.MimeType != "application/vnd.google-apps.folder" {
@rmanibus rmanibus review requested due to automatic review settings March 23, 2026 21:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RFC 0003: Epic / Tracking issue for Google native file export

2 participants