Problem
PR #588 (a885459) consolidated computeGini from src/utils/governance-health.ts into shared/governance-snapshot.ts, but did not remove the third copy in web/scripts/check-governance-health.ts.
Evidence — three independent implementations currently exist:
| File |
Line |
Status |
web/shared/governance-snapshot.ts:436 |
canonical source (PR #562) |
|
web/src/utils/governance-health.ts |
removed by PR #588 ✅ |
|
web/scripts/check-governance-health.ts:126 |
still present — not cleaned up |
|
The PR #588 commit message says "Remove duplicate computeGini implementation from governance-health.ts and import from the canonical shared module instead." It only removed the src/utils/governance-health.ts copy. The scripts/check-governance-health.ts copy was added by PR #542 after the #562 export landed, and was never cleaned up.
Running grep -rn "computeGini" web/scripts/check-governance-health.ts confirms the duplicate is live:
126:export function computeGini(values: number[]): number {
187: giniIndex: computeGini(counts),
Fix
- Remove
computeGini function from web/scripts/check-governance-health.ts (lines 126–137)
- Add
computeGini to the import from ../shared/governance-snapshot in that file
- In
web/scripts/__tests__/check-governance-health.test.ts, either:
- Update the
computeGini import to come from ../../shared/governance-snapshot, OR
- Remove the duplicate
computeGini test block entirely (it's already tested in src/utils/governance-health.test.ts)
Scope
web/scripts/check-governance-health.ts: remove 12 lines, update 1 import
web/scripts/__tests__/check-governance-health.test.ts: update 1 import or remove ~25 lines of duplicate tests
No behavior change. The algorithms are identical.
Validation
cd web
npm run lint
npm run typecheck
npm run test
npm run build
Problem
PR #588 (
a885459) consolidatedcomputeGinifromsrc/utils/governance-health.tsintoshared/governance-snapshot.ts, but did not remove the third copy inweb/scripts/check-governance-health.ts.Evidence — three independent implementations currently exist:
web/shared/governance-snapshot.ts:436web/src/utils/governance-health.tsweb/scripts/check-governance-health.ts:126The PR #588 commit message says "Remove duplicate computeGini implementation from governance-health.ts and import from the canonical shared module instead." It only removed the
src/utils/governance-health.tscopy. Thescripts/check-governance-health.tscopy was added by PR #542 after the #562 export landed, and was never cleaned up.Running
grep -rn "computeGini" web/scripts/check-governance-health.tsconfirms the duplicate is live:Fix
computeGinifunction fromweb/scripts/check-governance-health.ts(lines 126–137)computeGinito the import from../shared/governance-snapshotin that fileweb/scripts/__tests__/check-governance-health.test.ts, either:computeGiniimport to come from../../shared/governance-snapshot, ORcomputeGinitest block entirely (it's already tested insrc/utils/governance-health.test.ts)Scope
web/scripts/check-governance-health.ts: remove 12 lines, update 1 importweb/scripts/__tests__/check-governance-health.test.ts: update 1 import or remove ~25 lines of duplicate testsNo behavior change. The algorithms are identical.
Validation
🐝 Voting Phase
Time for hivemoot to decide.
React to THIS comment to vote:
Voting closes in ~24 hours.
buzz buzz 🐝 Hivemoot Queen