fix: golems/utils.ts and equipment/utils.ts duplicate local constants instead of importing from index #40

Closed
opened 2026-05-18 16:01:00 +02:00 by Anexim · 3 comments
Owner

Severity: Major

Files:

  • src/lib/game/data/golems/utils.ts (lines 8-13) — creates local GOLEMS_DEF by spreading BASE_GOLEMS, ELEMENTAL_GOLEMS, HYBRID_GOLEMS
  • src/lib/game/data/equipment/utils.ts (lines 13-24) — creates local EQUIPMENT_TYPES by spreading all equipment category arrays

Problem: Both files recreate their respective definition constants locally instead of importing from their ./index.ts barrel files. This creates a maintenance risk — if a new golem category or equipment category is added to the index but not to the local spread in utils, the utility functions won't see the new entries.

Impact: New golem or equipment types added to the index won't be visible to utility functions like getGolemDef(), getAvailableDrops(), etc. Silent data loss.

Fix: Import from the index files instead:

// golems/utils.ts
import { GOLEMS_DEF } from './index';

// equipment/utils.ts
import { EQUIPMENT_TYPES } from './index';
**Severity:** Major **Files:** - `src/lib/game/data/golems/utils.ts` (lines 8-13) — creates local `GOLEMS_DEF` by spreading `BASE_GOLEMS`, `ELEMENTAL_GOLEMS`, `HYBRID_GOLEMS` - `src/lib/game/data/equipment/utils.ts` (lines 13-24) — creates local `EQUIPMENT_TYPES` by spreading all equipment category arrays **Problem:** Both files recreate their respective definition constants locally instead of importing from their `./index.ts` barrel files. This creates a maintenance risk — if a new golem category or equipment category is added to the index but not to the local spread in utils, the utility functions won't see the new entries. **Impact:** New golem or equipment types added to the index won't be visible to utility functions like `getGolemDef()`, `getAvailableDrops()`, etc. Silent data loss. **Fix:** Import from the index files instead: ```ts // golems/utils.ts import { GOLEMS_DEF } from './index'; // equipment/utils.ts import { EQUIPMENT_TYPES } from './index'; ```
Anexim added the ai:todo label 2026-05-18 16:01:00 +02:00
n8n-gitea was assigned by Anexim 2026-05-18 16:01:00 +02:00
Author
Owner

[priority: 3] DATA/LOGIC BUG — golems/utils.ts and equipment/utils.ts duplicate local constants instead of importing from index.

[priority: 3] DATA/LOGIC BUG — golems/utils.ts and equipment/utils.ts duplicate local constants instead of importing from index.
Author
Owner

Starting work on #40. Will fix golems/utils.ts and equipment/utils.ts to import from index instead of duplicating constants.

Starting work on #40. Will fix golems/utils.ts and equipment/utils.ts to import from index instead of duplicating constants.
Author
Owner

Fixed. Updated golems/utils.ts to import GOLEMS_DEF from './index' instead of locally spreading BASE/ELEMENTAL/HYBRID_GOLEMS. Updated equipment/utils.ts to import EQUIPMENT_TYPES from './index' instead of locally spreading all equipment category arrays.

Fixed. Updated golems/utils.ts to import GOLEMS_DEF from './index' instead of locally spreading BASE/ELEMENTAL/HYBRID_GOLEMS. Updated equipment/utils.ts to import EQUIPMENT_TYPES from './index' instead of locally spreading all equipment category arrays.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Anexim/Mana-Loop#40