Skip to content

test(gateway): isolate Matrix and Telegram fixture globals - #40697

Closed
c0nSpIc0uS7uRk3r wants to merge 1 commit into
NousResearch:mainfrom
c0nSpIc0uS7uRk3r:cabo/gateway-test-fixture-cleanup
Closed

test(gateway): isolate Matrix and Telegram fixture globals#40697
c0nSpIc0uS7uRk3r wants to merge 1 commit into
NousResearch:mainfrom
c0nSpIc0uS7uRk3r:cabo/gateway-test-fixture-cleanup

Conversation

@c0nSpIc0uS7uRk3r

Copy link
Copy Markdown

Summary

This opens a separate gateway test-fixture cleanup workstream for broader Matrix/Telegram gateway failures that reproduced on origin/main independently of HONCHO-KIMI26 PR #40668.

Changes:

  • Rebind Matrix adapter cached mautrix.types globals when lightweight test/runtime modules are installed late, preventing broad-suite Matrix module-global drift.
  • Normalize Telegram test mocks so ParseMode.MARKDOWN_V2 remains string-compatible while preserving enum-style repr expectations.
  • Fix the partial Telegram guest mention fixture to include Platform.TELEGRAM, matching normal adapter initialization.

Touched files:

  • gateway/platforms/matrix.py
  • tests/gateway/conftest.py
  • tests/gateway/test_telegram_format.py

Background

Baseline broad gateway failures were reproduced on current origin/main without PR #40668, so this cleanup is intentionally separate from the HONCHO-KIMI26 webhook/status hardening branch.

Prior origin/main baseline:

26 failed, 6306 passed, 8 skipped, 230 warnings

Verification

Final full gateway verification artifact:

/data/jarvis/artifacts/gateway-test-fixture-cleanup-20260606T172005Z/full-gateway-final-cleaned.out

Final result:

6332 passed, 8 skipped, 230 warnings in 249.85s

Additional hygiene:

git diff --check: clean

Safety

No production memory, jarvis-memory, ChromaDB, or live/social gateway connections were touched. Verification used isolated artifact HERMES_HOME paths.

PR #40668 boundary

PR #40668 remains separate and draft/open. This PR should not merge or mark PR #40668 ready.

@alt-glitch alt-glitch added type/test Test coverage or test infrastructure P3 Low — cosmetic, nice to have comp/gateway Gateway runner, session dispatch, delivery platform/matrix Matrix adapter (E2EE) platform/telegram Telegram bot adapter labels Jun 6, 2026
@c0nSpIc0uS7uRk3r
c0nSpIc0uS7uRk3r marked this pull request as ready for review June 6, 2026 18:59
@c0nSpIc0uS7uRk3r
c0nSpIc0uS7uRk3r marked this pull request as draft June 6, 2026 19:36

@teknium1 teknium1 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 for isolating a difficult gateway-test-ordering issue. The patch needs re-scoping before it can apply to current main.

Problems

  • gateway/platforms/matrix.py was moved to plugins/platforms/matrix/adapter.py by 560010547; the PR's Matrix runtime changes target a removed path. Current rebinding is handled in plugins/platforms/matrix/adapter.py:665-721 through ensure_and_bind().
  • The added adapter.platform = Platform.TELEGRAM does not affect guest-mode gating: TelegramAdapter._telegram_guest_mode() reads config.extra/TELEGRAM_GUEST_MODE at plugins/platforms/telegram/adapter.py:6713-6720.

Suggested changes

  • Revalidate the suite-order failure using the active plugins.platforms.matrix.adapter and plugins.platforms.telegram.adapter imports, then port only the necessary test isolation.
  • Drop the guest-fixture platform assignment unless a current behavior depending on it is demonstrated by a regression test.

Automated hermes-sweeper review.

@@ -709,6 +758,7 @@ async def _verify_device_keys_on_server(self, client: Any, olm: Any) -> bool:

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.

Current main moved this adapter to plugins/platforms/matrix/adapter.py in 560010547; this call targets a removed production path. Please revalidate and port any needed binding behavior to the active plugin adapter.

@teknium1 teknium1 added sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform labels Jul 14, 2026
@teknium1

Copy link
Copy Markdown
Contributor

Thanks @strickvl — closing as resolved on main: the telegram half is superseded by @mehmetkr-31's #68873 (merged via PR #74576) — a PTB-faithful str-enum _FakeEnumMember in the shared gateway conftest, bound to both constants access paths; the matrix half patches gateway/platforms/matrix.py which has since moved to plugins/platforms/matrix/, and the single-process ordering failure mode is gone under the per-file-subprocess runner. Both target test files verified 141-pass hermetic on current main.

@teknium1 teknium1 closed this Jul 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery P3 Low — cosmetic, nice to have platform/matrix Matrix adapter (E2EE) platform/telegram Telegram bot adapter sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages type/test Test coverage or test infrastructure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants