fix(indexer): dense-competitive rank on referrer leaderboard (GitLab #177) #376
No reviewers
Labels
No labels
agent:fix_bugfix
agent:fix_conflicts
agent:fix_security
agent:gap_analysis
agent:implement
agent:open_issues
agents
agent:security_audit
agent:verify
area
timecurve
arena
arena-v2
audit
block:feature_review
block:security
bug
contracts
design
devops
docs
documentation
enhancement
epic
feature
frontend
indexer
low priority
megaeth
operations
ops
performance
QA
qa checklist
referrals
removal
security
smart-contracts
tech-debt
testing
time-arena
timecurve
visual-qa
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
code/yieldomega!376
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/glab-177-referrer-leaderboard-dense-rank"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
closes #177.
what changed
indexer/src/api.rs:1913-1928— referrer-leaderboard SQL rewritten with inner subquery +RANK() OVER (ORDER BY COALESCE(SUM(referrer_amount), 0) DESC NULLS LAST)::bigint, outerORDER BY rank ASC, referrer ASCpreserves deterministic pagination across tied groups.indexer/src/api.rs:1940-1949— handler dropsenumerate()page-ordinal computation, readsrankdirectly from SQL viar.try_get::<i64, _>("rank").indexer/src/api.rs:24—SCHEMA_VERSIONbumps1.16.1→1.17.0to reflect value-semantic shift on the existingrankfield.indexer/tests/integration_stage2.rs— new postgres-gated testpostgres_gitlab177_referrer_leaderboard_dense_rankseeds 4 referrers with amounts300/200/200/100, asserts ranks1, 2, 2, 4withreferrer ASCtiebreaker between tied bbbb/cccc, pins paginated tie behavior atoffset=2returning ranks[2, 4](not[3, 4]as page-ordinal would have given).why
#170 follow-up flagged that
rankwas page ordinal and you confirmed dense-competitive is the desired behavior under ties (1, 2, 2, 4 pattern). this lands that change.verification
cargo checkclean,cargo clippy --all-targets -- -D warningsclean.cargo test(no postgres URL) — 40 unit + 0 doc + 3 integration = 43 PASS, postgres-gated tests skip cleanly per the existing harness pattern.cargo test postgres_gitlab177 -- --nocaptureagainst the QA test DB — 1 PASS, dense-rank logic exercised end-to-end via real HTTP requests through the axum router. seed → request → assert ranks → assert paginated tie behavior → cleanup.consumer impact
frontend
ReferralLeaderboardSection.tsx:120usesrow.rank === 1for--firststyling. under ties at the top, multiple rows now get the gold-first treatment — assumed desired UX given the spec change.:126renders#{row.rank}literally — ties read#1, #1, #3which is visually correct. no other consumer of therankfield on this endpoint in the frontend.cc @PlasticDigits
mentioned in commit
86f08ba0afmentioned in commit
e8a2399d37