# RFC-0018: Typing and Toolchain Currency - **Status:** Proposed; amends the RFC-0004 signatures of `Protector.seal`, `open`, `inspect`, `rewrap`, and `open_range`, and the enumeration base classes used throughout the package. - **Owner:** API and release leads. - **Last updated:** 2026-11-29 ## Context The pinned development toolchain had fallen two years behind. Moving to the current releases (pytest 9, mypy 2, ruff 0.17, Hypothesis 6.170, coverage 7.17, pyca/cryptography 50) surfaced two contract defects that older tools hid: 1. **Bytes-like inputs were accepted but not declared.** `seal`, `open`, `inspect`, `rewrap`, and `open_range` have always accepted `bytearray` and `memoryview` at run time and tested that they do, but their annotations said `bytes`. mypy 2 no longer treats `bytearray` and `memoryview` as `bytes`, so typed callers passing a buffer got errors for valid code. 2. **Enumerations rendered their class name, not their value.** Public enumerations such as `ErrorCode` were `(str, Enum)` classes, so `str()`, `format()`, and f-strings of a member produced `ErrorCode.NAME` (verified on Python 3.12 and 3.13) even though the member compares equal to its value. Log lines and messages built from them carried the wrong text. Python 3.15.0 was released on 2026-10-09 and was not in the test matrix. ## Binding decision - **Signatures.** The listed methods declare what they accept: `plaintext: bytes | bytearray | memoryview`, `envelope: Envelope | bytes | bytearray | memoryview`, and `source: Envelope | bytes | bytearray | memoryview | BinaryIO`. Run-time behaviour is unchanged. `tests/contract/test_root_api.py` pins the new signatures. - **Enumerations.** Every public and internal string enumeration is an `enum.StrEnum`. `str()`, `format()`, and f-strings of a member are its value on every supported Python; comparison with and hashing as the value string are unchanged, so serialized forms do not change. - **Supported Pythons.** 3.11 through 3.15. The quality gate tests every one; the platform matrix tests the oldest and newest on Linux, macOS, and Windows. - **Dependency floor.** `cryptography>=47.0.0` stays, and a dedicated job tests exactly 47.0.0 so the floor is a tested promise. Post-quantum recipients (RFC-0017) need a backend with ML-KEM and are skipped there. - **Tooling pins.** `requirements-dev.txt`, `requirements-release.txt`, and the pre-commit configuration pin the current releases; Dependabot keeps proposing updates weekly. ## Compatibility Source compatible for every caller: the signatures only widen, and enum members compare equal to the same strings. Code that parsed the `ErrorCode.NAME` rendering of a member now receives the value. ## Test and validation requirements The full suite, strict mypy, ruff, and Bandit pass with the new pins, and the oldest-dependency job runs the suite against cryptography 47.0.0.