Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
getsentry avatar

Hybrid Cloud Test Gen

  • 59 installs
  • 44.5k repo stars
  • Updated August 5, 2026
  • getsentry/sentry

hybrid-cloud-test-gen is an agent skill that generates Sentry hybrid cloud tests for RPC, API gateway, outbox, and endpoint silo scenarios.

About

The hybrid-cloud-test-gen skill generates tests for Sentry hybrid cloud architecture across RPC services, API gateway proxying, outbox patterns, and endpoint silo decorators. Critical constraints require factory methods like self.create_user instead of Model.objects.create, never wrapping factories in assume_test_silo_mode, pytest-style assertions only, adding tests to existing mirror-path files, and reserving TransactionTestCase for threading or concurrency. Step one routes requests to RPC service, API gateway, outbox pattern, or endpoint silo categories based on signal keywords. Context gathering reads source modules for silo decorators, locates tests via src-to-tests mirror conventions, and reviews established patterns before generation. RPC tests use all_silo_test with serialization round-trips via dispatch_to_local_service and outbox_runner for cross-silo effects. API gateway tests use control_silo_test with ApiGatewayTestCase for proxy pass-through and streaming responses. Outbox tests verify creation with outbox_context, draining with outbox_runner, and idempotency on double drain. Endpoint tests map cell_silo_endpoint and control_silo_endpoint decorators to matching test d.

  • Routes requests to RPC, API gateway, outbox, or endpoint test categories.
  • Enforces factory methods and pytest assertions with silo decorator mapping.
  • Uses mirror-path convention from src modules to existing test files.
  • Covers outbox_runner, outbox_context, and assume_test_silo_mode_of patterns.
  • Provides decorator and base class quick reference tables per test type.

Hybrid Cloud Test Gen by the numbers

  • 59 all-time installs (skills.sh)
  • Ranked #1,165 of 2,153 Testing & QA skills by installs in the Skillselion catalog
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
At a glance

hybrid-cloud-test-gen capabilities & compatibility

Capabilities
rpc service test generation with serialization r · api gateway proxy and streaming response tests · outbox creation, drain, and idempotency tests · endpoint silo decorator and permission tests · mirror path test file placement and validation c
Works with
postgres
Use cases
testing · api development
From the docs

What hybrid-cloud-test-gen says it does

This skill generates tests for Sentry's hybrid cloud architecture.
SKILL.md
npx skills add https://github.com/getsentry/sentry --skill hybrid-cloud-test-gen

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs59
repo stars44.5k
Last updatedAugust 5, 2026
Repositorygetsentry/sentry

How do I generate correct hybrid cloud tests for Sentry RPC, outbox, gateway, or silo endpoints?

Generate hybrid cloud tests for Sentry covering RPC services, API gateway proxying, outbox patterns, and endpoint silo decorators.

Who is it for?

Sentry contributors writing RPC, outbox, API gateway, or endpoint silo tests in the hybrid cloud codebase.

Skip if: Skip for non-Sentry projects or tests outside hybrid cloud RPC, gateway, and outbox architecture.

When should I use this skill?

User asks to generate HC test, write RPC test, outbox test, API gateway test, or silo endpoint test for Sentry.

What you get

Category-appropriate test code with correct silo decorators, factory usage, and cross-silo assertion patterns.

Files

SKILL.mdMarkdownGitHub ↗

Hybrid Cloud Test Generation

This skill generates tests for Sentry's hybrid cloud architecture. It covers RPC services, API gateway proxying, outbox patterns, and endpoint silo decorators.

Critical Constraints

