# `mgf-django` — scope policy

> `mgf-django`'s **scope policy** (family **SP**) — what belongs in this Django
> integration adapter. A proposed addition is in scope only if it passes the §3 gate.

## §1 In scope (SP-01)

Thin Django ↔ mgf-common glue:

- an `AppConfig` (`MgfCommonConfig`) that runs `mgf.common.bootstrap()` once
- request-id + context middleware (sharing the mgf-common contextvar)
- a `JsonFormatter` for Django's `LOGGING` config
- a `DjangoSettingsBridge` (read-only `BaseAppSettings` view over `django.conf.settings`)
- a token-bucket throttle middleware

The boundary: **wire mgf-common's bootstrap / context / logging / config into a
Django app with safe defaults.** Consumers own their views, models, and settings.

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

| Not here | Why | Where instead |
|---|---|---|
| Views / URL routing / models | the consumer's app | Django itself |
| A REST framework / serializers | not glue | `djangorestframework` |
| Authentication / sessions | consumer/Django concern | `django.contrib.auth` / `mgf-auth` |
| Async (ASGI) middleware | sync-mode adapter by charter | (future, on demand) |
| A distributed/Redis-backed throttle | the bundled cap is in-process | a Redis rate-limiter |
| Settings *storage* / a config UI | consumer owns settings.py | Django settings |

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

A PR adding a module/helper MUST answer: (1) is it mgf-common↔Django glue (else out)?
(2) does it keep the package free of non-Django/non-mgf-common SDKs (the import-linter
contract)? (3) consumer demand signal? Any "no/unclear" blocks it.

## §4 Adjacent scope (SP-04)

Adjacent (not yet in): async/ASGI middleware variants, a DRF throttle backend, a
management command. 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)

Views/models → Django; REST → `djangorestframework`; auth → `django.contrib.auth`
/ `mgf-auth`; distributed throttle → a Redis rate-limiter; async → (future).

## §6 Revisiting scope (SP-06)

Revisited at every **MAJOR** boundary; a major bump re-justifies the surface against
§1/§2 and re-affirms the glue-not-framework / sync-mode invariants.


## Boundary — verified ownership (generated)

> Generated from the fleet-wide import matrix — the **verified** ownership boundary (who is the SOLE importer of each third-party dep across the whole federation). Regenerate with `fleet_ownership_audit.py --inject`; CI-gated against code drift by `--check`. **Do not hand-edit the block below.**

<!-- BEGIN BOUNDARY (generated by mgf-standard/scripts/fleet_ownership_audit.py --inject; do not hand-edit) -->
- **Owns (sole third-party importer, fleet-verified):** `django`
- **Federation deps (imports):** `mgf.common`, `mgf.django`
<!-- END BOUNDARY -->
