AdmissionTestApi

@RequiresOptIn(message = "Builds a request no joiner proved. For tests only; no stability promise.", level = RequiresOptIn.Level.ERROR)
annotation class AdmissionTestApi

Marks test-only ways to build what only a room builds in production. For tests; no stability promise.

In production an AdmissionRequest exists only after a joiner has proved to the room that it holds its key. admissionRequest skips that proof, so a request built with it says nothing about who holds the key. That is what a unit test of your own AdmissionPolicy wants, and what production code must never do: a policy fed a hand-built request decides on a key nobody proved.

Opt in where you test, not module-wide in production code:

@OptIn(AdmissionTestApi::class)
class MyPolicyTest { … }

An annotated declaration may change shape or disappear in any release, patch releases included. The opt-in level is ERROR, so using one without opting in does not compile.