# `mgf-livepush` — scope policy

> `mgf-livepush`'s **scope policy** (family **SP**) — what belongs in this realtime
> push pipeline. A proposed addition is in scope only if it passes the §3 gate.

## §1 In scope (SP-01)

Realtime server→client push for mgf-common consumers:

- **SSE streaming** (server-sent events framing + heartbeat + clean disconnect)
- a pluggable pub/sub **broker seam** (project-owned `Broker`/`Subscription`
  Protocols; Redis production adapter + a mock)
- per-key **connection-slot caps** (backpressure / DoS bound, fail-open)
- a thin **FastAPI endpoint adapter** (`sse_streaming_response`)

The boundary: **safe, bounded, transport-framed fan-out from a broker to SSE
clients.** Consumers own auth, the message bus, and what they publish.

## §2 Out of scope (SP-02) — with reasons

| Not here | Why | Where instead |
|---|---|---|
| The message bus itself | infra the consumer runs | Redis / NATS / Kafka |
| WebSocket transport | SSE-only by charter (simpler, one-way) | `websockets` / Starlette WS |
| Client-side JS / SDK | browser concern | `EventSource` (native) |
| Authentication / authz | consumer's request layer | `mgf-auth` / the app |
| Message persistence / replay / event-sourcing | a durable-log concern | Redis Streams / Kafka |
| Cross-process slot coordination beyond the cap key | infra-specific | the consumer's deployment |

## §3 Scope-creep gate (SP-03)

A PR adding a module/helper MUST answer: (1) is it SSE framing, the broker seam, or
slot caps (else out)? (2) does it keep the core free of the FastAPI/Redis SDKs (the
import-linter contracts)? (3) is there a consumer demand signal? Any "no/unclear" blocks it.

## §4 Adjacent scope (SP-04)

Adjacent (not yet in): a Redis-Streams broker adapter, a NATS adapter, a WebSocket
transport, last-event-id resume. Promote adjacent → in only on a documented consumer
demand signal (a consumer forking, or ≥2 consumers asking), never speculatively.

## §5 Alternatives for out-of-scope needs (SP-05)

Bus → Redis/NATS/Kafka; WebSocket → `websockets`/Starlette; auth → `mgf-auth`;
persistence/replay → Redis Streams/Kafka; client → native `EventSource`.

## §6 Revisiting scope (SP-06)

Revisited at every **MAJOR** boundary; a major bump re-justifies the surface against
§1/§2 and re-affirms the SSE-only / broker-behind-a-seam / bounded-by-slot-caps invariants.
