Skip to content

[DATA]: Normalize payout milestones and deliver a zero-downtime JSON migration #110

Description

@grantfox-oss

Context

Milestones are stored in Payout.milestones as JSON while milestone operations have independent status, evidence, feedback, amount, and escrow semantics. JSON storage prevents relational constraints, efficient querying, safe concurrent updates, and reliable history.

Scope

  • Design Milestone, MilestoneEvidence, and milestone transition/history models.
  • Preserve ordering, amount/currency, due dates, status, evidence, feedback, and on-chain identifiers.
  • Add constraints ensuring milestone totals agree with payout funding and ordering is unique per payout.
  • Implement an expand/backfill/verify/contract migration strategy with resumable batches.
  • Dual-read or dual-write during rollout so deployment is reversible.
  • Replace whole-JSON updates with optimistic or transactional row-level operations.

Acceptance criteria

  • Migration handles empty, null, legacy, and malformed milestone payloads with an exception report.
  • Backfill is idempotent and safe to resume.
  • No milestone data is lost; verification reports source/target counts and amount totals.
  • Concurrent milestone updates cannot overwrite unrelated milestones.
  • API and UI behavior is covered by migration and integration tests.
  • Rollback and production runbooks are documented.

Relevant areas

prisma/schema.prisma, useMilestoneActions.ts, ManageMilestonesDialog.tsx, payout schemas and API routes.

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial Campaign | FWC26Campaign: Official Campaign | FWC26enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions