mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-03 13:52:09 +03:00
topQuotas() (the sole row-order decider for the COLLAPSED provider-quota card in QuotaCardBody.tsx) sorted rows purely by status then remaining percentage and never consulted hasFixedQuotaOrder()/CODEX_QUOTA_ORDER/ GLM_QUOTA_ORDER. Session and Weekly therefore swapped position per card depending on headroom. This is the same defect class as #6687/PR #6722, which fixed only the EXPANDED card path (QuotaCardExpanded.tsx via resolveQuotaDisplayOrder()). The collapsed path never got that fix. Fix: topQuotas() now accepts an optional providerId and, when hasFixedQuotaOrder(providerId) is true, skips the status/remaining-% sort and keeps the order parseQuotaData() already established (mirrors resolveQuotaDisplayOrder() in QuotaCardExpanded.tsx), only truncating to n. Threaded providerId through QuotaCardBody's props to the topQuotas() call site. Providers without a fixed order are unaffected — they keep sorting worst-status-first. Regression test: tests/unit/repro-7764-collapsed-quota-order.test.ts (reused from the triage-fix-bugs repro probe, RED confirmed on unfixed code, GREEN after the fix; also asserts non-fixed-order providers still sort worst-first).