v1.0.4: Diagnostic build — INFO-level logging for config read path

Added [DIAG] logs to RulesCommand (token length, channel, messageId,
isValid) and DiscordFetcher (fetch attempt, raw messageId on failure).
1.20.1 only — for Otherworld debugging.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Claude (Chronicler #83 - The Compiler)
2026-04-13 18:05:26 -05:00
parent 36caddc609
commit f23f71ef04
5 changed files with 32 additions and 5 deletions

View File

@@ -0,0 +1,24 @@
# Architectural Response
**Re:** REQ-2026-04-13-rules-still-returning-defaults
**Date:** 2026-04-13
## 1. Verdict
Diagnostic build v1.0.4 shipped (1.20.1 only). Added INFO-level logging to RulesCommand and DiscordFetcher to trace exactly where the flow breaks.
## 2. What v1.0.4 Logs
On every /rules command:
```
[DIAG] token length=X, channel=Y, messageId=Z, isValid=true/false
```
On every fetch attempt:
```
[DIAG] fetchRulesAsync called. messageId='Z', isValid=true/false
[DIAG] Fetching from Discord: channel=Y, message=Z
```
If isValid=false, the raw messageId value is logged to reveal formatting issues.
## 3. Deploy
firefrostrules-1.0.4-1.20.1-forge.jar → Otherworld. Have a player run /rules and report the [DIAG] log lines.

View File

@@ -10,7 +10,7 @@ buildscript {
apply plugin: 'net.minecraftforge.gradle'
version = '1.0.3'
version = '1.0.4'
group = 'com.firefrostgaming.rules'
archivesBaseName = 'firefrostrules'

View File

@@ -16,14 +16,16 @@ public class DiscordFetcher {
private static final HttpClient CLIENT = HttpClient.newBuilder().connectTimeout(Duration.ofSeconds(10)).build();
public static CompletableFuture<String> fetchRulesAsync() {
String messageId = ServerRulesConfig.MESSAGE_ID.get();
LOGGER.info("[DIAG] fetchRulesAsync called. messageId='{}', isValid={}", messageId, ServerRulesConfig.isMessageIdValid());
if (!ServerRulesConfig.isMessageIdValid()) {
LOGGER.error("Invalid Discord Message ID in config.");
LOGGER.error("Invalid Discord Message ID in config. Raw value: '{}'", messageId);
return CompletableFuture.completedFuture(null);
}
String token = ServerRulesConfig.BOT_TOKEN.get();
String channelId = ServerRulesConfig.CHANNEL_ID.get();
String messageId = ServerRulesConfig.MESSAGE_ID.get();
URI uri = URI.create("https://discord.com/api/v10/channels/" + channelId + "/messages/" + messageId);
LOGGER.info("[DIAG] Fetching from Discord: channel={}, message={}", channelId, messageId);
HttpRequest request = HttpRequest.newBuilder().uri(uri)
.header("Authorization", "Bot " + token)
.header("Accept", "application/json").GET().build();

View File

@@ -20,10 +20,11 @@ public class RulesCommand {
return 1;
}
ServerPlayer player = (ServerPlayer) source.getEntity();
LOGGER.debug("Config state — token length: {}, channel: {}, message: {}",
LOGGER.info("[DIAG] token length={}, channel={}, messageId={}, isValid={}",
ServerRulesConfig.BOT_TOKEN.get().length(),
ServerRulesConfig.CHANNEL_ID.get(),
ServerRulesConfig.MESSAGE_ID.get());
ServerRulesConfig.MESSAGE_ID.get(),
ServerRulesConfig.isMessageIdValid());
if (!CooldownManager.checkAndUpdateCooldown(player)) return 0;
if (RulesCache.isCacheValid()) {
player.sendSystemMessage(DiscordFormatter.formatRules(RulesCache.getRules()));