Every artifact crossing the Rust-R bridge carries a header that names a
schema (e.g., formula, artifact, audit) and the version of that
schema (v0, v1, ...). mm_json_negotiate() validates a header
against the closed set of (schema_name, schema_version) pairs the
current wrapper build understands, and raises a typed
mm_schema_error on mismatch.
Details
This is the fast-fail primitive: any code path that consumes a Rust
artifact should call mm_json_negotiate() before parsing the body, so
a version skew between the Rust crate and the R wrapper produces a
single clean error rather than a confusing field-by-field decode failure.
Errors
Any of the following raise an mm_schema_error (also inheriting from
mm_condition and error):
headeris not a list, or is missingschema_name/schema_version, or those fields are not length-1 character.schema_nameis not in the wrapper's known set (seemm_json_known_schemas()).schema_nameis known butschema_versiondoes not match what the wrapper expects.
The condition object carries the original header in its input field.
(The field is not called header because rlang reserves that name on
conditions for cnd_header() formatting.)
See also
mm_json_known_schemas() for the closed set,
mm_formula_manifest() for the broader capability record.