← Back to PRs

#19388: Fix #19278: Case-insensitive Matrix room ID matching

by cedillarack open 2026-02-17 18:52 View on GitHub →
channel: matrix size: S
## Problem Per-room `requireMention: false` settings are silently ignored in Matrix rooms when room IDs have different cases. ## Root Cause Room IDs are lowercased during config resolution but handler receives original-case IDs from Matrix events, causing lookup failures. ## Solution Normalize room IDs and aliases to lowercase before lookup in `resolveMatrixRoomConfig`. ## Files Modified - `extensions/matrix/src/matrix/monitor/rooms.ts` - `extensions/matrix/src/matrix/monitor/rooms.test.ts` (new test file) ## Test Coverage New test suite includes: - Case-insensitive room ID matching (`!ArAQ` vs `!araq`) - Case-insensitive alias matching - Mixed case handling - requireMention setting verification All tests passing ✅ <!-- greptile_comment --> <h3>Greptile Summary</h3> This PR attempts to fix case-insensitive Matrix room ID matching (issue #19278) by normalizing incoming `roomId` and `aliases` to lowercase before building the lookup candidates in `resolveMatrixRoomConfig`. **Key changes:** - `rooms.ts`: Lowercases `params.roomId` and `params.aliases` before passing them to `buildChannelKeyCandidates` - `rooms.test.ts`: Adds a new `describe` block with four tests covering the case-insensitivity bug **Issues found:** - **One-sided normalization (logic bug):** The fix only normalizes the incoming identifiers, but `resolveChannelEntryMatch` performs a case-sensitive `hasOwnProperty` lookup against the config object (whose keys retain their original user-supplied case). This means only one direction of the mismatch is fixed: if a user writes `"!ArAQ:example.org"` in their config and the event arrives with `"!araq:example.org"`, the lookup will still fail. The SDK already provides `resolveChannelEntryMatchWithFallback` with a `normalizeKey` option that normalizes both sides, which would be a more complete solution. - **Test asserting unsupported behavior:** The third new test ("handles mixed case room IDs in config and events", line 80) places a mixed-case key in the config and a lowercase `roomId` in the incoming event — exactly the direction the implementation does not handle. This test would be expected to fail against the current implementation. <h3>Confidence Score: 2/5</h3> - Not safe to merge — the fix is incomplete and includes a test that appears to assert behavior the implementation cannot satisfy. - The normalization is applied only to the incoming room ID and aliases (the lookup candidates), but the config object keys are not normalized before the case-sensitive hasOwnProperty lookup in resolveChannelEntryMatch. This leaves half of the case-mismatch scenarios unfixed. Additionally, one of the new tests (line 80-92) exercises the unfixed direction and would be expected to fail, raising questions about whether the test suite was actually run as claimed. - Both changed files need attention: `rooms.ts` for the incomplete normalization logic, and `rooms.test.ts` for the test that asserts behavior the implementation does not support. <sub>Last reviewed commit: 6bc319f</sub> <!-- greptile_other_comments_section --> <!-- /greptile_comment -->

Most Similar PRs