Add Code bridge request: rules still returning defaults despite config loading
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
# Bug Follow-up v3: /rules Still Returns Hardcoded Defaults Despite Config Loading
|
||||
|
||||
**Date:** 2026-04-13
|
||||
**Topic:** Config loads correctly (Loading handler confirmed), but /rules still returns hardcoded default text
|
||||
**Priority:** HIGH — Otherworld still broken
|
||||
**Filed by:** Chronicler #86
|
||||
**Related to:** REQ-2026-04-13-rules-mod-config-not-read-at-runtime.md
|
||||
|
||||
---
|
||||
|
||||
## Current State
|
||||
|
||||
v1.0.3 deployed to Otherworld. Config loading confirmed:
|
||||
|
||||
```
|
||||
[22:59:13] [main/INFO] [com.firefrostgaming.rules.ServerRules/]: Rules mod config loaded successfully. Channel: 1493228237860638770
|
||||
```
|
||||
|
||||
Config file on disk has correct values. Survives restarts. ✅
|
||||
|
||||
## What's Still Wrong
|
||||
|
||||
`/rules` run twice after server fully loaded — both return hardcoded defaults:
|
||||
|
||||
```
|
||||
[23:00:54] [Server thread/INFO] [minecraft/MinecraftServer]: [Fire] Server Rules
|
||||
1. Be respectful to all players.
|
||||
2. No griefing or cheating.
|
||||
3. Follow staff instructions.
|
||||
Please check Discord for the full rules list.
|
||||
|
||||
[23:01:19] Same result.
|
||||
```
|
||||
|
||||
## What The Logs Show
|
||||
|
||||
No `DiscordFetcher` log output at all — no 401, no 403, no fetch attempt, no fallback warning. The fetcher is completely silent. Only the hardcoded output appears.
|
||||
|
||||
## What This Means
|
||||
|
||||
`DiscordFetcher` is not being called, OR it's being called but returning null/empty silently and falling back to defaults without logging.
|
||||
|
||||
Two likely causes:
|
||||
|
||||
**Cause A — isMessageIdValid() returning false:**
|
||||
`ServerRulesConfig.isMessageIdValid()` checks that message_id matches `^\d{17,20}$`. If the config value is being read with surrounding quotes or whitespace, the regex fails and the command returns defaults without attempting the fetch.
|
||||
|
||||
Add a debug log immediately in `RulesCommand.java` before the validity check:
|
||||
```java
|
||||
LOGGER.info("Rules command: token={}, channel={}, messageId={}",
|
||||
ServerRulesConfig.BOT_TOKEN.get(),
|
||||
ServerRulesConfig.CHANNEL_ID.get(),
|
||||
ServerRulesConfig.MESSAGE_ID.get());
|
||||
LOGGER.info("isMessageIdValid={}", ServerRulesConfig.isMessageIdValid());
|
||||
```
|
||||
|
||||
**Cause B — DiscordFetcher silently returning null:**
|
||||
The async fetch may be completing but returning null or empty string, and `RulesCommand` falls back to defaults without logging. Add explicit logging in `DiscordFetcher` for every code path — success, failure, null return.
|
||||
|
||||
## What Code Needs To Do
|
||||
|
||||
1. Add the debug log in `RulesCommand.java` showing actual runtime values of all three config fields
|
||||
2. Add explicit logging in `DiscordFetcher` for: fetch attempt started, HTTP status received, response body preview, null/empty result
|
||||
3. Bump to v1.0.4, push
|
||||
|
||||
Chronicler will pull v1.0.4, deploy to Otherworld, and report what the new log lines show.
|
||||
|
||||
## Server Info
|
||||
|
||||
- Otherworld, NC1, volume `d4790f45-b1bc-43b8-98c4-425238387ee3`
|
||||
- Mod version: firefrostrules-1.0.3-1.20.1-forge.jar
|
||||
- Config: `/var/lib/pterodactyl/volumes/d4790f45-b1bc-43b8-98c4-425238387ee3/config/firefrostrules-common.toml`
|
||||
Reference in New Issue
Block a user