[High] [Bug] Pact system: floors 140/150 unlock wrong elements, completion logic duplicated, spec self-contradictory #329

Closed
opened 2026-06-08 16:02:46 +02:00 by Anexim · 3 comments
Owner

Spec: docs/specs/attunements/invoker/systems/pact-system-spec.md

Discrepancies found:

DISC-11 [HIGH] — Floors 140/150 element composition mismatched

  • Floor 140 (Radiant Flames): Spec §7.1 says should unlock light, fire. Code guardian-data.ts uses [sand, earth, water] → resolves to earth, water, sand
  • Floor 150 (Miasma): Spec §7.1 says should unlock air, death. Code uses [lightning, fire, air] → resolves to fire, air, lightning
  • Impact: Signing floor 140 pact unlocks wrong mana types. Signing floor 150 pact unlocks wrong mana types.
  • Fix: Change floor 140 elements to ['light', 'fire', 'radiantflames'] and floor 150 to ['air', 'death', 'miasma']

DISC-12 [HIGH] — Spec internally inconsistent for floors 140-150

  • Spec §7.1 maps floor 140→light, fire and 150→air, death
  • Spec §8.2 maps floor 140→sand+earth+water and 150→lightning+fire+air (matching the code)
  • These two tables contradict each other
  • Fix: Reconcile spec — determine which mapping is correct and update both tables

DISC-4 [HIGH] — Pact ritual completion logic duplicated

  • Spec §2.4: Single completePactRitual() method
  • Code: Completion logic exists in two separate places:
    1. prestigeStore.tscompletePactRitual(addLog)
    2. pact-ritual.tsprocessPactRitual() which also performs completion inline
  • Impact: Maintenance risk, divergence in behavior between the two paths
  • Fix: Refactor pipeline to delegate to store's completePactRitual() instead of duplicating logic

DISC-6 [MEDIUM] — 4 of 12 declared boon types never used

  • Spec §3: Lists 12 boon types
  • Code (guardian-data.ts): Only uses 8 types: elementalDamage, maxMana, manaRegen, castingSpeed, rawDamage, critDamage, insightGain, spellEfficiency
  • Missing: critChance, manaGain, studySpeed, prestigeInsight
  • Fix: Either add guardians that use these boon types, or remove them from spec

DISC-8 [MEDIUM] — signedPactDetails reset by startNewLoop() but spec says it should persist

  • Spec §5.1: signedPactDetails should NOT be reset on new loop
  • Code (prestigeStore.ts): Both startNewLoop() and resetPrestigeForNewLoop() reset signedPactDetails
  • Fix: Remove signedPactDetails from reset logic in startNewLoop()
**Spec:** `docs/specs/attunements/invoker/systems/pact-system-spec.md` **Discrepancies found:** ### DISC-11 [HIGH] — Floors 140/150 element composition mismatched - **Floor 140 (Radiant Flames):** Spec §7.1 says should unlock `light, fire`. Code `guardian-data.ts` uses `[sand, earth, water]` → resolves to `earth, water, sand` ❌ - **Floor 150 (Miasma):** Spec §7.1 says should unlock `air, death`. Code uses `[lightning, fire, air]` → resolves to `fire, air, lightning` ❌ - **Impact:** Signing floor 140 pact unlocks wrong mana types. Signing floor 150 pact unlocks wrong mana types. - **Fix:** Change floor 140 elements to `['light', 'fire', 'radiantflames']` and floor 150 to `['air', 'death', 'miasma']` ### DISC-12 [HIGH] — Spec internally inconsistent for floors 140-150 - **Spec §7.1** maps floor 140→`light, fire` and 150→`air, death` - **Spec §8.2** maps floor 140→`sand+earth+water` and 150→`lightning+fire+air` (matching the code) - These two tables contradict each other - **Fix:** Reconcile spec — determine which mapping is correct and update both tables ### DISC-4 [HIGH] — Pact ritual completion logic duplicated - **Spec §2.4:** Single `completePactRitual()` method - **Code:** Completion logic exists in two separate places: 1. `prestigeStore.ts` → `completePactRitual(addLog)` 2. `pact-ritual.ts` → `processPactRitual()` which also performs completion inline - **Impact:** Maintenance risk, divergence in behavior between the two paths - **Fix:** Refactor pipeline to delegate to store's `completePactRitual()` instead of duplicating logic ### DISC-6 [MEDIUM] — 4 of 12 declared boon types never used - **Spec §3:** Lists 12 boon types - **Code (`guardian-data.ts`):** Only uses 8 types: `elementalDamage`, `maxMana`, `manaRegen`, `castingSpeed`, `rawDamage`, `critDamage`, `insightGain`, `spellEfficiency` - **Missing:** `critChance`, `manaGain`, `studySpeed`, `prestigeInsight` - **Fix:** Either add guardians that use these boon types, or remove them from spec ### DISC-8 [MEDIUM] — `signedPactDetails` reset by `startNewLoop()` but spec says it should persist - **Spec §5.1:** `signedPactDetails` should NOT be reset on new loop - **Code (`prestigeStore.ts`):** Both `startNewLoop()` and `resetPrestigeForNewLoop()` reset `signedPactDetails` - **Fix:** Remove `signedPactDetails` from reset logic in `startNewLoop()`
Anexim added the ai:todo label 2026-06-08 16:02:46 +02:00
n8n-gitea was assigned by Anexim 2026-06-08 16:02:46 +02:00
Anexim added ai:in-progress and removed ai:todo labels 2026-06-08 22:41:07 +02:00
Author
Owner

Progress Report — Issue #329 Pact System Bugs

Investigation complete. Here's my analysis:

DISC-11 [HIGH] — Floor 140/150 element composition

Root cause: In guardian-data.ts, floor 140 uses ['sand', 'earth', 'water'] (resolves to Sand mana) instead of ['light', 'fire', 'radiantflames'] (Radiant Flames). Floor 150 uses ['lightning', 'fire', 'air'] (resolves to Lightning mana) instead of ['air', 'death', 'miasma'] (Miasma).

DISC-12 [HIGH] — Spec §7.1 vs §8.2 contradiction

Root cause: Spec §7.1 maps floor 140→Radiant Flames (light+fire), §8.2 maps floor 140→sand+earth+water. The §7.1 table is the authoritative source. §8.2 needs to be updated to match.

DISC-4 [HIGH] — Pact ritual completion logic duplicated

Root cause: pact-ritual.tsprocessPactRitual() has inline completion logic (lines 46-61) that duplicates prestigeStore.tscompletePactRitual(). The store method is never called by the pipeline. Fix: pipeline should delegate to completePactRitual().

DISC-6 [MEDIUM] — 4 unused boon types

Root cause: guardian-data.ts only uses 8 of 12 boon types. Missing: critChance, manaGain, studySpeed, prestigeInsight. These need to be added to existing guardians or removed from spec.

DISC-8 [MEDIUM] — signedPactDetails reset

Current state: Neither startNewLoop() nor resetPrestigeForNewLoop() explicitly resets signedPactDetails. The code appears to already match the spec (persist across loops). Will verify and ensure no regression.

Plan: Fix DISC-11, DISC-12, DISC-4, DISC-6 in order. DISC-8 appears already correct but will add guard.

