Skip to content

feat(adapters): add supabase adapter#2

Merged
cersho merged 4 commits into
mainfrom
cersho/feat-add-supabase-adapter
Jun 13, 2026
Merged

feat(adapters): add supabase adapter#2
cersho merged 4 commits into
mainfrom
cersho/feat-add-supabase-adapter

Conversation

@cersho

@cersho cersho commented Jun 13, 2026

Copy link
Copy Markdown
Owner

No description provided.

@vercel

vercel Bot commented Jun 13, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
gofiles-sdk-web Ready Ready Preview, Comment Jun 13, 2026 10:26pm

@coderabbitai

coderabbitai Bot commented Jun 13, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Added Supabase Storage as a supported provider and adapter.
    • Added support for uploads, downloads, file listing, copying, deleting, URL generation, and resumable uploads.
    • Added documentation and examples for configuring Supabase Storage, including public and signed access options.
  • Bug Fixes

    • Improved handling of storage errors and response formats for more reliable behavior.
  • Tests

    • Expanded automated coverage for Supabase configuration, storage operations, URL generation, and resumable uploads.

Walkthrough

A new Supabase Storage adapter is added to the SDK, implementing the full provider interface: upload, download, head, exists, delete, copy, list, URL generation, signed upload URLs, and TUS-based resumable uploads. The adapter is registered in the provider catalog, and documentation pages and README entries are added.

Changes

Supabase Storage Adapter

Layer / File(s) Summary
Adapter config, constructor, HTTP plumbing, and error mapping
providers/supabase/supabase.go, providers/supabase/supabase_test.go
Defines Options and Adapter, the New constructor (bucket/credential validation, URL normalization, HTTP client wiring), all HTTP request helpers (fetchObject, requestJSON, request), auth-header construction (apikey + optional bearer), response models (objectInfo, list metadata, payload structs), error mapping from HTTP status and Supabase error codes, and all parsing/utility helpers. Config-validation and error-mapping tests included.
Core storage operations: upload, download, head, exists, delete, copy, list
providers/supabase/supabase.go, providers/supabase/supabase_test.go
Implements Upload (upsert, progress wrapping, base64 metadata header), Download (no-range, cancel-on-close body), Head/Exists, Delete/DeleteMany (stop-on-error partial results), Copy, and List (delimiter/cursor/prefix, folder-prefix mapping). Core HTTP contract and auth-header tests included.
URL generation and signed upload URLs
providers/supabase/supabase.go, providers/supabase/supabase_test.go
Implements URL (public/CDN base URL vs. signed URL with expiry and Content-Disposition) and SignedUploadURL (PUT signed URL with upsert, content-type headers, fallback token URL). URL and signed-upload contract tests included.
TUS resumable upload driver
providers/supabase/resumable.go, providers/supabase/supabase_test.go
Adds ResumableUpload entry point and the resumableDriver implementing Begin (POST TUS session, 6 MiB minimum, base64 upload metadata), Adopt, Probe (HEAD offset), UploadPart (PATCH chunk), Complete, and Abort (DELETE session). Includes tusHeaders, doTus, and base64 helpers. TUS protocol tests included.
Provider catalog registration
provider_catalog.go, provider_catalog_test.go
Adds the supabase entry to the Providers map (bucket config, required vars, credential modes, notes) and appends "supabase" to ProviderNames. Extends catalog presence test.
Documentation
README.md, apps/web/content/docs/providers.mdx, apps/web/content/docs/adapters/supabase.mdx, apps/web/content/docs/adapters/meta.json
Adds Supabase Storage row to README and providers reference, adds new supabase.mdx adapter doc page (setup, env vars, URL modes, TUS resumable, compatibility matrix), and registers the page in nav metadata.

Sequence Diagram

