Skip to content

chore!: remove the v1 to v2 migration paths and expose defaultPersistSessionKey - #1681

Merged
spydon merged 3 commits into
breaking/shared-preferences-asyncfrom
chore/remove-v1-migration-paths
Aug 11, 2026
Merged

spydon merged 3 commits into
breaking/shared-preferences-asyncfrom
chore/remove-v1-migration-paths

Conversation

@spydon

@spydon spydon commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #1680, review that one first.

What kind of change does this PR introduce?

Cleanup and a small feature, breaking change.

What is the current behavior?

supabase_flutter still carries the leftovers of the v1 to v2 migration:

  • supabasePersistSessionKey, a public constant whose own dartdoc says "Only used for migration from Hive to SharedPreferences. Not actually in use." The SDK never reads it. It is only the key v1 stored the session under.
  • A README section with MigrationLocalStorage and HiveLocalStorage snippets to copy, which move a session out of hive on the first launch after upgrading from v1.

The README's MySecureStorage example used the constant as its storage key, which was wrong for anything but a v1 leftover: the session lives under the key that is passed to LocalStorage, sb-<project-ref>-auth-token for the default storage. That key was derived in two places (Supabase.initialize and, for the broadcast channel name, GoTrueClient) with nothing public to call, so a custom LocalStorage had no way to name the same key other than writing the format out by hand.

What is the new behavior?

Both leftovers are gone. Anyone still on v1 can upgrade to v2, let it migrate the session, and then move to v3.

defaultPersistSessionKey(url) replaces the hand-written format. It lives in supabase_common, which gotrue and supabase_flutter both already depend on, and supabase_flutter exports it the way postgrest and functions_client export HttpMethod:

authOptions: FlutterAuthClientOptions(
  localStorage: MySecureStorage(
    persistSessionKey: defaultPersistSessionKey(supabaseUrl),
  ),
),

The derivation now exists in exactly one place, and both call sites use it. Nothing changes for the default path: Supabase.initialize still fills the key in, so Supabase.initialize(url:, publishableKey:) remains all a caller writes.

The Migrating Guide section of the README pointed at the v1 to v2 upgrade guide on the docs site, and now points at MIGRATION.md, which is where the v2 to v3 changes are written down. Both docs also say explicitly that the key is derived for you and only needs naming when you supply your own storage, which was easy to misread before.

Additional context

MIGRATION.md documents the removal, including the literal value of the constant for anyone who copied the old example and needs to keep reading the same key.

sdk-compliance.yaml drops supabasePersistSessionKey and registers defaultPersistSessionKey under client.session_management.persist_session. The capability itself stays implemented. The symbol, drift and schema checks were run locally against the base and PR symbol dumps.

@spydon
spydon requested a review from a team as a code owner August 10, 2026 13:29
@coderabbitai

coderabbitai Bot commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: da9cf94a-b465-4bc9-a242-6825c9a4a7f1

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

@spydon
spydon force-pushed the chore/remove-v1-migration-paths branch from da2bcd5 to a3e85e0 Compare August 10, 2026 13:35
@spydon spydon changed the title chore!: remove the v1 to v2 migration paths chore!: remove the v1 to v2 migration paths and expose defaultPersistSessionKey Aug 10, 2026
@spydon
spydon force-pushed the chore/remove-v1-migration-paths branch 2 times, most recently from 3ff7ac0 to 60ae33c Compare August 10, 2026 14:37
spydon added 3 commits August 10, 2026 16:47
supabasePersistSessionKey only existed for the migration from hive that
supabase_flutter v1 needed, and the SDK never read it. It is gone, along
with the MigrationLocalStorage and HiveLocalStorage snippets in the README,
which migrated a v1 session out of hive.

The custom LocalStorage example used the constant as its storage key, so it
now takes the key as a parameter.
…ntations

The key the session is persisted under was derived in two places and
written out by hand in the docs on top of that, with nothing public to
call. It now lives in supabase_common, which gotrue and supabase_flutter
both already depend on, and supabase_flutter exports it the way postgrest
and functions_client export HttpMethod.
@spydon
spydon force-pushed the chore/remove-v1-migration-paths branch from 60ae33c to 2b4d401 Compare August 10, 2026 14:47
@spydon
spydon merged commit eeadf7f into breaking/shared-preferences-async Aug 11, 2026
37 checks passed
@spydon
spydon deleted the chore/remove-v1-migration-paths branch August 11, 2026 06:42
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.

2 participants