Skip to content

Conversation

turt2live
Copy link
Member

@turt2live turt2live commented Jun 20, 2025

Requires #18238 Merged!

Real diff: 881d521...travis/flag-ps-events

Pull Request Checklist

  • Pull request is based on the develop branch
  • Pull request includes a changelog file. The entry should:
    • Be a short description of your change which makes sense to users. "Fixed a bug that prevented receiving messages from other servers." instead of "Moved X method from EventStore to EventWorkerStore.".
    • Use markdown where necessary, mostly for code blocks.
    • End with either a period (.) or an exclamation mark (!).
    • Start with a capital letter.
    • Feel free to credit yourself, by adding a sentence "Contributed by @github_username." or "Contributed by [Your Name]." to the end of the entry.
  • Code style is correct (run the linters)

@turt2live turt2live changed the title Travis/flag ps events Allow admins to see policy server-flagged events Jun 20, 2025
@github-actions github-actions bot deployed to PR Documentation Preview June 20, 2025 18:42 Active
@github-actions github-actions bot deployed to PR Documentation Preview June 20, 2025 18:46 Active
@turt2live turt2live marked this pull request as ready for review June 20, 2025 18:49
@turt2live turt2live requested a review from a team as a code owner June 20, 2025 18:49
@github-actions github-actions bot deployed to PR Documentation Preview June 20, 2025 19:04 Active
@github-actions github-actions bot deployed to PR Documentation Preview June 20, 2025 19:09 Active
@github-actions github-actions bot deployed to PR Documentation Preview June 20, 2025 19:14 Active
@github-actions github-actions bot deployed to PR Documentation Preview June 20, 2025 19:18 Active
@@ -0,0 +1,51 @@
# Client-Server API Extensions
Copy link
Contributor

Choose a reason for hiding this comment

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

Discussed in the #synapse-dev:matrix.org room

@MadLittleMods MadLittleMods requested a review from a team June 20, 2025 19:26
Copy link
Member

@anoadragon453 anoadragon453 left a comment

Choose a reason for hiding this comment

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

The term "spammy" doesn't feel like a real term to me... Can we just say "marked as spam"?

If you were looking for a short field name, policy_server_spam seems fine.

@turt2live turt2live force-pushed the travis/flag-ps-events branch from e343076 to 32d605f Compare July 14, 2025 23:14
@turt2live
Copy link
Member Author

sorry for the force push: I thought I set this PR up for a clean merge of develop->PR, but forgot all of the important steps.

@github-actions github-actions bot deployed to PR Documentation Preview July 14, 2025 23:15 Active
@turt2live
Copy link
Member Author

"spammy" comes from the detail that the policy server doesn't technically get final say on whether the event is spam or not, despite that being the current implementation. It's also used in other places throughout the codebase, especially around the existing spam checker interfaces.

I'd prefer to keep it as an invented word, but can change it if needed.

@turt2live turt2live requested a review from anoadragon453 July 14, 2025 23:24
@github-actions github-actions bot deployed to PR Documentation Preview July 14, 2025 23:25 Active
Copy link
Member

@anoadragon453 anoadragon453 left a comment

Choose a reason for hiding this comment

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

Some more iteration.

Could you also add some unit tests for this new field please?

@github-actions github-actions bot deployed to PR Documentation Preview July 24, 2025 20:39 Active
@github-actions github-actions bot deployed to PR Documentation Preview July 24, 2025 21:05 Active
@github-actions github-actions bot deployed to PR Documentation Preview July 24, 2025 21:22 Active
@github-actions github-actions bot deployed to PR Documentation Preview July 24, 2025 21:35 Active
Copy link
Member

@anoadragon453 anoadragon453 left a comment

Choose a reason for hiding this comment

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

This now looks good to me. Thanks for your patience!

if client_config.return_soft_failed_events:
# The user has requested that all events be included, so do that.
# We copy the list for mutation safety.
events = events_before_filtering.copy()
Copy link
Member

Choose a reason for hiding this comment

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

There's a slight performance penalty to iterating over all events and then doing it again here, rather than moving the default case into the else blocks.

But since is_soft_failed() is very cheap, I think it's find to aid readability.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm also not personally concerned with a slight performance hit from asking for more stuff :p

Copy link
Member

Choose a reason for hiding this comment

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

I meant more that the:

[e for e in events if not e.internal_metadata.is_soft_failed()]

isn't necessary in those cases.

@anoadragon453 anoadragon453 merged commit 5b8b45a into develop Jul 29, 2025
46 checks passed
@anoadragon453 anoadragon453 deleted the travis/flag-ps-events branch July 29, 2025 18:57
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.

3 participants