Skip to content

Settings sync: end-to-end validation against local Supabase #987

Closed

Description

@enaboapps

Part of cross-device settings sync for Switchify PC.

Scope

  • End-to-end tests of sign-in and sync against a local supabase start stack, covering two simulated installs that converge.
  • Verify that Android's user_preferences behaviour is unaffected.
  • Manual checks on Windows and macOS (npm run macos:run), and docs for the build secrets.

Activity

  1. added this to the v1.0.0-rc.22 milestone on Oct 5, 2026
  2. enaboapps commented on Oct 6, 2026

    @enaboapps
    ContributorAuthor

    Evidence so far (2026-10-05/06)

    Automated

    • cargo test: 708 passed. The account and settings_sync suites cover sign-in, refresh, sign-out, delete, the keychain, merges, conflicts, newer schemas, and two-computer convergence, all with fakes.
    • Local Supabase stack (switchify-supabase supabase start): the ignored tests account::tests::local_stack_sign_in_refresh_and_delete and settings_sync::tests::local_stack_round_trips_the_document_and_enforces_revisions pass. They cover:
      • the real code email read from Mailpit
      • verify, then refresh after a restart, then delete through the RPC
      • explicit nulls surviving jsonb
      • create giving revision 1, with a second create getting 409
      • a conditional update, and a stale update being rejected
      • one account being unable to read another's row or update it through a forged user_id
    • Database: 50/50 pgTAP tests pass in switchify-supabase.

    Manual, Windows, production, with the real account (dev build from main with sync; computer use drove the app and Gmail; the database was checked directly)

    • Settings → Account showed the email form. Requesting a code showed "We sent a code to …", and a "Switchify login code" email arrived in Gmail. Entering it gave "Signed in as …" and "Settings are up to date".
    • The existing shared account was used, and the Android user_preferences row was untouched.
    • First sync created the desktop_preferences row at revision 1 with all six sections (about 1.2 KB). Sync now with nothing changed uploaded nothing.
    • Changing Show crosshairs locally uploaded by itself within 20 s (revision 2).
    • A simulated other-computer change in the database (revision 3) was applied by Sync now, persisted to state.json, and not echoed back.
    • After a restart the app was still signed in, refreshed from the keychain, and synced on startup.
    • The keychain entry exists. No tokens, code or email address appeared in settings-sync.json or the app log.

    Still to do

    • macOS: the same sign-in and sync flow (npm run macos:run with both SWITCHIFY_SUPABASE_* variables set).
    • Two real computers editing at the same time (simulated in the database so far).
    • Sign-out on a real build (unit-tested only).
    • Build-secret docs: see the docs PR.
  3. enaboapps commented on Oct 7, 2026

    @enaboapps
    ContributorAuthor

    Closing at the owner's request. Validation completed: automated suites (including the local-stack integration tests), database tests, and a manual Windows run against production (sign-in by emailed code, upload, remote apply without echo, restart persistence, no secrets in logs or state); docs merged in #994. The remaining items (macOS run, two real computers editing at once, sign-out on a real build) were not run before closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions