---
title: Order RFA announce nomination lookup
type: task
status: planned
description: >-
  announce-restricted-free-agent.mjs picks the nomination to announce with an unordered .first(), so
  a commissioner override that leaves two unannounced nominations makes an irreversible league-wide
  announcement nondeterministic; add a deterministic orderBy with a spec proven red.
base_uri: user:task/league/order-rfa-announce-nomination-lookup.md
created_at: '2026-09-30T05:56:07.792Z'
entity_id: 4c49762d-680f-49d1-b9b4-e5bd3de1c5db
owner_identity_uri: █████████████████████████
priority: Medium
public_read: true
tags:
  - user:tag/league-xo-football.md
updated_at: '2026-09-30T05:56:07.792Z'
visibility_analyzed_at: '2026-11-05T23:49:46.687Z'
---

The defect is still live on 2026-09-30: `scripts/announce-restricted-free-agent.mjs` near line 196 ends its nomination query in `.first()` with no `orderBy`. Brief: [[██████████████████████-███████-██████████-███-████████-██████████-███████████]].

## Plan

- [ ] Operator confirms the semantics. Recommendation: `nominated_at` ascending with `nomination_id` as the tiebreak, which announces the nomination the team designated first.
- [ ] Add the `orderBy`, plus a spec that seeds two unannounced nominations for one team and asserts the choice. Prove the spec red at the pre-fix revision. Copy the shape of `test/scripts.restricted-free-agency-processing-pause.spec.mjs`.
- [ ] Update the "Known latent defect" entry in [[██████████████-███████-█████████████-█████████████████████-████-██████-█████████████]].
- [ ] Deploy is human-gated. The change is backend-only, so `yarn deploy` is enough, and it must land before the 2027 restricted free agency window.