sequenceDiagram
  participant App
  participant Adapter
  participant SupabaseStorageAPI
  participant TUSEndpoint

  rect rgba(70, 130, 180, 0.5)
    note over App,SupabaseStorageAPI: Standard upload
    App->>Adapter: Upload(ctx, key, body, opts)
    Adapter->>SupabaseStorageAPI: POST /object/{bucket}/{key} (apikey, x-upsert)
    SupabaseStorageAPI-->>Adapter: 200 OK + ETag
    Adapter-->>App: UploadResult
  end

  rect rgba(60, 179, 113, 0.5)
    note over App,TUSEndpoint: TUS resumable upload
    App->>Adapter: ResumableUpload → Begin
    Adapter->>TUSEndpoint: POST /upload (Upload-Length, Upload-Metadata)
    TUSEndpoint-->>Adapter: 201 Created + Location
    App->>Adapter: Probe → HEAD tempURL
    TUSEndpoint-->>Adapter: Upload-Offset
    App->>Adapter: UploadPart → PATCH tempURL (chunk, Upload-Offset)
    TUSEndpoint-->>Adapter: 204 + new Upload-Offset
    App->>Adapter: Complete → UploadResult
  end

  rect rgba(210, 105, 30, 0.5)
    note over App,SupabaseStorageAPI: Signed URL generation
    App->>Adapter: URL(ctx, key, opts)
    Adapter->>SupabaseStorageAPI: POST /sign/{bucket}/{key} (expiresIn, download)
    SupabaseStorageAPI-->>Adapter: signedURL token
    Adapter-->>App: signed URL string
  end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Poem

🐇 A new hop into storage land,
Supabase buckets now at hand!
TUS uploads chunk by chunk,
Signed URLs—no junk to trunk.
Base64 keys, RLS in sight,
The rabbit ships adapters right. ✨

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive No pull request description was provided, so there is no meaningful summary to evaluate. Add a brief description of the Supabase adapter, its docs, and tests to clarify the pull request’s intent.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: adding a Supabase adapter.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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 and usage tips.

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

🧹 Nitpick comments (2)
providers/supabase/supabase_test.go (2)

433-433: 💤 Low value

Consider asserting or removing the unused methods variable.

The methods slice collects HTTP methods but is never asserted. If it's meant for debugging, consider removing it; otherwise, add an assertion to verify the expected method sequence.

🤖 Prompt for 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.

In `@providers/supabase/supabase_test.go` at line 433, The methods slice in the
Supabase test is collected but never used, so either remove the unused methods
tracking from the test or add an assertion in the relevant test case to verify
the expected HTTP method sequence; update the test logic around the methods
variable in supabase_test.go accordingly.

64-65: 💤 Low value

Merge variable declaration with assignment.

The handler closure doesn't reference server, so the two-line declaration is unnecessary.

Suggested fix
-	var server *httptest.Server
-	server = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+	server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
🤖 Prompt for 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.

In `@providers/supabase/supabase_test.go` around lines 64 - 65, The `server`
variable in `providers/supabase/supabase_test.go` is declared and assigned on
separate lines even though the handler closure does not use it; simplify the
setup by merging the declaration and assignment into a single
`httptest.NewServer(...)` statement near `server` in `Test...` so the test
remains functionally identical but cleaner.

Source: Linters/SAST tools

🤖 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.

Nitpick comments:
In `@providers/supabase/supabase_test.go`:
- Line 433: The methods slice in the Supabase test is collected but never used,
so either remove the unused methods tracking from the test or add an assertion
in the relevant test case to verify the expected HTTP method sequence; update
the test logic around the methods variable in supabase_test.go accordingly.
- Around line 64-65: The `server` variable in
`providers/supabase/supabase_test.go` is declared and assigned on separate lines
even though the handler closure does not use it; simplify the setup by merging
the declaration and assignment into a single `httptest.NewServer(...)` statement
near `server` in `Test...` so the test remains functionally identical but
cleaner.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 2fea1a43-0e60-48ad-92fb-16ab76728c55

📥 Commits

Reviewing files that changed from the base of the PR and between 5e3af0d and 89356d4.

📒 Files selected for processing (9)
  • README.md
  • apps/web/content/docs/adapters/meta.json
  • apps/web/content/docs/adapters/supabase.mdx
  • apps/web/content/docs/providers.mdx
  • provider_catalog.go
  • provider_catalog_test.go
  • providers/supabase/resumable.go
  • providers/supabase/supabase.go
  • providers/supabase/supabase_test.go

@cersho cersho merged commit 58b1d5c into main Jun 13, 2026
7 checks passed
@cersho cersho deleted the cersho/feat-add-supabase-adapter branch June 13, 2026 22:37
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