Files
mattermost/server/channels
Nick Misasi 62056e5a7c MM-70071: Automatically select hosted push notification server based on license (#37802)
* MM-70071: Automatically select hosted push notification server based on license

Co-authored-by: nick.misasi <nick.misasi@mattermost.com>

* test: fix mock-store fallout from push endpoint license listener

Co-authored-by: nick.misasi <nick.misasi@mattermost.com>

* MM-70071: address review feedback on push endpoint sync

Co-authored-by: nick.misasi <nick.misasi@mattermost.com>

* ci: retrigger enterprise tests against updated companion branch

Co-authored-by: nick.misasi <nick.misasi@mattermost.com>

* ci: retrigger flaky artifact build

Co-authored-by: nick.misasi <nick.misasi@mattermost.com>

* MM-70071: revert any hosted push endpoint to test on entitlement loss

Co-authored-by: nick.misasi <nick.misasi@mattermost.com>

* MM-70071: add nil-safe License.HasMHPNS entitlement check

Co-authored-by: nick.misasi <nick.misasi@mattermost.com>

* MM-70071: drop preview-tree docs for auto-selected push server

Monorepo MDX is still unpublished; this belongs in mattermost/docs.

Co-authored-by: Cursor <cursoragent@cursor.com>

* MM-70071: stub InitEmailBatching on guest-invite email mocks

License teardown now SaveConfigs the push endpoint, which fires the existing email-batching config listener.

Co-authored-by: Cursor <cursoragent@cursor.com>

* MM-70071: don't re-init email batching on push-server license sync

License teardown SaveConfigs the push endpoint, which fired the existing
email-batching listener and panicked tests that mock EmailService.
Re-init batching only when EnableEmailBatching changes, and stub the
remaining invite mock used during helper cleanup.

Co-authored-by: Nick Misasi <nick13misasi@gmail.com>

* MM-70071: re-init email batching when the interval setting changes

Keep EmailBatchingInterval live at runtime; only ignore unrelated
config writes such as the push-server license sync.

Co-authored-by: Nick Misasi <nick13misasi@gmail.com>

* MM-70071: isolate mock tests from push endpoint sync

Use custom push endpoints in shared mock fixtures so unrelated tests do not need config-listener expectations.

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Mattermost Build <build@mattermost.com>
2026-08-20 16:11:21 +00:00
..
2026-04-01 13:03:36 +00:00

Server Channels Review Guidelines

When reviewing or writing code in the server channels package, focus on SQL query performance and API layer efficiency.

SQL Store Layer

  • Run EXPLAIN ANALYZE on new or modified queries against a large dataset before merging. A query that performs well on a 12M-post database may degrade significantly at 100M+ posts.
  • Watch for sequential scans on large tables. Ensure appropriate indexes exist for new query patterns.
  • When adding new queries to the store, check whether an existing query already fetches the needed data. Avoid duplicate round trips to the database.

API Layer

  • Minimize database round trips. If an endpoint calls a Get followed by a Delete on the same row, consider using DELETE ... RETURNING to combine them into a single query.
  • Don't add queries that are unnecessary for the operation. The most efficient work is the work you don't do.
  • When adding new API endpoints, add them to the load test tooling so performance can be validated under realistic concurrency.

Permissions and Security

  • Verify that new endpoints enforce appropriate permissions. Rely on the dedicated security review for thorough coverage, but flag anything obviously missing (e.g., an endpoint that skips permission checks entirely).