---
title: Fix game-sample-curation spec clock interaction (fails only in full suite)
type: task
status: completed
description: >-
  scripts.game-sample-curation.spec.mjs passes in isolation (3/3) but fails in a full-suite run (2
  of 17326; keep-vs-drop and carried-forward assertions). Suspect: 3a2af02b3 reads kickoffs on the
  database clock, which a timer-faking spec does not move; fix the clock/ordering interaction so the
  spec passes in full runs.
base_uri: user:task/league/fix-game-sample-curation-spec-full-suite-clock-interaction.md
created_at: '2026-10-24T02:48:50.731Z'
entity_id: 13148bef-9e0f-4fb1-a144-41fa47d05c7a
finished_at: '2026-10-24T20:54:39.466Z'
observations: []
owner_identity_uri: █████████████████████████
priority: Medium
public_read: true
tags:
  - user:tag/league-xo-football.md
updated_at: '2026-10-24T20:54:45.492Z'
visibility_analyzed_at: '2026-11-05T23:49:23.173Z'
---

## Overview

`scripts/game-sample-curation.spec.mjs` passed in isolation but failed 2 of 3 assertions in a
full-suite run: W1 was proposed as a rule keep instead of the carried-forward session drop, and the
list output lacked ", carried forward". The failure was a spec-ordering interaction, not a clock
one: `load_inheritable_rulings` picked the team's previous game by `order by week desc` with no
tiebreak, so a sibling spec's leftover same-week 2025 KC game (`players-hit-rate-sample` leaves
`2024090105`, no kickoff) could win the arbitrary tie, making the lookup return a game with no
rulings and dropping the carry-forward. The DB-clock fixture work in `3a2af02b3` was necessary but
insufficient; the surviving ambiguity was plan- and table-state-dependent, which is why it only
flaked in full runs.

## Plan

- [x] Pin the mechanism. A deterministic probe (the leftover game inserted before the fixture, as in
  the real suite) showed the old lookup returns the leftover game under both the index and seq-scan
  plans; the pre-fix full suite at HEAD was green (17498 passing), confirming the failure is the
  flake rather than a deterministic regression.
- [x] Fix the lookup. In `load_inheritable_rulings`, find the true predecessor by `kickoff_at desc`
  and require a kickoff, since a no-kickoff game was never a proposal target and so never held
  rulings.

## Outcome

- Shipped as `3ae1562c8` (Carry a curation ruling forward from the team's previous game by
  kickoff) on origin/master; a sibling deploy-holder was cleared only after the verification landed.
- Post-fix full-suite verification: 17500 passing, 0 failing; the curation spec passes 3/3.
- Production behavior is unchanged for well-formed data: a team plays one game a week in a season,
  so week-desc and kickoff-desc name the same previous game; the change only makes the choice
  deterministic when a same-week game exists.
