Skip to content

fix: store M2 program entitlement per project (#26)#87

Merged
sacha-l merged 1 commit into
developfrom
fix/m2-entitlement-schema-26
May 19, 2026
Merged

fix: store M2 program entitlement per project (#26)#87
sacha-l merged 1 commit into
developfrom
fix/m2-entitlement-schema-26

Conversation

@sacha-l
Copy link
Copy Markdown
Collaborator

@sacha-l sacha-l commented May 19, 2026

Closes #26.

Summary

The projects table had M2 metadata (status, mentor, features) but no amounts, so the admin Winners table could only sum bounty_prizes — it had no schema-backed way to show the M1 + M2 program grant. A temporary + M2 grant badge papered over it.

This stores the entitlement as schema truth.

Changes

  • Migration 20260520100000_m2_entitlement.sql — adds m2_milestone_1_amount, m2_milestone_2_amount (NUMERIC) and m2_currency (TEXT) to projects, each with a column DEFAULT (2500 / 2500 / USDC). The default backfills every existing row and applies to new rows automatically.
  • project.repository.jstransformProject exposes a nested m2Entitlement: { milestone1Amount, milestone2Amount, currency }, gated on m2_status (same pattern as m2Agreement) so a bounty-only project carrying the default values never surfaces them. toSupabaseProject maps it back.
  • WinnersTable.tsx — column renamed "Bounty amount""Amount"; the cell now renders bounty sum + M2 entitlement with a per-line breakdown (Bounty: … / M2 grant: …). The temporary + M2 grant badge/tooltip and its now-unused Tooltip imports are removed.

Decisions

  • Population: the entitlement defaults to $2,500 / $2,500 USDC at the DB level (per maintainer decision) — schema truth, no client hardcode, every M2 project gets it automatically. An admin-editable UI for per-project amounts can be a follow-up if needed.
  • Backfill of historical non-default values is out of scope per the issue — the column DEFAULT sets all existing M2 projects to the standard $5,000.

Test plan

  • cd server && npm test — 161 tests pass.
  • cd client && npm run build (tsc) — green.
  • cd client && npm run lint — green.
  • ⚠️ Migration 20260520100000_m2_entitlement.sql must be applied to Supabase (per docs/PRODUCTION_DEPLOYMENT.md) — additive, low-risk (ADD COLUMN … DEFAULT).

🤖 Generated with Claude Code

The projects table held M2 metadata but no amounts, so the admin Winners
table could only sum bounty_prizes and had no schema-backed way to show
the M1 + M2 program grant. A "+ M2 grant" badge was a stopgap.

- Migration 20260520100000: adds m2_milestone_1_amount,
  m2_milestone_2_amount (NUMERIC), m2_currency (TEXT) to projects, each
  with a DEFAULT (2500 / 2500 / USDC) that backfills existing rows.
- project.repository: transformProject exposes a nested m2Entitlement
  (only for M2 projects — gated on m2_status, like m2Agreement);
  toSupabaseProject maps it back.
- WinnersTable: the column is renamed "Bounty amount" -> "Amount" and
  now renders bounty sum + M2 entitlement, with a per-line breakdown.
  The temporary "+ M2 grant" badge/tooltip is removed.

Server: 161 tests pass. Client build + lint green.
@vercel
Copy link
Copy Markdown

vercel Bot commented May 19, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
stadium Ready Ready Preview, Comment May 19, 2026 5:57pm

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.

schema: store M2 program entitlement per project (bounty amounts surface, grant does not)

1 participant