#22221: fix: preserve case of target ID in normalizeTargetId
size: XS
experienced-contributor
Cluster:
Slack Integration Improvements
## Summary
Fixes #22217
Slack user IDs are case-sensitive (e.g. `U3UR2BMQ8`). `normalizeTargetId()` was lowercasing the entire `kind:id` string, converting `channel:U3UR2BMQ8` to `channel:u3ur2bmq8`, causing Slack API `channel_not_found` errors when opening DM channels.
## Changes
- Only lowercase the `kind` prefix, preserve the original case of `id`
## Before / After
| | Result |
|---|---|
| Before | `channel:u3ur2bmq8` ❌ |
| After | `channel:U3UR2BMQ8` ✅ |
---
🤖 Generated with Claude Code
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Fixed Slack API `channel_not_found` errors by preserving case-sensitivity in user/channel IDs. The `normalizeTargetId()` function now only lowercases the `kind` prefix (`user`/`channel`) while maintaining the original case of the ID portion (e.g., `U3UR2BMQ8`).
- Changed normalization from `"channel:u3ur2bmq8"` to `"channel:U3UR2BMQ8"`
- Fixes integration with Slack API which requires case-sensitive IDs
- Tests in `src/slack/targets.test.ts` need updating to reflect new normalized format
<h3>Confidence Score: 4/5</h3>
- Safe to merge after updating test expectations
- The fix correctly addresses the Slack API case-sensitivity issue with a minimal, focused change. However, the existing tests expect lowercase normalized IDs and will fail without updates. Once tests are updated to reflect the new behavior, this should be safe to merge.
- Check `src/slack/targets.test.ts` - test expectations need updating
<sub>Last reviewed commit: ddd78e6</sub>
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#13489: fix: preserve Slack channel/user ID case in target normalization
by sandieman2 · 2026-02-10
91.2%
#8024: fix(slack): resolve channel names via directory for cross-account m...
by emma-digital-assistant · 2026-02-03
83.3%
#19430: Slack: infer bare user targets before media upload
by gg2uah · 2026-02-17
81.7%
#10643: fix(slack): classify D-prefix DMs correctly when channel_type disag...
by mcaxtr · 2026-02-06
81.3%
#16562: fix(signal): preserve case for group and username targets
by akalypse · 2026-02-14
78.4%
#8648: fix: don't treat bare numeric Discord IDs as definitive target IDs
by dbottme · 2026-02-04
77.6%
#22101: fix(slack): dedupe mentions by ts fallback for app_mention
by AIflow-Labs · 2026-02-20
76.7%
#8684: fix(slack): add title param and channel resolution for file upload
by shuans · 2026-02-04
76.1%
#14462: fix(messaging): preserve case in target normalization fallback (#14...
by lailoo · 2026-02-12
75.7%
#5312: fix(slack): skip users.list API call when all user entries are IDs
by gunpyo-park-musinsa · 2026-01-31
75.1%