test(anatomy): R5.3 characterisation: Object.prototype member as a plain key, migration-map cascade debt, refusal reasons compared by stage
This commit is contained in:
1 parent
8010661de6
commit
9901106a62
3 files changed
+252
-6
No files matched your search
@@ -311,6 +311,49 @@ fn synthetic_seed(document_json: &str) -> String {
|
||||
/// Cases the TypeScript accepted and the port refuses, declared in RUST.md §11.12.
|
||||
const DECLARED_REFUSALS: [&str; 1] = ["declared-set-without-value-drops-key"];
|
||||
|
||||
/// Cases the TypeScript refused and the port accepts, declared in RUST.md §11.12 (checked by
|
||||
/// `an_inherited_member_name_is_a_plain_key_and_bypasses_nothing`).
|
||||
const DECLARED_ACCEPTS: [&str; 1] = ["declared-inherited-member-overwritten"];
|
||||
|
||||
fn has_set_without_value(changes_file: &Value) -> bool {
|
||||
changes_file["changes"]
|
||||
.as_array()
|
||||
.into_iter()
|
||||
.flatten()
|
||||
.filter_map(|change| change["ops"].as_array())
|
||||
.flatten()
|
||||
.any(|op| op["op"] == "set" && op.get("value").is_none())
|
||||
}
|
||||
|
||||
/// The refusal reason, compared by stage: a schema refusal (Zod's issue list) is a parse
|
||||
/// refusal of `changes.json`; an op or change refusal carries the same message, change id and
|
||||
/// op index included; a gate refusal names the same gate (the details are Zod's or serde's).
|
||||
/// Declared family: an inherited `Object.prototype` member read at the end of a field path
|
||||
/// made `structuredClone` throw at the op; the port writes a plain key the shape gate refuses.
|
||||
fn assert_same_refusal(name: &str, typescript: &str, rust: &str) {
|
||||
if typescript.ends_with("could not be cloned.") {
|
||||
assert!(
|
||||
rust.starts_with("curated document is not shape-valid"),
|
||||
"{name}: {rust}"
|
||||
);
|
||||
return;
|
||||
}
|
||||
if typescript.starts_with('[') {
|
||||
assert!(rust.starts_with("changes.json: "), "{name}: {rust}");
|
||||
return;
|
||||
}
|
||||
for gate in [
|
||||
"curated document is not shape-valid",
|
||||
"curated document has integrity errors",
|
||||
] {
|
||||
if typescript.starts_with(gate) {
|
||||
assert!(rust.starts_with(gate), "{name}: {rust}");
|
||||
return;
|
||||
}
|
||||
}
|
||||
assert_eq!(rust, typescript, "{name}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_synthetic_cases_match_the_typescript_or_are_refused_alike() {
|
||||
let frozen = oracle("curation-synthetic.json");
|
||||
@@ -323,11 +366,24 @@ fn the_synthetic_cases_match_the_typescript_or_are_refused_alike() {
|
||||
parse_changeset(&to_js_compact(&case["changes_file"]).unwrap());
|
||||
let outcome =
|
||||
changeset.and_then(|set| apply_changeset(baseline, &references, &set.changes));
|
||||
if DECLARED_ACCEPTS.contains(&name) {
|
||||
assert!(outcome.is_ok(), "{name}: declared as accepted by the port");
|
||||
continue;
|
||||
}
|
||||
if !case["ok"].as_bool().unwrap() || DECLARED_REFUSALS.contains(&name) {
|
||||
assert!(
|
||||
outcome.is_err(),
|
||||
"{name}: the TypeScript refused, the port accepted"
|
||||
);
|
||||
let error = outcome
|
||||
.err()
|
||||
.unwrap_or_else(|| panic!("{name}: the TypeScript refused, the port accepted"));
|
||||
if has_set_without_value(&case["changes_file"]) {
|
||||
// The declared family: refused at parse, whatever the TypeScript made of it.
|
||||
assert!(
|
||||
error.to_string().contains("missing field `value`"),
|
||||
"{name}"
|
||||
);
|
||||
} else {
|
||||
let expected = case["error"].as_str().unwrap();
|
||||
assert_same_refusal(name, expected, &error.to_string());
|
||||
}
|
||||
refused += 1;
|
||||
continue;
|
||||
}
|
||||
@@ -366,7 +422,7 @@ fn the_synthetic_cases_match_the_typescript_or_are_refused_alike() {
|
||||
"{name} seed"
|
||||
);
|
||||
}
|
||||
assert_eq!((compared, refused), (9, 49));
|
||||
assert_eq!((compared, refused), (11, 52));
|
||||
let reference_cases = frozen["reference_cases"].as_array().unwrap();
|
||||
assert_eq!(reference_cases.len(), 5);
|
||||
for case in reference_cases {
|
||||
@@ -412,3 +468,143 @@ fn a_reserved_touch_mark_key_in_an_authored_value_is_refused() {
|
||||
let error = parse_changeset(&text).unwrap_err();
|
||||
assert!(error.to_string().contains("reserved key"), "{error}");
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Declared and kept behaviours, characterised (owner 2026-10-23).
|
||||
|
||||
fn mini_apply(
|
||||
ops: Value,
|
||||
) -> Result<faunosteo_core::curation::draft::records::CurationResult, String> {
|
||||
let frozen = oracle("curation-synthetic.json");
|
||||
let references = parse_references(&to_js_compact(&frozen["references_file"]).unwrap()).unwrap();
|
||||
let file = json!({ "changes": [{
|
||||
"id": "CHG-001", "level": "B", "kind": "technical",
|
||||
"title": { "fr": "Essai", "en": "Test" }, "rationale": "Essai",
|
||||
"reference_ids": [], "ops": ops,
|
||||
}]});
|
||||
let changeset = parse_changeset(&to_js_compact(&file).unwrap()).map_err(|e| e.to_string())?;
|
||||
apply_changeset(&frozen["baseline"], &references, &changeset.changes).map_err(|e| e.to_string())
|
||||
}
|
||||
|
||||
const MOBILITY: &str = "finding:hip/hip-dysfunctions/mobility";
|
||||
|
||||
fn mobility(document: &Value) -> &Value {
|
||||
&document["finding_zones"][0]["categories"][0]["children"][0]
|
||||
}
|
||||
|
||||
/// An inherited `Object.prototype` member name (`constructor`, `toString`, `__proto__`…) in a
|
||||
/// field path is an ordinary key in the port: it is never resolved through a prototype, the
|
||||
/// settable table still checks the first segment, and every object of the sheet contract is
|
||||
/// strict, so the key cannot reach the document. The only accepted form is a key a later op
|
||||
/// replaces: the document is then the one the later op alone gives; one record traces the
|
||||
/// overwritten write. The TypeScript refused that form (structuredClone of the function read).
|
||||
#[test]
|
||||
fn an_inherited_member_name_is_a_plain_key_and_bypasses_nothing() {
|
||||
let renamed = json!({ "fr": "Mobilité", "en": "Mobility" });
|
||||
let set_name = json!({ "op": "set", "target": MOBILITY, "field": "name", "value": renamed });
|
||||
for member in [
|
||||
"constructor",
|
||||
"toString",
|
||||
"__proto__",
|
||||
"hasOwnProperty",
|
||||
"valueOf",
|
||||
] {
|
||||
let field = format!("name.{member}");
|
||||
let write = json!({ "op": "set", "target": MOBILITY, "field": field, "value": "x" });
|
||||
let kept = mini_apply(json!([write])).unwrap_err();
|
||||
assert!(
|
||||
kept.starts_with("curated document is not shape-valid"),
|
||||
"{member}: {kept}"
|
||||
);
|
||||
let as_field = json!({ "op": "set", "target": MOBILITY, "field": member, "value": "x" });
|
||||
let refused = mini_apply(json!([as_field])).unwrap_err();
|
||||
assert!(
|
||||
refused.contains(&format!("unknown field \"{member}\"")),
|
||||
"{member}: {refused}"
|
||||
);
|
||||
let deep = json!({ "op": "set", "target": MOBILITY, "field": format!("{member}.fr"), "value": "x" });
|
||||
assert!(
|
||||
mini_apply(json!([deep]))
|
||||
.unwrap_err()
|
||||
.contains("unknown field"),
|
||||
"{member}"
|
||||
);
|
||||
let overwritten = mini_apply(json!([write, set_name])).unwrap();
|
||||
let alone = mini_apply(json!([set_name])).unwrap();
|
||||
assert_eq!(
|
||||
format_json(&overwritten.document).unwrap(),
|
||||
format_json(&alone.document).unwrap(),
|
||||
"{member}: the document is the later op's alone"
|
||||
);
|
||||
assert_eq!(mobility(&overwritten.document)["name"], renamed);
|
||||
let traced: Vec<_> = overwritten
|
||||
.records
|
||||
.iter()
|
||||
.filter(|r| r.field.as_deref() == Some(field.as_str()))
|
||||
.collect();
|
||||
assert_eq!(traced.len(), 1, "{member}");
|
||||
assert_eq!(
|
||||
traced[0].before,
|
||||
Value::Null,
|
||||
"{member}: never read through the prototype"
|
||||
);
|
||||
assert_eq!(
|
||||
overwritten.records.len(),
|
||||
alone.records.len() + 1,
|
||||
"{member}"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// Technical debt kept during R5 (owner 2026-10-23, RUST.md §11.12): the migration map replays
|
||||
/// a record by its op, whatever its target, as `migration-map.ts` does. A cascade record of a
|
||||
/// view, zone or region rename on an annotation is replayed as a rename of that annotation,
|
||||
/// and a reference rename's cascade on a cited finding as a rename of the finding's path. The
|
||||
/// values below are the TypeScript's (frozen in `curation-synthetic.json`); a fix would change
|
||||
/// them on both sides and is the owner's decision.
|
||||
#[test]
|
||||
fn the_migration_map_replays_cascade_records_by_their_op_as_the_typescript_does() {
|
||||
let frozen = oracle("curation-synthetic.json");
|
||||
let case = |name: &str| {
|
||||
let case = frozen["cases"]
|
||||
.as_array()
|
||||
.unwrap()
|
||||
.iter()
|
||||
.find(|c| c["name"] == name)
|
||||
.unwrap();
|
||||
(
|
||||
serde_json::from_str::<Value>(case["migration_map"].as_str().unwrap()).unwrap(),
|
||||
case["migration_stats"].clone(),
|
||||
)
|
||||
};
|
||||
let (map, _) = case("quirk-view-rename-retargets-annotation");
|
||||
assert_eq!(
|
||||
map["annotations"]["legacy-hip"]["id"], "principal",
|
||||
"should stay hip"
|
||||
);
|
||||
assert_eq!(
|
||||
map["annotations"]["legacy-neck"]["id"], "principal",
|
||||
"should stay neck"
|
||||
);
|
||||
assert_eq!(map["views"]["head"], "principal", "should stay head");
|
||||
let (map, stats) = case("quirk-reference-rename-renames-finding-path");
|
||||
let path = "hip/hip-dysfunctions/mobility";
|
||||
assert_eq!(
|
||||
map["finding_paths"][path], path,
|
||||
"restored by re-homing only"
|
||||
);
|
||||
assert_eq!(
|
||||
stats["rehomed"], 3,
|
||||
"should be 0: the three paths are identical"
|
||||
);
|
||||
let (map, _) = case("renames-cascade");
|
||||
assert_eq!(
|
||||
map["annotations"]["legacy-hip"]["id"], "hip-joint",
|
||||
"should be coxofemoral"
|
||||
);
|
||||
assert_eq!(
|
||||
map["finding_paths"][path],
|
||||
Value::Null,
|
||||
"should be hip-joint/hip-dysfunctions/motion"
|
||||
);
|
||||
}
|
||||
@@ -1 +1 @@
|
||||
{"baseline":{"schema_version":2,"species_id":"equine","name":{"fr":"Mini","en":"Mini"},"description":{},"scope_disclaimer":{},"attribution":{"authors":[],"license":null,"notes":null},"vertebral_config":{"regions":[{"code":"C","name":{"fr":"Cervicales","en":"Cervical"},"count":7},{"code":"T","name":{"fr":"Thoraciques","en":"Thoracic"},"count":18}]},"references":[],"categories":[{"id":"joints","name":{"fr":"Articulations","en":"Joints"},"color":null},{"id":"bones","name":{"fr":"Os","en":"Bones"},"color":null}],"views":[{"id":"main","kind":"main","name":{"fr":"Vue","en":"View"},"svg_asset_id":"3f6c1b52-8a4e-4d17-9b0c-5e2a7d91c4f8","view_box":null},{"id":"head","kind":"detail","parent_view_id":"main","name":{"fr":"Tête","en":"Head"},"svg_asset_id":null,"view_box":{"min_x":0,"min_y":0,"width":10,"height":10}}],"annotations":[{"id":"hip","kind":"point","view_id":"main","category_id":"joints","laterality":"bilateral","geometry":{"type":"circle","cx":1,"cy":2,"r":3},"name":{"fr":"Hanche","en":"Hip"},"finding_zone_id":"hip","vertebral_region_code":null},{"id":"neck","kind":"zone","view_id":"main","category_id":"bones","laterality":"unpaired","geometry":null,"name":{"fr":"Cou","en":"Neck"},"finding_zone_id":"neck","vertebral_region_code":"C"},{"id":"head-trigger","kind":"detail_trigger","view_id":"main","category_id":"bones","laterality":"unpaired","geometry":null,"name":null,"opens_view_id":"head"}],"finding_zones":[{"id":"hip","name":{"fr":"Hanche","en":"Hip"},"categories":[{"id":"hip-dysfunctions","kind":"dysfunction","name":{"fr":"Dysfonctions","en":"Dysfunctions"},"children":[{"id":"mobility","name":{"fr":"mobility fr","en":"mobility en"},"children":[{"id":"flexion","name":{"fr":"flexion fr","en":"flexion en"}},{"id":"extension","name":{"fr":"extension fr","en":"extension en"}}]},{"id":"pain","name":{"fr":"pain fr","en":"pain en"}}]},{"id":"anamnesis","kind":"anamnesis","name":{"fr":"Anamnèse","en":"Anamnesis"},"children":[{"id":"trauma","name":{"fr":"trauma fr","en":"trauma en"}}]}]},{"id":"neck","name":{"fr":"Cou","en":"Neck"},"categories":[{"id":"neck-dysfunctions","kind":"dysfunction","name":{"fr":"Dysfonctions","en":"Dysfunctions"},"children":[{"id":"stiffness","name":{"fr":"stiffness fr","en":"stiffness en"}},{"id":"vet","name":{"fr":"vet fr","en":"vet en"},"requires_vet_referral":true}]}]}]},"references_file":{"references":[{"id":"atlas","type":"book","citation":"Atlas of anatomy","url":null,"doi":null},{"id":"paper","type":"journal","citation":"A paper","url":null,"doi":"10.1/x"}]},"cases":[{"name":"set-fields","changes_file":{"changes":[{"id":"CHG-001","level":"A","kind":"technical","title":{"fr":"Essai","en":"Test"},"rationale":"Essai","reference_ids":[],"ops":[{"op":"set","target":"region:C","field":"count_range","value":{"min":6,"max":8}},{"op":"set","target":"document","field":"name.en","value":"Mini sheet"},{"op":"set","target":"document","field":"scope_disclaimer.fr","value":"Périmètre"},{"op":"set","target":"annotation:hip","field":"geometry","value":{"type":"circle","cx":1.5,"cy":2,"r":0.25}},{"op":"set","target":"annotation:neck","field":"color","value":"#aabbcc"},{"op":"set","target":"finding:hip/hip-dysfunctions/mobility/flexion","field":"description.en","value":"Flexion described"},{"op":"set","target":"finding:hip/anamnesis","field":"name.fr","value":"Anamnèse complète"},{"op":"set","target":"zone:neck","field":"name","value":{"fr":"Encolure","en":"Neck"}},{"op":"set","target":"view:head","field":"name.en","value":"Skull"},{"op":"set","target":"category:bones","field":"color","value":"#112233"},{"op":"set","target":"reference:paper","field":"doi","value":"10.1/y"},{"op":"set","target":"finding:hip/hip-dysfunctions/mobility/flexion","field":"review_status","value":"reviewed"}]}]},"ok":true,"document":"{\n \"schema_version\": 2,\n \"species_id\": \"equine\",\n \"name\": {\n \"fr\": \"Mini\",\n \"en\": \"Mini sheet\"\n },\n \"description\": {},\n \"scope_disclaimer\": {\n \"fr\": \"Périmètre\"\n },\n \"attribution\": {\n \"authors\": [],\n \"license\": null,\n \"notes\": null\n },\n \"vertebral_config\": {\n \"regions\": [\n {\n \"code\": \"C\",\n \"name\": {\n \"fr\": \"Cervicales\",\n \"en\": \"Cervical\"\n },\n \"count\": 7,\n \"count_range\": {\n \"min\": 6,\n \"max\": 8\n }\n },\n {\n \"code\": \"T\",\n \"name\": {\n \"fr\": \"Thoraciques\",\n \"en\": \"Thoracic\"\n },\n \"count\": 18\n }\n ]\n },\n \"references\": [\n {\n \"id\": \"atlas\",\n \"type\": \"book\",\n \"citation\": \"Atlas of anatomy\",\n \"url\": null,\n \"doi\": null\n },\n {\n \"id\": \"paper\",\n \"type\": \"journal\",\n \"citation\": \"A paper\",\n \"url\": null,\n \"doi\": \"10.1/y\"\n }\n ],\n \"categories\": [\n {\n \"id\": \"joints\",\n \"name\": {\n Line truncated
|
||||
{"baseline":{"schema_version":2,"species_id":"equine","name":{"fr":"Mini","en":"Mini"},"description":{},"scope_disclaimer":{},"attribution":{"authors":[],"license":null,"notes":null},"vertebral_config":{"regions":[{"code":"C","name":{"fr":"Cervicales","en":"Cervical"},"count":7},{"code":"T","name":{"fr":"Thoraciques","en":"Thoracic"},"count":18}]},"references":[],"categories":[{"id":"joints","name":{"fr":"Articulations","en":"Joints"},"color":null},{"id":"bones","name":{"fr":"Os","en":"Bones"},"color":null}],"views":[{"id":"main","kind":"main","name":{"fr":"Vue","en":"View"},"svg_asset_id":"3f6c1b52-8a4e-4d17-9b0c-5e2a7d91c4f8","view_box":null},{"id":"head","kind":"detail","parent_view_id":"main","name":{"fr":"Tête","en":"Head"},"svg_asset_id":null,"view_box":{"min_x":0,"min_y":0,"width":10,"height":10}}],"annotations":[{"id":"hip","kind":"point","view_id":"main","category_id":"joints","laterality":"bilateral","geometry":{"type":"circle","cx":1,"cy":2,"r":3},"name":{"fr":"Hanche","en":"Hip"},"finding_zone_id":"hip","vertebral_region_code":null},{"id":"neck","kind":"zone","view_id":"main","category_id":"bones","laterality":"unpaired","geometry":null,"name":{"fr":"Cou","en":"Neck"},"finding_zone_id":"neck","vertebral_region_code":"C"},{"id":"head-trigger","kind":"detail_trigger","view_id":"main","category_id":"bones","laterality":"unpaired","geometry":null,"name":null,"opens_view_id":"head"}],"finding_zones":[{"id":"hip","name":{"fr":"Hanche","en":"Hip"},"categories":[{"id":"hip-dysfunctions","kind":"dysfunction","name":{"fr":"Dysfonctions","en":"Dysfunctions"},"children":[{"id":"mobility","name":{"fr":"mobility fr","en":"mobility en"},"children":[{"id":"flexion","name":{"fr":"flexion fr","en":"flexion en"}},{"id":"extension","name":{"fr":"extension fr","en":"extension en"}}]},{"id":"pain","name":{"fr":"pain fr","en":"pain en"}}]},{"id":"anamnesis","kind":"anamnesis","name":{"fr":"Anamnèse","en":"Anamnesis"},"children":[{"id":"trauma","name":{"fr":"trauma fr","en":"trauma en"}}]}]},{"id":"neck","name":{"fr":"Cou","en":"Neck"},"categories":[{"id":"neck-dysfunctions","kind":"dysfunction","name":{"fr":"Dysfonctions","en":"Dysfunctions"},"children":[{"id":"stiffness","name":{"fr":"stiffness fr","en":"stiffness en"}},{"id":"vet","name":{"fr":"vet fr","en":"vet en"},"requires_vet_referral":true}]}]}]},"references_file":{"references":[{"id":"atlas","type":"book","citation":"Atlas of anatomy","url":null,"doi":null},{"id":"paper","type":"journal","citation":"A paper","url":null,"doi":"10.1/x"}]},"cases":[{"name":"set-fields","changes_file":{"changes":[{"id":"CHG-001","level":"A","kind":"technical","title":{"fr":"Essai","en":"Test"},"rationale":"Essai","reference_ids":[],"ops":[{"op":"set","target":"region:C","field":"count_range","value":{"min":6,"max":8}},{"op":"set","target":"document","field":"name.en","value":"Mini sheet"},{"op":"set","target":"document","field":"scope_disclaimer.fr","value":"Périmètre"},{"op":"set","target":"annotation:hip","field":"geometry","value":{"type":"circle","cx":1.5,"cy":2,"r":0.25}},{"op":"set","target":"annotation:neck","field":"color","value":"#aabbcc"},{"op":"set","target":"finding:hip/hip-dysfunctions/mobility/flexion","field":"description.en","value":"Flexion described"},{"op":"set","target":"finding:hip/anamnesis","field":"name.fr","value":"Anamnèse complète"},{"op":"set","target":"zone:neck","field":"name","value":{"fr":"Encolure","en":"Neck"}},{"op":"set","target":"view:head","field":"name.en","value":"Skull"},{"op":"set","target":"category:bones","field":"color","value":"#112233"},{"op":"set","target":"reference:paper","field":"doi","value":"10.1/y"},{"op":"set","target":"finding:hip/hip-dysfunctions/mobility/flexion","field":"review_status","value":"reviewed"}]}]},"ok":true,"document":"{\n \"schema_version\": 2,\n \"species_id\": \"equine\",\n \"name\": {\n \"fr\": \"Mini\",\n \"en\": \"Mini sheet\"\n },\n \"description\": {},\n \"scope_disclaimer\": {\n \"fr\": \"Périmètre\"\n },\n \"attribution\": {\n \"authors\": [],\n \"license\": null,\n \"notes\": null\n },\n \"vertebral_config\": {\n \"regions\": [\n {\n \"code\": \"C\",\n \"name\": {\n \"fr\": \"Cervicales\",\n \"en\": \"Cervical\"\n },\n \"count\": 7,\n \"count_range\": {\n \"min\": 6,\n \"max\": 8\n }\n },\n {\n \"code\": \"T\",\n \"name\": {\n \"fr\": \"Thoraciques\",\n \"en\": \"Thoracic\"\n },\n \"count\": 18\n }\n ]\n },\n \"references\": [\n {\n \"id\": \"atlas\",\n \"type\": \"book\",\n \"citation\": \"Atlas of anatomy\",\n \"url\": null,\n \"doi\": null\n },\n {\n \"id\": \"paper\",\n \"type\": \"journal\",\n \"citation\": \"A paper\",\n \"url\": null,\n \"doi\": \"10.1/y\"\n }\n ],\n \"categories\": [\n {\n \"id\": \"joints\",\n \"name\": {\n Line truncated
|
||||
@@ -474,6 +474,23 @@ const ACCEPTED: Case[] = [
|
||||
{ op: 'set', target: `${MOBILITY}/flexion`, field: 'description.en' },
|
||||
]),
|
||||
},
|
||||
{
|
||||
// Migration-map debt kept during R5 (owner 2026-10-23): the replay reads `record.op`
|
||||
// whatever the record's target, so the view rename's cascade record on annotation:hip
|
||||
// (field view_id) is replayed as a rename of that annotation: legacy-hip -> 'principal'.
|
||||
name: 'quirk-view-rename-retargets-annotation',
|
||||
changes_file: one([{ op: 'rename', target: 'view:main', id: 'principal' }]),
|
||||
},
|
||||
{
|
||||
// Same debt: the reference rename's cascade record on a cited finding is replayed as a
|
||||
// rename of that finding's path: hip/hip-dysfunctions/mobility -> .../atlas-2, then
|
||||
// absent from the final paths -> null.
|
||||
name: 'quirk-reference-rename-renames-finding-path',
|
||||
changes_file: one([
|
||||
{ op: 'cite', target: MOBILITY, reference_ids: ['atlas'] },
|
||||
{ op: 'rename', target: 'reference:atlas', id: 'atlas-2' },
|
||||
]),
|
||||
},
|
||||
{
|
||||
name: 'two-changes',
|
||||
changes_file: {
|
||||
@@ -506,6 +523,39 @@ const ACCEPTED: Case[] = [
|
||||
]
|
||||
|
||||
const REFUSED: Case[] = [
|
||||
{
|
||||
// TypeScript: readField returns the inherited Object.prototype.constructor, record's
|
||||
// structuredClone throws DataCloneError. The Rust port reads a plain missing key
|
||||
// (declared, RUST.md §11.12); the later `set name` removes the written key.
|
||||
name: 'declared-inherited-member-overwritten',
|
||||
changes_file: one([
|
||||
{ op: 'set', target: MOBILITY, field: 'name.constructor', value: 'x' },
|
||||
{
|
||||
op: 'set',
|
||||
target: MOBILITY,
|
||||
field: 'name',
|
||||
value: { fr: 'Mobilité', en: 'Mobility' },
|
||||
},
|
||||
]),
|
||||
},
|
||||
{
|
||||
name: 'apply-inherited-member-kept',
|
||||
changes_file: one([
|
||||
{ op: 'set', target: MOBILITY, field: 'name.toString', value: 'x' },
|
||||
]),
|
||||
},
|
||||
{
|
||||
name: 'apply-inherited-member-as-field',
|
||||
changes_file: one([
|
||||
{ op: 'set', target: MOBILITY, field: 'constructor', value: 'x' },
|
||||
]),
|
||||
},
|
||||
{
|
||||
name: 'apply-inherited-member-intermediate',
|
||||
changes_file: one([
|
||||
{ op: 'set', target: MOBILITY, field: 'name.toString.x', value: 'x' },
|
||||
]),
|
||||
},
|
||||
{
|
||||
name: 'schema-unknown-change-key',
|
||||
changes_file: one([{ op: 'remove', target: `${MOBILITY}/flexion` }], {
|
||||
|
||||
Reference in new issue
Block a user