Skip to content

One-time copy from Neon to Firestore #131

Description

@paccloud

What to build

A one-time script copies custom yields and saved calculations from Neon into Firestore, following ADRs 0001 and 0004 in #122. It runs after the old API is read-only (#130).

  • Accounts: the script works from a written list that maps each Neon account holding data to its Firebase user id, checked by hand; there are about two accounts. It stops if an account with data is missing from the list, appears twice, or two accounts map to one Firebase user.
  • Yield values: the dry run lists any yield that is not above 0 and up to 100, such as the zeros the old form allowed. The owner fixes those in the old app before the freeze, and the copy refuses to run while any remain.
  • Starting form: Neon custom yields record only the finished product, so the copy leaves the starting form blank for the owner to fill in.
  • Shared yields: a yield that was already shared becomes approved, with a public copy, only if its owner has agreed to CC BY 4.0 and its starting form is filled in. Every other yield stays private.

This is HITL because it runs against production data, and the owner fills in the account list and gives the CC BY consent.

Acceptance criteria

  • A dry run prints what would be copied for each account, and changes nothing
  • The dry run lists yields outside the range above 0 and up to 100, and the real run refuses to start while any remain
  • The script stops on a missing, duplicate or shared mapping
  • Custom yields and saved calculations arrive under the mapped Firebase user
  • Copied yields have a blank starting form; the owner can fill it in on My data
  • Shared yields become approved only with owner consent and a filled-in starting form; the rest stay private
  • A check after the copy compares record counts per account between Neon and Firestore
  • Running the script a second time adds no duplicates
  • The run steps are documented, and no credentials are committed

Blocked by

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