Skip to content

Backfill required RTDB fields and add migrate:backfill tooling - #223

Open
MaxwellBo wants to merge 1 commit into
masterfrom
migrate/required-field-backfill
Open

Backfill required RTDB fields and add migrate:backfill tooling#223
MaxwellBo wants to merge 1 commit into
masterfrom
migrate/required-field-backfill

Conversation

@MaxwellBo

Copy link
Copy Markdown
Owner

Summary

  • Adds reusable RTDB field backfill tooling (scripts/lib/field-backfill.ts, scripts/backfill-missing-fields.ts, yarn migrate:backfill) with a required-optional-fields manifest sourced from DEFAULT_* objects.
  • Makes previously optional fields required in TypeScript (conference, caucus speakerDuration / speakerUnit / queueIsPublic, resolution amendmentsArePublic / requiredMajority) and removes UI fallbacks that papered over missing data.
  • Documents dry-run, apply, and emulator usage in AGENTS.md.

Production backfill (run before merge)

Dry-run against production (read-only, no credentials):

yarn migrate:backfill -- --dry-run

Latest dry-run: 3824 paths across 66505 committees (speakerDuration 1584, speakerUnit 1219, requiredMajority 567, conference 205, amendmentsArePublic 186, queueIsPublic 63).

Apply with a Firebase service account that has Realtime Database admin access:

GOOGLE_APPLICATION_CREDENTIALS=path/to/sa.json yarn migrate:backfill

Test plan

  • yarn migrate:backfill -- --dry-run completes and reports expected field counts
  • Apply backfill on production with service account credentials
  • Re-run dry-run; expect 0 paths to write
  • Smoke-test committee conference field, caucus speaker settings, resolution majority/amendments visibility in the app

Made with Cursor

Reusable migrate:backfill script with a manifest driven by DEFAULT_* values; model and UI code no longer treat conference, caucus speaker settings, or resolution voting metadata as optional.

Co-authored-by: Cursor <cursoragent@cursor.com>
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.

1 participant