ADR 0010: policy leaf module
Context
config parses environment variables into vocabularies: the OAuth scope
catalogue, the redirect-URI pattern grammar, the log format and the size
limits. When those types live in a higher layer (oauth, logging,
tools), every dependency between that layer and config runs both ways.
Decision
crate::policyholds pure, I/O-free vocabularies.- Nothing under
src/policy/imports fromcrate::. configimports no crate module other thanpolicy.transport::stdioimports nothing fromtools,oauthorlogging.tests/module_layering.rsenforces these rules textually; it skips comment lines and does not checksuper::paths.- Layering order: policy → config → client → transport → identity → file store → tools → output → exposure → ops.
Consequences
- Changing the scope list, the redirect grammar or the upload budget means
editing
policyonly. policy::limits,policy::log_formatandpolicy::redirectare public API;policy::scopesis crate-private.RedirectPolicycan be named outside the crate.- A new vocabulary that
configneeds from a higher layer moves intopolicyfirst. - The rmcp
allowed_hostsrestatement stays inconfig, because it describes an external crate’s behaviour.