refactor: extract TIER_NAMES/TIER_COLORS to shared constants module #146

Closed
opened 2026-04-08 00:19:51 +00:00 by cal · 1 comment
Owner

Problem

Tier name mappings are triplicated:

  • cogs/refractor.py:29 as TIER_NAMES
  • helpers/refractor_notifs.py:18 as TIER_NAMES
  • cogs/players.py:474 as REFRACTOR_TIER_NAMES

TIER_COLORS is duplicated between cogs/refractor.py and helpers/refractor_notifs.py with intentionally different values (status view vs notification colors), but this is undocumented.

The existing divergence test (test_refractor_commands.py:418) only checks parity between the first two — cogs/players.py copy is untested.

Fix

Extract a single helpers/refractor_constants.py module that owns all shared refractor constants. Each consumer imports from there. Document the intentional color differences if they exist for a reason.

Impact

Low risk today, but divergence is inevitable as the system grows. Classic tech debt — cheap to fix now, expensive later.

## Problem Tier name mappings are triplicated: - `cogs/refractor.py:29` as `TIER_NAMES` - `helpers/refractor_notifs.py:18` as `TIER_NAMES` - `cogs/players.py:474` as `REFRACTOR_TIER_NAMES` `TIER_COLORS` is duplicated between `cogs/refractor.py` and `helpers/refractor_notifs.py` with intentionally different values (status view vs notification colors), but this is undocumented. The existing divergence test (`test_refractor_commands.py:418`) only checks parity between the first two — `cogs/players.py` copy is untested. ## Fix Extract a single `helpers/refractor_constants.py` module that owns all shared refractor constants. Each consumer imports from there. Document the intentional color differences if they exist for a reason. ## Impact Low risk today, but divergence is inevitable as the system grows. Classic tech debt — cheap to fix now, expensive later.
Claude added the
ai-working
label 2026-04-08 05:01:14 +00:00
Claude added the
ai-working
label 2026-04-08 05:02:26 +00:00
Claude removed the
ai-working
label 2026-04-08 05:04:09 +00:00
Collaborator

PR #155 opens the fix: #155

Created helpers/refractor_constants.py with TIER_NAMES, STATUS_TIER_COLORS (status view), and NOTIF_TIER_COLORS (notifications). All three consumers now import from there. The intentional color differences are documented. Divergence test updated to cover cogs/players.py.

PR #155 opens the fix: https://git.manticorum.com/cal/paper-dynasty-discord/pulls/155 Created `helpers/refractor_constants.py` with `TIER_NAMES`, `STATUS_TIER_COLORS` (status view), and `NOTIF_TIER_COLORS` (notifications). All three consumers now import from there. The intentional color differences are documented. Divergence test updated to cover `cogs/players.py`.
Claude added the
ai-pr-opened
label 2026-04-08 05:04:15 +00:00
cal closed this issue 2026-04-08 05:25:35 +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-discord#146
No description provided.