ALWAYS use factory methods (self.create_user(), self.create_organization()) — never Model.objects.create().
NEVER wrap factory method calls in assume_test_silo_mode or assume_test_silo_mode_of. Factories are silo-aware and handle silo mode internally. Only use silo mode context managers for direct ORM queries (Model.objects.get/filter/count/exists/delete).
ALWAYS use pytest-style assertions (assert x == y) — never self.assertEqual().
ALWAYS add tests to existing test files rather than creating new ones, unless no file exists for that module.
For cross-silo ORM access: use assume_test_silo_mode_of(Model) when accessing a single model (auto-detects silo). Use assume_test_silo_mode(SiloMode.X) when the block covers multiple models or non-model operations.
Use TestCase for most tests, including those using outbox_runner(). Only use TransactionTestCase when tests need real committed transactions (threading, concurrency, multi-process scenarios).
NEVER use from __future__ import annotations in test files that deal with RPC models.

Step 1: Identify Test Category

Determine which category of HC test to generate based on the user's request:

SignalCategoryGo To
RPC service, service method, serialization round-trip, dispatchRPC Service TestsStep 3
API gateway, proxy, middleware, forwardingAPI Gateway TestsStep 4
Outbox, cross-silo message, ControlOutbox, CellOutbox, outbox drainOutbox Pattern TestsStep 5
API endpoint with silo decorator, endpoint test, permission checkEndpoint Silo TestsStep 6

If the signal is ambiguous, ask the user to clarify which category.

Step 2: Gather Context

Before generating any test:

1. Read the source module being tested. Determine its silo mode by checking for @cell_silo_endpoint, @control_silo_endpoint, local_mode = SiloMode.X, or @cell_silo_model/@control_silo_model decorators.

2. Find the existing test file using the mirror path convention:

  • src/sentry/foo/bar.pytests/sentry/foo/test_bar.py
  • src/sentry/foo/services/bar/service.pytests/sentry/foo/services/test_bar.py
  • src/sentry/foo/services/bar/impl.pytests/sentry/foo/services/test_bar.py

3. Read the existing test file to understand what's already tested, what base classes are used, and what patterns are established.

4. Read source method signatures to understand parameters, return types, and which RPC models are involved.

Step 3: Generate RPC Service Tests

Load references/rpc-service-tests.md for complete templates and patterns.

RPC service tests must cover:

  • Silo compatibility: @all_silo_test ensures the service works across all silo modes
  • Serialization round-trip: dispatch_to_local_service verifies args/return survive serialization
  • Field accuracy: Field-by-field comparison of RPC model against ORM object
  • Error handling: Not-found returns, disabled methods, remote exception wrapping
  • Cross-silo effects: outbox_runner() + assume_test_silo_mode for propagation checks

Quick Reference — Decorator & Base Class

ScenarioDecoratorBase Class
Standard RPC service@all_silo_testTestCase
RPC with named cells@all_silo_test(cells=create_test_cells("us"))TestCase
RPC with member mapping assertions@all_silo_testTestCase, HybridCloudTestMixin

Step 4: Generate API Gateway Tests

Load references/api-gateway-tests.md for complete templates and patterns.

API gateway tests verify that requests to control-silo endpoints are correctly proxied to the appropriate cell. They must cover:

  • Proxy pass-through: Requests forwarded with correct params, headers, body
  • Query parameter forwarding: Multi-value params preserved
  • Error proxying: Upstream errors forwarded correctly
  • Streaming responses: close_streaming_response() for reading proxied response body

Quick Reference — Decorator & Base Class

ScenarioDecoratorBase Class
Standard gateway test@control_silo_test(cells=[ApiGatewayTestCase.CELL], include_monolith_run=True)ApiGatewayTestCase

Step 5: Generate Outbox Pattern Tests

Load references/outbox-tests.md for complete templates and patterns.

Outbox tests verify that cross-silo messages are created, drained, and produce the expected side effects. They must cover:

  • Outbox creation: Verify correct outbox records with outbox_context(flush=False)
  • Outbox processing: outbox_runner() drains pending messages
  • Cross-silo side effects: assume_test_silo_mode_of(Model) to check replica/mapping state
  • Idempotency: Draining the same shard twice produces no duplicates

Quick Reference — Decorator & Base Class

ScenarioDecoratorBase Class
Control outbox test@control_silo_testTestCase
Cell outbox test@cell_silo_testTestCase
Outbox with threading/concurrency(none)TransactionTestCase

Step 6: Generate Endpoint Silo Tests

Load references/endpoint-silo-tests.md for complete templates and patterns.

Endpoint silo tests verify that API endpoints work correctly under their declared silo mode. They must cover:

  • Correct silo decorator: Match endpoint → test decorator
  • Cross-silo data setup: Create data using factory methods (no silo wrapper needed)
  • Permission checks: Verify 401/403 for unauthorized access
  • Response accuracy: Verify response body matches expected data

Quick Reference — Decorator Mapping

Endpoint DecoratorTest Decorator
@cell_silo_endpoint @cell_silo_test
@control_silo_endpoint@control_silo_test
@control_silo_endpoint (with proxy)@control_silo_test(cells=create_test_cells("us"))
No decorator (monolith-only)@no_silo_test

Step 7: Validate

Before presenting the generated test, verify against this checklist:

  • [ ] Correct silo decorator on test class
  • [ ] assume_test_silo_mode_of(Model) for single-model ORM access; assume_test_silo_mode(SiloMode.X) for multi-model/non-model ORM blocks
  • [ ] Factory methods (self.create_*) are NEVER wrapped in assume_test_silo_mode
  • [ ] Factory methods used — never Model.objects.create()
  • [ ] pytest-style assertions only (assert x == y)
  • [ ] Correct base class (TestCase for most tests; TransactionTestCase only for threading/concurrency)
  • [ ] Imports are correct and minimal
  • [ ] Test file at correct mirror path
  • [ ] Test methods have descriptive names (test_<action>_<scenario>)
  • [ ] Run command: pytest -svv --reuse-db tests/sentry/path/to/test_file.py

Key Imports Quick Reference

# Silo decorators
from sentry.testutils.silo import (
    all_silo_test,
    control_silo_test,
    cell_silo_test,
    no_silo_test,
    assume_test_silo_mode,
    assume_test_silo_mode_of,
    create_test_cells,
)

# Base classes
from sentry.testutils.cases import TestCase, TransactionTestCase, APITestCase

# Cross-silo utilities
from sentry.testutils.outbox import outbox_runner
from sentry.testutils.hybrid_cloud import HybridCloudTestMixin
from sentry.silo.base import SiloMode

# RPC testing
from sentry.hybridcloud.rpc.service import dispatch_to_local_service

# API gateway testing
from sentry.testutils.helpers.apigateway import ApiGatewayTestCase, verify_request_params

# Outbox models
from sentry.hybridcloud.models.outbox import ControlOutbox, CellOutbox, outbox_context
from sentry.hybridcloud.outbox.category import OutboxCategory, OutboxScope

Context Manager Quick Reference

# Use ONLY for direct ORM queries — never for factory calls
assume_test_silo_mode(SiloMode.CONTROL)     # Switch to control silo for ORM access
assume_test_silo_mode(SiloMode.CELL)        # Switch to cell silo for ORM access
assume_test_silo_mode_of(ModelClass)        # Switch to silo matching model's silo mode

outbox_runner()                             # Drain all pending outboxes on exit
outbox_context(flush=False)                 # Create outboxes without flushing
override_cells(cells)                       # Override active cell config
override_settings(SILO_MODE=SiloMode.X)     # Override Django settings
override_options({"key": value})            # Override Sentry options

Related skills

FAQ

What does hybrid-cloud-test-gen produce?

Generated test methods with correct silo decorators, factory usage, outbox utilities, and mirror-path file placement.

When should I use hybrid-cloud-test-gen?

When adding Sentry hybrid cloud tests for RPC services, outboxes, API gateway proxying, or silo endpoints.

Is hybrid-cloud-test-gen safe to install?

Review the Security Audits panel on this page before installing in production.

Testing & QAtestingbackend

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.