diff --git a/docs/code-bridge/requests/REQ-2026-04-13-rules-mod-config-not-read-at-runtime.md b/docs/code-bridge/requests/REQ-2026-04-13-rules-mod-config-not-read-at-runtime.md new file mode 100644 index 0000000..9913674 --- /dev/null +++ b/docs/code-bridge/requests/REQ-2026-04-13-rules-mod-config-not-read-at-runtime.md @@ -0,0 +1,74 @@ +# Bug Follow-up v2: COMMON Config File Not Read at Runtime + +**Date:** 2026-04-13 +**Topic:** firefrostrules-common.toml has correct values but mod still serves default rules +**Priority:** HIGH — Otherworld still broken +**Filed by:** Chronicler #86 +**Related to:** REQ-2026-04-13-rules-mod-config-still-resetting.md + +--- + +## What We Did + +1. Deployed firefrostrules-1.0.2-1.20.1-forge.jar to Otherworld (NC1, volume d4790f45) +2. Deleted old world/serverconfig/firefrostrules-server.toml +3. Started server — generated config/firefrostrules-common.toml with defaults +4. Stopped server — wrote real values to config/firefrostrules-common.toml +5. Restarted — config file still has correct values (confirmed) +6. Restarted again — config file still has correct values (confirmed) + +Config persistence is fixed. ✅ + +## What's Still Wrong + +Player ran `/rules` and got the hardcoded default rules, not Discord content. + +Log evidence: + +``` +[22:42:38] [modloading-worker-0/INFO] [com.firefrostgaming.rules.ServerRules/]: Firefrost Rules Mod Initialized. +[22:43:08] [main/INFO] [com.firefrostgaming.rules.ServerRules/]: Registered /rules command. +[22:43:58] [Server thread/INFO] [minecraft/MinecraftServer/]: [Fire] Server Rules +Please check Discord for the full rules list. +``` + +Two problems: + +1. **Loading handler never fired** — Code's `onConfigLoaded` handler should have logged "Rules mod config loaded successfully. Channel: 1493228237860638770" — it's completely absent from logs. The handler is not executing. + +2. **Default rules served** — `/rules` returned hardcoded defaults, meaning `ServerRulesConfig.BOT_TOKEN.get()` is returning `YOUR_TOKEN_HERE` at runtime even though the file has the real token. + +## What This Means + +The config file has correct values but `ServerRulesConfig.SPEC` is not reading from it. The `ModConfig.Type.COMMON` registration may not be correctly linking the spec to the file on disk, or the config values are being read before the file is loaded. + +## Hypothesis + +In Forge 1.20.1, `ModConfig.Type.COMMON` configs are loaded from `config/-common.toml`. But the filename Forge generates may need to match exactly what the spec expects. Check: + +1. What filename is Forge actually generating? Is it `firefrostrules-common.toml` or something else like `firefrostrules-server.toml` even with COMMON type? +2. Is `ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, ServerRulesConfig.SPEC)` being called before or after the config file is read? +3. Is there a `ModConfigEvent.Loading` listener that confirms the spec is bound to the correct file? + +## Current File State on Server + +``` +Path: /var/lib/pterodactyl/volumes/d4790f45-b1bc-43b8-98c4-425238387ee3/config/firefrostrules-common.toml +bot_token = "MTQ4NzA4MDE2Njk2OTU3NzUwMg.GU5EsT.mqBwo7XUHsciN9jNy9OygTRkaMZ9qJ2tHw7HbI" +channel_id = "1493228237860638770" +message_id = "1493228916998013101" +``` + +File is correct. Mod is not reading it. + +## What Code Needs to Do + +1. Add a debug log immediately after `ServerRulesConfig.BOT_TOKEN.get()` in `RulesCommand.java` to print the actual value being read at command execution time +2. Verify the `ModConfigEvent.Loading` listener is actually being registered and firing +3. Check if there's a timing issue — config might need to be read after `FMLServerStartedEvent` rather than at command time +4. Verify COMMON type generates correct filename in 1.20.1 + +## Applies To + +1.20.1 confirmed broken. 1.21.1 and 1.16.5 status unknown — may have same issue. +Bump to 1.0.3 once fixed. Update CHANGELOG.md.