Bug Description
parseSettings() in src/config.ts (line 220) is missing the discordUserIds parameter from its signature, but:
- Both callers (
loadSettings at line ~340 and reloadSettings at line ~348) pass a second argument: parseSettings(raw, extractDiscordUserIds(rawText))
- The function body (line ~252) references
discordUserIds to populate discord.allowedUserIds
This causes a ReferenceError: discordUserIds is not defined crash on daemon startup.
ReferenceError: discordUserIds is not defined
at parseSettings (src/config.ts:252:23)
at loadSettings (src/config.ts:340:12)
Root Cause
An incomplete refactoring in commit 58f6c4f removed discordUserIds from the function signature but left the body and callers unchanged.
Why This Matters
Discord snowflake IDs exceed Number.MAX_SAFE_INTEGER (2^53 - 1). The extractDiscordUserIds() function exists specifically to extract these IDs as raw strings from the JSON text before JSON.parse loses precision. Without this parameter, Discord authentication silently breaks even if the crash is worked around.
Fix
One-line change — add the parameter back to the signature:
-function parseSettings(raw: Record<string, any>): Settings {
+function parseSettings(raw: Record<string, any>, discordUserIds?: string[]): Settings {
Related
Bug Description
parseSettings()insrc/config.ts(line 220) is missing thediscordUserIdsparameter from its signature, but:loadSettingsat line ~340 andreloadSettingsat line ~348) pass a second argument:parseSettings(raw, extractDiscordUserIds(rawText))discordUserIdsto populatediscord.allowedUserIdsThis causes a
ReferenceError: discordUserIds is not definedcrash on daemon startup.Root Cause
An incomplete refactoring in commit
58f6c4fremoveddiscordUserIdsfrom the function signature but left the body and callers unchanged.Why This Matters
Discord snowflake IDs exceed
Number.MAX_SAFE_INTEGER(2^53 - 1). TheextractDiscordUserIds()function exists specifically to extract these IDs as raw strings from the JSON text beforeJSON.parseloses precision. Without this parameter, Discord authentication silently breaks even if the crash is worked around.Fix
One-line change — add the parameter back to the signature:
Related