K6a: gamecult.persona_state.v0 gains the optional embodiment field (map 16.6, I16.3)
Her senses and actuators, each {id, status, label, summary, lacks, builtOn,
updatedAt, extensions}, closed like the rest of the schema. Writers: Self and
Life puts; her turn's commit never writes it. huginn-mind's schema test passes
with and without the field, and an unknown key inside it is refused at the door.
The gamecult-ops standard text and the VoidBot strict reader are K7's.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
8e5639f452
commit
0bec1d4f3f
2 changed files with 93 additions and 0 deletions
|
|
@ -279,6 +279,37 @@ mod tests {
|
|||
}
|
||||
}
|
||||
|
||||
/// Map 16.6: `embodiment` is optional. A document passes with it and without it, and the field is as closed as the
|
||||
/// rest of the schema: an unknown key inside it is refused at the door.
|
||||
#[test]
|
||||
fn embodiment_is_optional_and_closed() {
|
||||
let schema = schema_file();
|
||||
let validator = jsonschema::draft7::new(&schema).unwrap();
|
||||
let sense = json!({
|
||||
"id": "sense-spectrogram", "status": "active", "label": "spectrogram hearing",
|
||||
"summary": "She hears by rendering a sound as a spectrogram and looking at it.",
|
||||
"lacks": "not a human ear", "builtOn": T1, "updatedAt": T1
|
||||
});
|
||||
let mut with = persona(INSTANCE, T1);
|
||||
with["embodiment"] = json!({ "senses": [sense.clone()], "actuators": [] });
|
||||
assert!(validator.is_valid(&persona(INSTANCE, T1)) && validator.is_valid(&with));
|
||||
let mut empty = persona(INSTANCE, T1);
|
||||
empty["embodiment"] = json!({});
|
||||
assert!(validator.is_valid(&empty), "both lists are optional");
|
||||
|
||||
let store = MemoryStore::new();
|
||||
let mut mind = seeded_over(&store);
|
||||
let mut stray = with.clone();
|
||||
stray["embodiment"]["senses"][0]["ears"] = json!("human");
|
||||
assert_eq!(refused(put(&mut mind, stray, None)), invalid("/embodiment/senses/0/*", "additionalProperties"));
|
||||
let mut stray_list = with.clone();
|
||||
stray_list["embodiment"]["smell"] = json!([]);
|
||||
assert_eq!(refused(put(&mut mind, stray_list, None)), invalid("/embodiment/*", "additionalProperties"));
|
||||
let mut unlabelled = with;
|
||||
unlabelled["embodiment"]["senses"][0].as_object_mut().unwrap().remove("label");
|
||||
assert_eq!(refused(put(&mut mind, unlabelled, None)), invalid("/embodiment/senses/0/label", "required"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn declared_names_are_every_property_name_at_any_depth() {
|
||||
let schema = json!({
|
||||
|
|
|
|||
|
|
@ -56,6 +56,9 @@
|
|||
"affect": {
|
||||
"$ref": "#/definitions/personaAffect"
|
||||
},
|
||||
"embodiment": {
|
||||
"$ref": "#/definitions/embodiment"
|
||||
},
|
||||
"updatedAt": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
|
|
@ -1019,6 +1022,65 @@
|
|||
"socialBiases",
|
||||
"doctrineStances"
|
||||
]
|
||||
},
|
||||
"embodiment": {
|
||||
"type": "object",
|
||||
"description": "What she is: her senses and actuators, each one she has, as she has it now. Written by Self and Life puts, never by her turn's commit: it is a fact about what exists, not a feeling. An absence records nothing about her.",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"senses": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/embodimentEntry"
|
||||
}
|
||||
},
|
||||
"actuators": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/embodimentEntry"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"embodimentEntry": {
|
||||
"type": "object",
|
||||
"description": "One sense or actuator. summary: how it works and what it is like, in close third person. lacks: what it is not, in her terms. builtOn: when she made it.",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"status": {
|
||||
"$ref": "#/definitions/thoughtStatus"
|
||||
},
|
||||
"label": {
|
||||
"type": "string"
|
||||
},
|
||||
"summary": {
|
||||
"type": "string"
|
||||
},
|
||||
"lacks": {
|
||||
"type": "string"
|
||||
},
|
||||
"builtOn": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
},
|
||||
"updatedAt": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
},
|
||||
"extensions": {
|
||||
"$ref": "#/definitions/extensions"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"id",
|
||||
"status",
|
||||
"label",
|
||||
"summary",
|
||||
"updatedAt"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue