[High] [Bug] Activity log flooded with duplicate PAUSED conversion messages every tick #337

Closed
opened 2026-06-09 12:51:20 +02:00 by Anexim · 2 comments
Owner

Bug: Activity log flooded with duplicate "PAUSED" conversion messages

Steps to reproduce

  1. Open the game
  2. Unlock all elements (via Debug → Elements → "Unlock All Elements")
  3. Let the game run for a few seconds
  4. Check localStorage → mana-loop-ui-storagelogs

Expected

Activity log shows meaningful events, possibly a few "conversion paused" warnings at most.

Actual

Activity log is flooded with 50+ identical messages like:

⚠️ PAUSED: transference conversion — Insufficient raw regen (need 50.00/hr, have 2.00/hr)
⚠️ PAUSED: earth conversion — Insufficient raw regen (need 62.50/hr, have 2.00/hr)
⚠️ PAUSED: fire conversion — Insufficient raw regen (need 46.88/hr, have 2.00/hr)

These repeat every tick (200ms), quickly filling the log and causing performance degradation.

Root cause

In gameStore.ts tick pipeline, the conversion pause logging runs every tick for every paused conversion without any deduplication or throttling. With many elements unlocked but insufficient regen, this generates 3+ log messages per tick.

Store

useGameStoregameStore.ts → tick pipeline (conversion pause logging loop)

## Bug: Activity log flooded with duplicate "PAUSED" conversion messages ### Steps to reproduce 1. Open the game 2. Unlock all elements (via Debug → Elements → "Unlock All Elements") 3. Let the game run for a few seconds 4. Check localStorage → `mana-loop-ui-storage` → `logs` ### Expected Activity log shows meaningful events, possibly a few "conversion paused" warnings at most. ### Actual Activity log is flooded with 50+ identical messages like: ``` ⚠️ PAUSED: transference conversion — Insufficient raw regen (need 50.00/hr, have 2.00/hr) ⚠️ PAUSED: earth conversion — Insufficient raw regen (need 62.50/hr, have 2.00/hr) ⚠️ PAUSED: fire conversion — Insufficient raw regen (need 46.88/hr, have 2.00/hr) ``` These repeat every tick (200ms), quickly filling the log and causing performance degradation. ### Root cause In `gameStore.ts` tick pipeline, the conversion pause logging runs every tick for every paused conversion without any deduplication or throttling. With many elements unlocked but insufficient regen, this generates 3+ log messages per tick. ### Store `useGameStore` → `gameStore.ts` → tick pipeline (conversion pause logging loop)
Anexim added the ai:todo label 2026-06-09 12:51:20 +02:00
n8n-gitea was assigned by Anexim 2026-06-09 12:51:20 +02:00
Anexim added ai:in-progress and removed ai:todo labels 2026-06-09 15:19:14 +02:00
Author
Owner

Starting investigation. Root cause identified in issue: conversion pause logging in the tick pipeline runs every 200ms without deduplication. Will locate the exact code in gameStore.ts / tick-pipeline.ts.

Starting investigation. Root cause identified in issue: conversion pause logging in the tick pipeline runs every 200ms without deduplication. Will locate the exact code in gameStore.ts / tick-pipeline.ts.
Anexim added ai:done and removed ai:in-progress labels 2026-06-09 15:32:12 +02:00
Author
Owner

Fix Applied

Root cause: In stores/gameStore.ts, the conversion pause logging loop at line 181-184 ran every tick (200ms) for every paused conversion without any deduplication. With many elements unlocked but insufficient raw regen, this generated 20+ identical messages per tick, flooding the activity log.

Fix: Added a module-level Set<string> (loggedPausedConversions) that tracks which element conversions have already been logged. Each paused conversion is logged only once — on the first tick it becomes paused. A cleanup pass removes entries for conversions that are no longer paused, so they get re-logged if they pause again later.

Changes:

  • src/lib/game/stores/gameStore.ts — Added loggedPausedConversions Set, wrapped the log call in a dedup check, added cleanup loop for un-paused conversions
  • src/lib/game/__tests__/paused-conversion-dedup.test.ts — New regression test with 4 test cases covering: single-log-per-pause, no-duplicate-across-ticks, re-log-after-unpause, and zero-logs-when-all-active

Verification: All 60 test files (1094 tests) pass, including 4 new regression tests. File size: 399 lines (under 400-line limit).

## Fix Applied **Root cause:** In `stores/gameStore.ts`, the conversion pause logging loop at line 181-184 ran every tick (200ms) for every paused conversion without any deduplication. With many elements unlocked but insufficient raw regen, this generated 20+ identical messages per tick, flooding the activity log. **Fix:** Added a module-level `Set<string>` (`loggedPausedConversions`) that tracks which element conversions have already been logged. Each paused conversion is logged only once — on the first tick it becomes paused. A cleanup pass removes entries for conversions that are no longer paused, so they get re-logged if they pause again later. **Changes:** - `src/lib/game/stores/gameStore.ts` — Added `loggedPausedConversions` Set, wrapped the log call in a dedup check, added cleanup loop for un-paused conversions - `src/lib/game/__tests__/paused-conversion-dedup.test.ts` — New regression test with 4 test cases covering: single-log-per-pause, no-duplicate-across-ticks, re-log-after-unpause, and zero-logs-when-all-active **Verification:** All 60 test files (1094 tests) pass, including 4 new regression tests. File size: 399 lines (under 400-line limit).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Anexim/Mana-Loop#337