---
title: Make pos_rnk a Deterministic Ranking
type: task
status: draft
description: >-
  pos_rnk is computed by indexOf over float totals, so every tied player gets the first tied rank
  and a last-bit float shift changes a rank with the points unchanged. Needs a declared tie policy
  and rounding before comparison.
base_uri: user:task/league/make-pos-rnk-deterministic.md
created_at: '2026-08-05T03:30:10.890Z'
entity_id: 6a02fda2-ad5b-4147-946b-2aa0cab52258
owner_identity_uri: █████████████████████████
priority: Low
public_read: true
relations:
  - relates [[█████████████████████-███████-███-███-███████-███████████████]]
tags:
  - user:tag/league-xo-football.md
updated_at: '2026-08-05T03:30:16.865Z'
visibility_analyzed_at: '2026-11-05T23:49:41.419Z'
---

# Make `pos_rnk` a Deterministic Ranking

## Problem

`scripts/calculate-points.mjs` computes positional rank as
`points_by_position[pos].indexOf(total_points) + 1` — an `indexOf` over an array
of floats, so the rank is decided by **exact float equality**. Two defects follow.

**Every tied player receives the FIRST tied rank.** `indexOf` returns the first
match, so a three-way tie at 61.30 gives all three players the same rank and the
two ranks below it are never assigned.

**A last-bit float shift changes a rank with the points unchanged.** Measured
2026-08-05: the Phase 3 registry rewrite in the kicking/DST scoring cluster moved
one kicker from `pos_rnk` 35 to 34 while his points stayed 61.30, because the
summation order changed the value by 7e-15. Float addition is not associative, so
any refactor that reorders a sum — including a pure-hygiene one — silently
reshuffles ranks. `pos_rnk` is therefore not reproducible across a harmless
refactor, which makes it unusable as a regression oracle and quietly wrong for
users on any tie.

## Scope

Pre-existing; found while verifying the kicking/DST parity cluster and
deliberately left alone there. See
[[█████████████████████-███████-███-███-███████-███████████████]].

## What needs deciding

The tie policy is a product question, not a mechanical one — competition ranking
(1, 2, 2, 4), dense ranking (1, 2, 2, 3), or ordinal with a declared tiebreak.
Pick one, then rank by sorted position rather than by `indexOf`, and round to the
scoring precision before comparing so a 7e-15 delta cannot separate two players
who scored the same.

Check whether `rnk` on `scoring_format_player_seasonlogs` / `_gamelogs` and any
other rank column share the shape before fixing only this one.
