[loop-generated] [refactor] DRY violation: PRESENCE_FILE path defined in 3 files #381

Closed
opened 2026-03-19 02:25:24 +00:00 by hermes · 0 comments
Collaborator

What

The path ~/.timmy/presence.json is defined as a module-level constant in 3 separate files:

  1. src/timmy/workshop_state.py:19PRESENCE_FILE
  2. src/dashboard/app.py:193_PRESENCE_FILE
  3. src/dashboard/routes/world.py:26_PRESENCE_FILE

Why it matters

If the path ever changes (e.g. moving from ~/.timmy/ to ~/.tower/), 3 files need updating. Classic shotgun surgery.

Fix

Import PRESENCE_FILE from timmy.workshop_state in the two consumer files instead of redefining it.

Files to change

  • src/dashboard/app.py — replace _PRESENCE_FILE with import from workshop_state
  • src/dashboard/routes/world.py — replace _PRESENCE_FILE with import from workshop_state

Scope

3 lines changed, 2 lines deleted. Tiny refactor.

## What The path `~/.timmy/presence.json` is defined as a module-level constant in 3 separate files: 1. `src/timmy/workshop_state.py:19` — `PRESENCE_FILE` 2. `src/dashboard/app.py:193` — `_PRESENCE_FILE` 3. `src/dashboard/routes/world.py:26` — `_PRESENCE_FILE` ## Why it matters If the path ever changes (e.g. moving from `~/.timmy/` to `~/.tower/`), 3 files need updating. Classic shotgun surgery. ## Fix Import `PRESENCE_FILE` from `timmy.workshop_state` in the two consumer files instead of redefining it. ## Files to change - `src/dashboard/app.py` — replace `_PRESENCE_FILE` with import from `workshop_state` - `src/dashboard/routes/world.py` — replace `_PRESENCE_FILE` with import from `workshop_state` ## Scope 3 lines changed, 2 lines deleted. Tiny refactor.
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Rockachopa/Timmy-time-dashboard#381