rspace-online/backlog/tasks/task-150 - Coalition-simula...

1.8 KiB

id title status assignee created_date labels dependencies references priority
TASK-150 Coalition simulator UI To Do
2026-04-16 18:57
rnetwork
governance
power-indices
TASK-144
src/encryptid/power-indices.ts
modules/rnetwork/components/folk-graph-viewer.ts
low

Description

Interactive coalition builder using the existing /api/power-indices/simulate endpoint.

What

Let users select a group of voters and instantly see: "Can this coalition pass a vote? Who is the swing voter?" Uses the simulate endpoint already built in TASK-144.

Primitive: Coalition Picker Component

  • New <folk-coalition-sim> element (or inline in power panel)
  • Checkbox list of top N voters (sorted by Banzhaf)
  • As checkboxes toggle: POST to simulate endpoint, show result:
    • "Winning coalition (67% of weight, needs 50%+1)"
    • Per-member: "Alice: swing voter " / "Bob: not swing (coalition wins without them)"
    • "Add 1 more voter to win" suggestion when losing

Implementation

  • Can be embedded in the power panel of folk-graph-viewer.ts as a collapsible section
  • Or standalone folk-coalition-sim.ts for embedding in delegation manager
  • POST /rnetwork/api/power-indices/simulate with { space, authority, coalition: [did1, did2...] }
  • Response already returns isWinning, marginalContributions[].isSwing
  • ~80 lines, zero backend changes (endpoint exists)

Acceptance Criteria

  • #1 Checkbox selection of voters from top-N list
  • #2 Live POST to simulate endpoint on selection change
  • #3 Shows winning/losing status with weight vs quota
  • #4 Identifies swing voters in the coalition
  • #5 Suggests minimum additions to form winning coalition