error missing-policy
What it means#
External principals (User, Anonymous) may call an rpc only when something grants it explicitly: an allow rule of the
service's policy, @allow(...) or @public (§13.4). @internal says the method is deliberately closed to them, and calls
from the code of the program's roles are allowed implicitly (the call graph "role → method", §13.4). An rpc that has none of
these and that no role calls (the compiler follows the handlers, actor messages, main, provides, sagas and pipelines of every
role; if cluster.self.hasRole(…) does not prune) can be reached by nobody, which is almost certainly a mistake. Code that no
role reaches (dead functions) does not count as a caller; in oxl test builds the tests do.
The check runs only when the rest of the program compiles without errors.
Example#
service Orders {
rpc purge() -> i32 // <- missing-policy
}
impl Orders {
rpc purge() { 0 }
}missing-policy
How to fix#
service Orders {
@public rpc purge() -> i32 // or: @allow(role: Admin), @internal, an `allow purge if ...` rule
}
impl Orders {
rpc purge() { 0 }
}