Skip to content

Custom yields in Firestore: Google sign-in and My data (tracer) #123

Description

@paccloud

What to build

This is the first thin slice of the move to Firebase Auth + Firestore, following the decisions in #122 (CONTEXT.md, ADR 0001). It sets up the Firebase project wiring and proves the pattern end to end.

A person signs in with Google through the Firebase SDK and opens My data. There they can add, edit and delete their custom yields, which are stored in Firestore and reached directly from the browser. Security rules let only the owner read and write their own custom yields. Firestore's persistent offline cache is on, so edits made offline survive a reload and sync when the connection returns.

That cache keeps private data in the browser after sign-out, so signing out first sends pending writes (or, if offline, asks whether to wait or discard them) and then clears the local cache. The calculator offers the person's custom yields alongside the reference yields.

This is HITL because it sets the Firestore data shape, the rules layout and the emulator setup that every later slice builds on. Review those before the rest proceed.

Acceptance criteria

  • Google sign-in works through the Firebase SDK
  • My data lists, adds, edits and deletes custom yields in Firestore
  • A custom yield is stored as a conversion (starting form → finished product) with a yield above 0 and up to 100 and an optional private source note. The starting form may be blank, for yields copied from Neon.
  • Security rules allow only the owner to read and write their custom yields, and rules tests prove that another user and a signed-out visitor are refused
  • Firestore's persistent offline cache is enabled; an offline edit survives a reload and reaches Firestore once back online
  • Signing out sends pending writes or, when offline, asks whether to wait or discard them, then clears the local cache; the next person on the same browser sees none of the previous person's data
  • The calculator shows the signed-in person's custom yields next to the reference yields
  • Local development and CI run against the Firebase emulators, with instructions in the README
  • The Firestore data shape and the rules layout are written down for the later slices

Blocked by

None - can start immediately

Activity

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions