Skip to content

Implement MSC3389: Relation redactions tests - #913

Merged
reivilibre merged 1 commit into
matrix-org:mainfrom
bxdxnn:main
Sep 8, 2026
Merged

reivilibre merged 1 commit into
matrix-org:mainfrom
bxdxnn:main

Conversation

@bxdxnn

@bxdxnn bxdxnn commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Implement MSC3389 tests.

Pull Request Checklist

Signed-off-by: bxdxnn <267911624+bxdxnn@users.noreply.github.com>
@bxdxnn
bxdxnn requested review from a team as code owners August 19, 2026 11:53
@MadLittleMods MadLittleMods changed the title Implement MSC3389 tests Implement MSC3389: Relation redactions tests Aug 19, 2026
@reivilibre
reivilibre requested review from reivilibre and removed request for a team September 7, 2026 16:14

@reivilibre reivilibre left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

)

// The room version that enables MSC3389 ("Redaction changes for events with a relation").
const msc3389RoomVersion = "org.matrix.msc3389.10"

@reivilibre reivilibre Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't actually mentioned in the MSC, but I guess it's OK for the time being.

@reivilibre
reivilibre merged commit 7b9ab15 into matrix-org:main Sep 8, 2026
9 of 10 checks passed
// Verify the original event is fully intact before redaction.
eventJsonBefore := alice.MustGetEvent(t, roomID, reactionID)
must.MatchGJSON(t, eventJsonBefore,
match.JSONKeyEqual("content.m.relates_to.rel_type", "m.annotation"),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These need the m.* escaped to prevent it being a path separator, e.g., match.JSONKeyEqual("content.m\\.relates_to.rel_type", "m.annotation").


Summarized by gpt-5.6 luna low:

A path separator is the dot GJSON uses to move through nested JSON objects.

For example:

content.m.relates_to.rel_type

means:

{
  "content": {
    "m": {
      "relates_to": {
        "rel_type": "..."
      }
    }
  }
}

But Matrix actually uses a literal key named m.relates_to:

{
  "content": {
    "m.relates_to": {
      "rel_type": "..."
    }
  }
}

So the dot must be escaped:

content.m\.relates_to.rel_type

That tells GJSON to treat m.relates_to as one key.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Being addressed by #932

@bxdxnn bxdxnn mentioned this pull request Oct 1, 2026
1 task done
@MadLittleMods MadLittleMods mentioned this pull request Oct 1, 2026
1 task done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants