# OIP-0004 draft folder

The proposal and, under `patches/`, the exact edits acceptance would make. Nothing here changes the protocol until
the editors accept the proposal and its patches are applied in the same change. The patches are made against the
current tree and apply to it without any other draft; OIP-0008 (signature envelope) is accepted first (see the
proposal, "Dependency and acceptance order").

| File | What it changes on acceptance |
|---|---|
| [`OIP-0004.md`](OIP-0004.md) | the proposal |
| `patches/spec.patch` | §4.2: row FederationBinding, AuthorityLease, FederationEvent names `federation-binding`, `authority-lease`, `federation-event`; §5.7: paragraph "Bindings, leases and partitions" and requirements FED-1 to FED-10 (`OBS-FED-0001` to `OBS-FED-0005`); §9: row G-FED-1 removed |
| `patches/registers.patch` | `registers/functions.yaml`: `federate` gains the three objects and becomes CONTRACTED, gap G-FED-1 removed; the two repository tests that named G-FED-1 or `federation-binding` as an open gap (`tests/test_requirements.py`, `tests/test_validate.py`) no longer do |
| `patches/schemas-fixtures.patch` | schemas `federation-binding`, `authority-lease`, `federation-event` (each with a copy of the OIP-0008 envelope definition); seven positive and twenty-six negative fixtures; the federation scenario (binding, three leases, join, partition and rejoin events, the correction notice of the candidate) in the OBSP-SITE and OBSP-GRID example sets; `tools/gen_federation_examples.py`, which writes all of them |
| `patches/cases-invariants.patch` | `sdk/python/src/obsp/federation.py` (nine invariants) and their registration in `conformance.py`; 35 unit tests in `sdk/python/tests/test_federation.py`; cases CT-GRID-060 to CT-GRID-067, CT-SITE-060, CT-SITE-061; `registers/requirements.yaml` regenerated (FED-1 to FED-10 covered directly) |
| `patches/formal.patch` | `formal/federation/` (TLA+ model, six TLC configurations, `check.sh`, README with the TLC results); `formal` added to the first `.PHONY` line (the live `make formal`, `formal/run.sh`, runs `formal/federation/check.sh` when the folder is present; `formal/` is already on the export list); `formal/**/*.sh` and `formal/**` in `REUSE.toml`; `tests/test_formal.py` |

Apply the patches in the order of the table. Acceptance removes `patches/`.

With these patches applied, every patch of OIP-0006 to OIP-0009 still applies. The `spec.patch` of OIP-0001, OIP-0002,
OIP-0003 and OIP-0005, OIP-0002 `registers.patch` and OIP-0003 `cases-invariants.patch` do not (§9 gap rows, the §4.2
row, a test both proposals edit and the regenerated requirements index); whichever proposal is accepted second is
rebased (see the proposal).

Check that every patch still applies to the current tree: `python3 -m unittest tests.test_validate -k draft_patches`.
Regenerate the generated documents with `python3 tools/gen_federation_examples.py` (`--check` reports stale files).
Run the model checks with `make formal TLA2TOOLS=<path to tla2tools.jar>`.
