feat: rarity ladder utility for safe next-rarity lookups #59

Closed
opened 2026-04-08 00:23:38 +00:00 by cal · 1 comment
Owner

Problem

rarity_thresholds.py defines rarity IDs (5, 4, 3, 2, 1, 99) but has no "next rarity" function. The Phase 2 Validation Spec (T4-4) warns that naive rarity_id + 1 produces invalid values — 100 for HoF, 0 for Diamond.

When T4 rarity upgrade is implemented (card-creation#57), a proper ordered ladder lookup is needed to safely resolve the next rarity tier.

Fix

Add a RARITY_LADDER ordered mapping and a next_rarity(current_id) helper that returns the next tier or None if already at max. Handle edge cases for HoF and Diamond.

Relationship

Subtask/prerequisite of card-creation#57 (T4 rarity collision guard). Could be implemented as part of that issue.

## Problem `rarity_thresholds.py` defines rarity IDs (5, 4, 3, 2, 1, 99) but has no "next rarity" function. The Phase 2 Validation Spec (T4-4) warns that naive `rarity_id + 1` produces invalid values — `100` for HoF, `0` for Diamond. When T4 rarity upgrade is implemented (card-creation#57), a proper ordered ladder lookup is needed to safely resolve the next rarity tier. ## Fix Add a `RARITY_LADDER` ordered mapping and a `next_rarity(current_id)` helper that returns the next tier or `None` if already at max. Handle edge cases for HoF and Diamond. ## Relationship Subtask/prerequisite of card-creation#57 (T4 rarity collision guard). Could be implemented as part of that issue.
Claude added the
ai-working
label 2026-04-08 12:31:11 +00:00
Claude removed the
ai-working
label 2026-04-08 12:32:12 +00:00
Collaborator

PR opened: #64

Added RARITY_LADDER (ordered [5, 4, 3, 2, 1, 99]), next_rarity() (returns next tier or None at HoF/unknown), and rarity_is_downgrade() (position-based comparison) to rarity_thresholds.py. All three use list.index() lookups against the ladder, avoiding any arithmetic on the non-contiguous IDs.

PR opened: #64 Added `RARITY_LADDER` (ordered `[5, 4, 3, 2, 1, 99]`), `next_rarity()` (returns next tier or `None` at HoF/unknown), and `rarity_is_downgrade()` (position-based comparison) to `rarity_thresholds.py`. All three use `list.index()` lookups against the ladder, avoiding any arithmetic on the non-contiguous IDs.
Claude added the
ai-pr-opened
label 2026-04-08 12:32:19 +00:00
cal closed this issue 2026-04-08 14:26:26 +00:00
cal closed this issue 2026-04-08 14:26:26 +00:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: cal/paper-dynasty-card-creation#59
No description provided.