#16828: fix(config): transform Discord user/role IDs to strings
stale
size: XS
Cluster:
Discord and MS Teams Fixes
Fixes #16681
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Transforms Discord user and role IDs from numbers to strings at the schema level to prevent precision loss with large snowflake IDs. The change applies `.transform((val) => val?.map((v) => String(v)))` to `users` and `roles` fields in both `DiscordGuildChannelSchema` and `DiscordGuildSchema`. This ensures that large 64-bit Discord IDs (which can exceed JavaScript's safe integer range) are preserved as strings before being used in allowlist matching, where they're compared via `Set.has()` operations.
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with no identified issues
- The transformation is minimal, focused, and solves a real precision issue with large Discord snowflake IDs. The change is backward compatible (strings and numbers both get converted to strings), and the downstream code already handles these values as strings via `String()` conversions. The implementation follows existing patterns in the codebase and correctly uses Zod's transform API with proper null handling.
- No files require special attention
<sub>Last reviewed commit: eeb1b5b</sub>
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#22557: fix(discord): coerce exec approval approver IDs to string to preven...
by zwffff · 2026-02-21
82.1%
#12204: fix(discord): resolve numeric guildId/channelId pairs in channel al...
by mcaxtr · 2026-02-09
78.3%
#19401: fix(ui): prevent precision loss when coercing large numeric strings...
by Operative-001 · 2026-02-17
77.2%
#8648: fix: don't treat bare numeric Discord IDs as definitive target IDs
by dbottme · 2026-02-04
75.8%
#22524: fix(doctor): preserve precision of large Discord snowflake IDs in -...
by jmasson · 2026-02-21
75.3%
#21463: fix(discord): prevent WebSocket death spiral + fix numeric channel ID…
by akropp · 2026-02-20
74.3%
#19111: fix(config): warn on numeric IDs that lose precision
by Clawborn · 2026-02-17
72.3%
#17648: fix: Discord guild channel detection using rawMessage.guild_id
by MisterGuy420 · 2026-02-16
71.8%
#16720: fix: fall back to guild_id when guild object is missing in resolveD...
by xqliu · 2026-02-15
70.9%
#21804: fix: improve type safety and use project runtime logging
by hobostay · 2026-02-20
70.5%