Policy list viewer double-lists rules a bot publishes under both the stable and legacy types (de-dup keys on the raw recommendation) #321

Closed
opened 2026-10-05 16:38:45 -04:00 by jared · 0 comments
Owner

Room Settings → Policy Lists (src/app/features/room-settings/PolicyListViewer.tsx) reads m.policy.rule.* and the legacy org.matrix.mjolnir.rule.* types, and "merges/de-dupes" them. dedupePolicyEntries (line 92) keys on `${entry.entity} ${entry.recommendation}` using the raw recommendation. A stable rule says m.ban and its legacy twin says org.matrix.mjolnir.ban, so the keys never match. recommendationLabel() shows both as "Ban".

Measured: a list with m.policy.rule.user {entity: "@spammer:evil.example", recommendation: "m.ban"} and org.matrix.mjolnir.rule.user {entity: "@spammer:evil.example", recommendation: "org.matrix.mjolnir.ban"} shows Users (3) with @spammer:evil.example · Ban · spam waves twice (the third entry is a glob rule).

Fix: normalise before keying (org.matrix.mjolnir.ban → m.ban, the same mapping recommendationLabel uses), and add a unit case with one stable and one legacy rule for the same entity.

The rest of the viewer checked out:

  • a removed rule (empty content) is hidden;
  • @*:spam.example gets the "glob" badge;
  • the Rooms (1) and Servers (1) tabs work;
  • an HTML reason (<b>raid</b> origin) is shown as text.
  • It's admin-only (PL ≥ 50 or creator) and needs a room ID typed in. A picker for rooms the user is in, or for the space's linked policy rooms, would make it easier to find.

Found in the October 2026 client audit (Playwright against a local Synapse + LiveKit stack, plus code reading). Code refs are at cinny 30e2dbcd, cinny-desktop 8f67ec7, element-call 3b0050e8.

Room Settings → Policy Lists (`src/app/features/room-settings/PolicyListViewer.tsx`) reads `m.policy.rule.*` **and** the legacy `org.matrix.mjolnir.rule.*` types, and "merges/de-dupes" them. `dedupePolicyEntries` (line 92) keys on `` `${entry.entity} ${entry.recommendation}` `` using the **raw** recommendation. A stable rule says `m.ban` and its legacy twin says `org.matrix.mjolnir.ban`, so the keys never match. `recommendationLabel()` shows both as "Ban". **Measured:** a list with `m.policy.rule.user` `{entity: "@spammer:evil.example", recommendation: "m.ban"}` and `org.matrix.mjolnir.rule.user` `{entity: "@spammer:evil.example", recommendation: "org.matrix.mjolnir.ban"}` shows **Users (3)** with `@spammer:evil.example · Ban · spam waves` **twice** (the third entry is a glob rule). **Fix:** normalise before keying (`org.matrix.mjolnir.ban` → `m.ban`, the same mapping `recommendationLabel` uses), and add a unit case with one stable and one legacy rule for the same entity. The rest of the viewer checked out: - a removed rule (empty content) is hidden; - `@*:spam.example` gets the "glob" badge; - the Rooms (1) and Servers (1) tabs work; - an HTML reason (`<b>raid</b> origin`) is shown as text. - It's admin-only (PL ≥ 50 or creator) and needs a room ID typed in. A picker for rooms the user is in, or for the space's linked policy rooms, would make it easier to find. --- _Found in the October 2026 client audit (Playwright against a local Synapse + LiveKit stack, plus code reading). Code refs are at cinny `30e2dbcd`, cinny-desktop `8f67ec7`, element-call `3b0050e8`._
jared added the bugpriority: lowarea: moderation labels 2026-10-05 16:38:45 -04:00
jared closed this issue 2026-10-18 02:05:13 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: LotusGuild/cinny#321