---
title: Make calculate-points-added deterministic
type: task
status: draft
description: >-
  Two consecutive runs of calculate-points-added.mjs on unmodified master differ in pts_added on 38
  of 200 rows and in the earned and net salary columns, making the script unusable as a comparison
  oracle.
base_uri: user:task/league/make-calculate-points-added-deterministic.md
created_at: '2026-09-20T00:26:46.615Z'
entity_id: 00c27aeb-20c8-42fd-a515-5529bdb2c7e4
owner_identity_uri: █████████████████████████
priority: Medium
public_read: true
tags:
  - user:tag/league-xo-football.md
  - user:tag/software-task.md
updated_at: '2026-10-03T03:43:02.715Z'
visibility_analyzed_at: '2026-11-05T23:49:40.381Z'
---

# Make calculate-points-added deterministic

## Problem

Two consecutive runs of `scripts/calculate-points-added.mjs --lid 1 --year 2024`
on unmodified master differ in `pts_added` on 38 of 200 rows, and in the earned
and net salary columns.

This is a production script whose output feeds valuation. The nondeterminism
surfaced because it makes any before/after comparison against it meaningless —
which is how a previous session found it while trying to use it as an oracle.

## Provenance

Carried forward unowned through two handoffs (salary-grain confinement, then
the param-key collapse on 2026-09-19). Neither lane owned it; a task is opened
here so it stops riding along in briefs.

## Starting points

- Establish the magnitude first: is the drift bounded noise or a changing
  ordering? Diff two runs and characterise the 38 rows.
- Suspect any unordered iteration feeding an accumulation, and any tie-break
  that reads insertion order.
- A fixed seed or an added ORDER BY that merely hides the drift is not a fix;
  the oracle is two identical runs from a cold start.
