pub struct OnlyRule {
pub from: String,
pub to: Vec<String>,
pub raw: String,
}Expand description
⟨0.29⟩ One only <A> -> <B> [<C> …] PERMISSION rule (AS-EFF-011): a function in scope A may reach
A itself and the listed scopes, and NOTHING else.
forbid FAILS OPEN; only FAILS SAFE, and that is the whole reason the form exists. A dependency
you forgot to prohibit is silently permitted, so “this package is a leaf” can only be spelled by
enumerating what it must not reach — a list that does not cover a package added later, and nothing says
so. That is the allowlist hazard this project refuses everywhere in the analysis, living in the POLICY
LANGUAGE instead. Under only, a dependency you forgot to permit is a loud violation.
Found by pointing candor’s own architecture gate at candor: the natural
forbid io.poly.candor.model -> io.poly.candor SELF-FIRES at 58 violations, because a scope matches a
contiguous run of segments and model sits under the very prefix it is trying to protect itself from.
THE WALK STOPS AT A PERMITTED SCOPE, and that is a semantic decision rather than an optimisation: a
permitted callee’s own dependencies are governed by the rules about IT, not by this one. Descending
past it would make only require the transitive closure of everything you permit — which is the
enumeration-that-rots this form exists to replace, one level down.
Fields§
§from: StringThe scope being constrained. It may always reach ITSELF: an explicit A -> A would be noise, and
without the implicit permission the form is unusable for exactly the case it exists for.
to: Vec<String>The scopes from may reach. At least one — only A -> with nothing after the arrow is DROPPED as
malformed rather than read as “A may reach nothing at all”, which is a different rule (and one a
reader is far more likely to have typed by accident than to have meant).
raw: String