Skip to content

Decouple UserRepository domain contract from Google Sign-In SDK types #544

Description

@jjoonleo

Problem

UserRepository is a domain interface, but it imports google_sign_in and exposes GoogleSignInAuthenticationEvent and GoogleSignInAccount. This leaks a platform SDK into the domain layer and forces unrelated repository fakes/use-case tests to depend on Google SDK types.

Evidence

  • lib/domain/repositories/user_repository.dart imports package:google_sign_in/google_sign_in.dart.
  • UserRepository exposes GoogleSignInAuthenticationEvent and GoogleSignInAccount.
  • lib/data/repositories/user_repository_impl.dart delegates SDK initialization/authentication through the repository interface and extracts the Google ID token from GoogleSignInAccount.
  • Login UI calls authenticateWithGoogle() and passes the SDK account back into signInWithGoogle().
  • Web Google sign-in UI consumes SDK auth events from the domain repository and passes event.user back to it.
  • Multiple tests import google_sign_in only because UserRepository fakes must implement SDK-typed members.

Proposed direction

Move Google SDK interaction behind a platform/auth adapter and keep UserRepository expressed in app-owned types. For example, introduce a domain-owned credential/value object containing the Google ID token, or collapse the flow into a use case that authenticates with the SDK outside the repository and calls the repository with primitive/app-owned credential data.

Acceptance criteria

  • lib/domain/repositories/user_repository.dart no longer imports package:google_sign_in/google_sign_in.dart.
  • No UserRepository method exposes GoogleSignIn* types.
  • Mobile and web Google sign-in still work, including user-cancel handling.
  • Repository tests and domain/use-case fakes no longer import google_sign_in.
  • flutter analyze and relevant auth/user tests pass.

Source: Codex codebase audit on 2026-06-28.

Metadata

Metadata

Assignees

No one assigned

    Labels

    codex-readyCan be started independently by a Codex thread nowpriority: P2Medium priority production-readiness workproduction-readinessWork required before production releaserefactor

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions