[Medium] [Task] Golemancy redesign cleanup — remove orphaned legacy code and update docs #290

Closed
opened 2026-06-07 12:36:43 +02:00 by Anexim · 2 comments
Owner

Summary

The golemancy system redesign (component-based construction: Core + Frame + Mind Circuit + Enchantances) is functionally complete and all runtime code uses the new system. However, there are several orphaned legacy artifacts and documentation inconsistencies that should be cleaned up.

What's Done

  • All component data files exist and are complete: cores.ts (4), frames.ts (7), mindCircuits.ts (4), golemEnchantments.ts (8)
  • GolemDesign, ComputedGolemStats, GolemManaCost, GolemUnlockRequirement types in types.ts are complete
  • golem-combat-actions.ts implements the full component-based combat pipeline (summoning, maintenance, mana regen, attacks, room duration)
  • golemancy-actions.ts handles design CRUD and loadout management
  • GolemancyTab.tsx, GolemDesignBuilder.tsx, GolemLoadoutPanel.tsx, ActiveGolemsPanel.tsx all use the new component system
  • SpireCombatControls.tsx already updated to use activeGolems + golemDesigns from the new system
  • combatStore.ts initial state uses RuntimeActiveGolem[] (new type)
  • GolemancyState type in types/game.ts uses activeGolems: RuntimeActiveGolem[] and golemDesigns: Record<string, SerializedGolemDesign>
  • No references to GOLEMS_DEF, summonedGolems, golemId, or GolemDef remain in source code
  • Test files (golemancy-data.test.ts, golemancy-combat.test.ts, GolemancyComponents.test.ts, golemancy-utils.test.ts) all test the new system

Remaining Work

1. Remove orphaned ActiveGolemV2 type and createActiveGolem utility

  • File: src/lib/game/data/golems/types.tsActiveGolemV2 interface (lines ~140-150) is exported but never used at runtime. The runtime uses RuntimeActiveGolem from types/game.ts.
  • File: src/lib/game/data/golems/utils.tscreateActiveGolem() function returns ActiveGolemV2 but is only called in test files, never in production code. The summonGolemsOnRoomEntry() function in golem-combat-actions.ts creates RuntimeActiveGolem objects directly.
  • File: src/lib/game/data/golems/index.ts — exports ActiveGolemV2 which is orphaned.
  • Action: Remove ActiveGolemV2 from types.ts and its export from index.ts. Either remove createActiveGolem() or update it to return RuntimeActiveGolem if tests need it.

2. Remove orphaned legacy compatibility functions from utils.ts

  • File: src/lib/game/data/golems/utils.ts — Four @deprecated functions exist only for legacy compatibility:
    • getGolemFloorDuration() — returns hardcoded 3
    • getGolemDamage() — returns 0
    • getGolemAttackSpeed() — returns 0
    • getGolemMaintenanceMultiplier() — returns 1
  • Action: Remove these four functions. Verify no callers exist (grep confirms none in source).

3. Update fabricator-spec.md files reference table

  • File: docs/specs/attunements/fabricator/fabricator-spec.md (line ~253)
  • Current text: src/lib/game/data/golems/ | Golem definitions (10 golems)
  • Should be: src/lib/game/data/golems/ | Golem component definitions (4 cores, 7 frames, 4 mind circuits, 8 enchantments)

4. Update spire-combat-spec.md §9 Golemancy System

  • File: docs/specs/spire-combat-spec.md (lines 413-548)
  • Current state: §9 still references the old GolemDefinition interface with fields like summonCostType, maintenanceCostType, golemDef, golem.baseDamage, golem.attackSpeed, golem.element, golem.maintenanceCost
  • Should be: Updated to reflect the component-based system where golem stats are derived from Core + Frame + Mind Circuit + Enchantments
  • §9.7 Golem Data Shape: Replace old GolemDefinition interface with the new SerializedGolemDesign + RuntimeActiveGolem types
  • §9.3 Summoning pseudocode: Update to reference golemDesigns and component-based cost calculation
  • §9.4 Combat pseudocode: Update to reference frame-based damage/speed and circuit-based spell casting
  • §9.5 Maintenance pseudocode: Update to reference core-based upkeep calculation
  • §11 Known Gaps table: "Golemancy combat" row says "Disconnected" — should be updated to "Implemented" or removed

5. Update GAME_BRIEFING.md Golemancy section

  • File: docs/GAME_BRIEFING.md (lines ~758-810)
  • Current state: Contains a "Golem Types (10 Total — undergoing redesign, see issue #268)" section with the old 10 predefined golems (Earth, Steel, Crystal, Sand, Lava, Galvanic, Obsidian, Prism, Quicksilver, Voidstone)
  • Action: Replace with a summary of the component-based system. Remove the old golem type tables and the "⚠ undergoing redesign" note.

6. Update golemancy-spec.md §19 Files Reference

  • File: docs/specs/attunements/fabricator/systems/golemancy-spec.md (last section)
  • Current text: docs/specs/spire-combat-spec.md §9 says "Authoritative runtime spec (needs update)"
  • Action: This is a reminder to itself — once §9 is updated, remove the "(needs update)" note.

Verification Steps

After cleanup:

  1. Run bun run build to confirm no compilation errors
  2. Run bun run test to confirm all tests pass
  3. Run grep -r "GOLEMS_DEF\|summonedGolems\|golemId\|GolemDef\|ActiveGolemV2" src/ to confirm no legacy references remain
## Summary The golemancy system redesign (component-based construction: Core + Frame + Mind Circuit + Enchantances) is functionally complete and all runtime code uses the new system. However, there are several orphaned legacy artifacts and documentation inconsistencies that should be cleaned up. ## What's Done ✅ - All component data files exist and are complete: `cores.ts` (4), `frames.ts` (7), `mindCircuits.ts` (4), `golemEnchantments.ts` (8) - `GolemDesign`, `ComputedGolemStats`, `GolemManaCost`, `GolemUnlockRequirement` types in `types.ts` are complete - `golem-combat-actions.ts` implements the full component-based combat pipeline (summoning, maintenance, mana regen, attacks, room duration) - `golemancy-actions.ts` handles design CRUD and loadout management - `GolemancyTab.tsx`, `GolemDesignBuilder.tsx`, `GolemLoadoutPanel.tsx`, `ActiveGolemsPanel.tsx` all use the new component system - `SpireCombatControls.tsx` already updated to use `activeGolems` + `golemDesigns` from the new system - `combatStore.ts` initial state uses `RuntimeActiveGolem[]` (new type) - `GolemancyState` type in `types/game.ts` uses `activeGolems: RuntimeActiveGolem[]` and `golemDesigns: Record<string, SerializedGolemDesign>` - No references to `GOLEMS_DEF`, `summonedGolems`, `golemId`, or `GolemDef` remain in source code - Test files (`golemancy-data.test.ts`, `golemancy-combat.test.ts`, `GolemancyComponents.test.ts`, `golemancy-utils.test.ts`) all test the new system ## Remaining Work ### 1. Remove orphaned `ActiveGolemV2` type and `createActiveGolem` utility - **File**: `src/lib/game/data/golems/types.ts` — `ActiveGolemV2` interface (lines ~140-150) is exported but never used at runtime. The runtime uses `RuntimeActiveGolem` from `types/game.ts`. - **File**: `src/lib/game/data/golems/utils.ts` — `createActiveGolem()` function returns `ActiveGolemV2` but is only called in test files, never in production code. The `summonGolemsOnRoomEntry()` function in `golem-combat-actions.ts` creates `RuntimeActiveGolem` objects directly. - **File**: `src/lib/game/data/golems/index.ts` — exports `ActiveGolemV2` which is orphaned. - **Action**: Remove `ActiveGolemV2` from `types.ts` and its export from `index.ts`. Either remove `createActiveGolem()` or update it to return `RuntimeActiveGolem` if tests need it. ### 2. Remove orphaned legacy compatibility functions from `utils.ts` - **File**: `src/lib/game/data/golems/utils.ts` — Four `@deprecated` functions exist only for legacy compatibility: - `getGolemFloorDuration()` — returns hardcoded `3` - `getGolemDamage()` — returns `0` - `getGolemAttackSpeed()` — returns `0` - `getGolemMaintenanceMultiplier()` — returns `1` - **Action**: Remove these four functions. Verify no callers exist (grep confirms none in source). ### 3. Update `fabricator-spec.md` files reference table - **File**: `docs/specs/attunements/fabricator/fabricator-spec.md` (line ~253) - **Current text**: `src/lib/game/data/golems/ | Golem definitions (10 golems)` - **Should be**: `src/lib/game/data/golems/ | Golem component definitions (4 cores, 7 frames, 4 mind circuits, 8 enchantments)` ### 4. Update `spire-combat-spec.md` §9 Golemancy System - **File**: `docs/specs/spire-combat-spec.md` (lines 413-548) - **Current state**: §9 still references the old `GolemDefinition` interface with fields like `summonCostType`, `maintenanceCostType`, `golemDef`, `golem.baseDamage`, `golem.attackSpeed`, `golem.element`, `golem.maintenanceCost` - **Should be**: Updated to reflect the component-based system where golem stats are derived from Core + Frame + Mind Circuit + Enchantments - **§9.7 Golem Data Shape**: Replace old `GolemDefinition` interface with the new `SerializedGolemDesign` + `RuntimeActiveGolem` types - **§9.3 Summoning pseudocode**: Update to reference `golemDesigns` and component-based cost calculation - **§9.4 Combat pseudocode**: Update to reference frame-based damage/speed and circuit-based spell casting - **§9.5 Maintenance pseudocode**: Update to reference core-based upkeep calculation - **§11 Known Gaps table**: "Golemancy combat" row says "Disconnected" — should be updated to "Implemented" or removed ### 5. Update `GAME_BRIEFING.md` Golemancy section - **File**: `docs/GAME_BRIEFING.md` (lines ~758-810) - **Current state**: Contains a "Golem Types (10 Total — undergoing redesign, see issue #268)" section with the old 10 predefined golems (Earth, Steel, Crystal, Sand, Lava, Galvanic, Obsidian, Prism, Quicksilver, Voidstone) - **Action**: Replace with a summary of the component-based system. Remove the old golem type tables and the "⚠ undergoing redesign" note. ### 6. Update `golemancy-spec.md` §19 Files Reference - **File**: `docs/specs/attunements/fabricator/systems/golemancy-spec.md` (last section) - **Current text**: `docs/specs/spire-combat-spec.md §9` says "Authoritative runtime spec (needs update)" - **Action**: This is a reminder to itself — once §9 is updated, remove the "(needs update)" note. ## Verification Steps After cleanup: 1. Run `bun run build` to confirm no compilation errors 2. Run `bun run test` to confirm all tests pass 3. Run `grep -r "GOLEMS_DEF\|summonedGolems\|golemId\|GolemDef\|ActiveGolemV2" src/` to confirm no legacy references remain
Anexim added the ai:todo label 2026-06-07 12:36:43 +02:00
n8n-gitea was assigned by Anexim 2026-06-07 12:36:43 +02:00
Anexim added ai:in-progress and removed ai:todo labels 2026-06-07 12:41:24 +02:00
Author
Owner

Starting work on the golemancy redesign cleanup. Will work through all 6 items: remove orphaned types/utils, update docs (fabricator-spec, spire-combat-spec, golemancy-spec, GAME_BRIEFING), then verify with build+test+grep.

Starting work on the golemancy redesign cleanup. Will work through all 6 items: remove orphaned types/utils, update docs (fabricator-spec, spire-combat-spec, golemancy-spec, GAME_BRIEFING), then verify with build+test+grep.
Anexim added ai:done and removed ai:in-progress labels 2026-06-07 12:55:13 +02:00
Author
Owner

All 6 cleanup items complete:

  1. Removed ActiveGolemV2 type from types.ts and its export from index.ts
  2. Updated createActiveGolem in utils.ts to return RuntimeActiveGolem (the actual runtime type)
  3. Removed 4 deprecated functions from utils.ts: getGolemFloorDuration, getGolemDamage, getGolemAttackSpeed, getGolemMaintenanceMultiplier — zero callers found
  4. Updated golemancy-data.test.ts to use RuntimeActiveGolem type assertion
  5. Updated docs: fabricator-spec.md reference table, spire-combat-spec.md §9 (full rewrite to component-based system + Known Gaps table), golemancy-spec.md §19 (removed "needs update" note), GAME_BRIEFING.md (replaced old golem types with component-based summary)

Verification:

  • bun run build — compiled successfully
  • bun run test — 52 test files, 1009 tests passed
  • grep -r "GOLEMS_DEF|summonedGolems|golemId|GolemDef|ActiveGolemV2" src/ — only a comment remains
  • grep -r "getGolemFloorDuration|getGolemDamage|getGolemAttackSpeed|getGolemMaintenanceMultiplier" src/ — zero matches
  • Pre-commit hooks passed (file size check, tests, circular deps, project structure update)
  • Committed and pushed (13 files changed, 126 insertions, 151 deletions)
✅ All 6 cleanup items complete: 1. **Removed `ActiveGolemV2` type** from `types.ts` and its export from `index.ts` 2. **Updated `createActiveGolem`** in `utils.ts` to return `RuntimeActiveGolem` (the actual runtime type) 3. **Removed 4 deprecated functions** from `utils.ts`: `getGolemFloorDuration`, `getGolemDamage`, `getGolemAttackSpeed`, `getGolemMaintenanceMultiplier` — zero callers found 4. **Updated `golemancy-data.test.ts`** to use `RuntimeActiveGolem` type assertion 5. **Updated docs**: `fabricator-spec.md` reference table, `spire-combat-spec.md §9` (full rewrite to component-based system + Known Gaps table), `golemancy-spec.md §19` (removed "needs update" note), `GAME_BRIEFING.md` (replaced old golem types with component-based summary) **Verification:** - ✅ `bun run build` — compiled successfully - ✅ `bun run test` — 52 test files, 1009 tests passed - ✅ `grep -r "GOLEMS_DEF|summonedGolems|golemId|GolemDef|ActiveGolemV2" src/` — only a comment remains - ✅ `grep -r "getGolemFloorDuration|getGolemDamage|getGolemAttackSpeed|getGolemMaintenanceMultiplier" src/` — zero matches - ✅ Pre-commit hooks passed (file size check, tests, circular deps, project structure update) - ✅ Committed and pushed (13 files changed, 126 insertions, 151 deletions)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Anexim/Mana-Loop#290