**Progress Report — Issue #329 Pact System Bugs** Investigation complete. Here's my analysis: ### DISC-11 [HIGH] — Floor 140/150 element composition **Root cause:** In `guardian-data.ts`, floor 140 uses `['sand', 'earth', 'water']` (resolves to Sand mana) instead of `['light', 'fire', 'radiantflames']` (Radiant Flames). Floor 150 uses `['lightning', 'fire', 'air']` (resolves to Lightning mana) instead of `['air', 'death', 'miasma']` (Miasma). ### DISC-12 [HIGH] — Spec §7.1 vs §8.2 contradiction **Root cause:** Spec §7.1 maps floor 140→Radiant Flames (light+fire), §8.2 maps floor 140→sand+earth+water. The §7.1 table is the authoritative source. §8.2 needs to be updated to match. ### DISC-4 [HIGH] — Pact ritual completion logic duplicated **Root cause:** `pact-ritual.ts` → `processPactRitual()` has inline completion logic (lines 46-61) that duplicates `prestigeStore.ts` → `completePactRitual()`. The store method is never called by the pipeline. Fix: pipeline should delegate to `completePactRitual()`. ### DISC-6 [MEDIUM] — 4 unused boon types **Root cause:** `guardian-data.ts` only uses 8 of 12 boon types. Missing: `critChance`, `manaGain`, `studySpeed`, `prestigeInsight`. These need to be added to existing guardians or removed from spec. ### DISC-8 [MEDIUM] — signedPactDetails reset **Current state:** Neither `startNewLoop()` nor `resetPrestigeForNewLoop()` explicitly resets `signedPactDetails`. The code appears to already match the spec (persist across loops). Will verify and ensure no regression. **Plan:** Fix DISC-11, DISC-12, DISC-4, DISC-6 in order. DISC-8 appears already correct but will add guard.
Author
Owner

Fixed and pushed (commit cba3090).

All 5 discrepancies resolved:

ID Severity Fix
DISC-11 HIGH Floor 140 elements: ['sand','earth','water']['light','fire','radiantflames']; Floor 150: ['lightning','fire','air']['air','death','miasma']. Updated boon descs and unique perks to match.
DISC-12 HIGH Reconciled spec §8.2 table to match §7.1 authoritative mappings. Also updated §7.1 to show full 3-element unlock chains.
DISC-4 HIGH Refactored pact-ritual.ts pipeline to only handle progress advancement. Completion now delegates to prestigeStore.completePactRitual() — single source of truth for state writes + logging. Old duplicated inlining (76 lines → 49 lines) removed.
DISC-6 MEDIUM Added 4 missing boon types: critChance (floor 90), manaGain (floor 110), prestigeInsight (floor 200), studySpeed (floor 220). All 12 spec boon types now used.
DISC-8 MEDIUM Verified code already correct — neither startNewLoop() nor resetPrestigeForNewLoop() resets signedPactDetails. Added explicit comment per spec §5.1.

Test spire-utils.test.ts updated to match corrected floor 140/150 elements. All 1086 tests pass.

**Fixed and pushed (commit cba3090).** All 5 discrepancies resolved: | ID | Severity | Fix | |---|---|---| | DISC-11 | HIGH | Floor 140 elements: `['sand','earth','water']` → `['light','fire','radiantflames']`; Floor 150: `['lightning','fire','air']` → `['air','death','miasma']`. Updated boon descs and unique perks to match. | | DISC-12 | HIGH | Reconciled spec §8.2 table to match §7.1 authoritative mappings. Also updated §7.1 to show full 3-element unlock chains. | | DISC-4 | HIGH | Refactored `pact-ritual.ts` pipeline to only handle progress advancement. Completion now delegates to `prestigeStore.completePactRitual()` — single source of truth for state writes + logging. Old duplicated inlining (76 lines → 49 lines) removed. | | DISC-6 | MEDIUM | Added 4 missing boon types: `critChance` (floor 90), `manaGain` (floor 110), `prestigeInsight` (floor 200), `studySpeed` (floor 220). All 12 spec boon types now used. | | DISC-8 | MEDIUM | Verified code already correct — neither `startNewLoop()` nor `resetPrestigeForNewLoop()` resets `signedPactDetails`. Added explicit comment per spec §5.1. | Test `spire-utils.test.ts` updated to match corrected floor 140/150 elements. All 1086 tests pass.
Anexim added ai:done and removed ai:in-progress labels 2026-06-08 22:50:41 +02:00
Author
Owner

All fixes implemented, tested, and pushed in commit cba3090. Issue resolved.

All fixes implemented, tested, and pushed in commit cba3090. Issue resolved.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Anexim/Mana-Loop#329