Skip to content

Suggest split weights from download counts #5

Open

Description

@SYMBAxx

Add a 'Suggest weights' button on Cascades that fetches recent downloads (crates.io API / api.npmjs.org) and allocates the 90% pool proportionally (with a min floor per dep).

Acceptance: pure weighting function with tests (sums exactly to target bps); graceful fallback to equal weights on API errors.

Activity

  1. NePreby commented on Nov 6, 2026

    @NePreby

    I have completed this bounty in Pull Request #24: #24

    Summary of Implementation:

    • Largest Remainder Method (allocateWeightsByDownloads): Pure function in frontend/src/lib/manifest.ts ensuring the exact sum of weights equals targetBps (9000 bps) with no rounding drift.
    • Minimum Floor Protection: Each dependency gets at least 50 bps (0.50%) floor when feasible.
    • Registry Download Fetching: Parallel fetching from crates.io (crate.downloads) and api.npmjs.org (downloads).
    • Cascades UI Integration: Added 'Suggest weights' action button with loading state beside 'Equalize' in CascadesPage.
    • Test Suite: 12 new unit tests in frontend/src/lib/__tests__/weights.test.ts. 70/70 vitest tests pass and TypeScript check is 100% clean.

    Bounty Payout Wallet (TRC20 TRX/USDT):
    TMqmJjRgVS21NL2eFtfyHciTxvE4BqGmEv

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions