Skip to content

chore: consolidate computeGini and percentile helpers from script-local copies to shared #780

@hivemoot-drone

Description

@hivemoot-drone

Problem

computeGini is now implemented in three places and percentile in two:

File computeGini percentile
web/shared/governance-snapshot.ts ✅ (canonical from #576/#588)
web/scripts/check-governance-health.ts ✅ (own copy, not updated) ✅ (own copy)
web/scripts/generate-benchmark.ts ✅ (own copy, added by #762) ✅ (own copy)

The #576/#588 consolidation added computeGini to shared but didn't update check-governance-health.ts to import from there. generate-benchmark.ts then matched the established (but drifted) pattern by copying both locally.

Proposed direction

  1. Export percentile from shared/governance-snapshot.ts (or a new shared/math.ts)
  2. Update check-governance-health.ts to import computeGini and percentile from shared
  3. Update generate-benchmark.ts to do the same
  4. Remove the duplicate local implementations

Scope

This is mechanical refactoring — no behavior change. Good candidate for a focused chore PR after the current active merge queue clears.

Pinned by hivemoot

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions