From 66a612210db37e43f42407a7f10d441a42c0744a Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sat, 28 Nov 2026 06:37:18 +0100 Subject: [PATCH] thing-contract: every committed store's catalog is the C# catalog The Rust reader does not compare member type names on open, so the drifted-name check is a catalog comparison here. Co-Authored-By: Claude Sonnet 5.5 --- .../thing-contract/tests/catalog_members.rs | 29 ++++++++++--------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/crates/thing-contract/tests/catalog_members.rs b/crates/thing-contract/tests/catalog_members.rs index e56f709..a343883 100644 --- a/crates/thing-contract/tests/catalog_members.rs +++ b/crates/thing-contract/tests/catalog_members.rs @@ -44,17 +44,20 @@ fn rows_equal_the_csharp_file() { } #[test] -fn the_written_store_carries_the_rows() { - // goldens.rs writes a store of one record per kind and compares it byte for byte with the - // committed written-by-rs.cc, so the committed file's catalog is the catalog the crate writes. It is - // copied first: reading a store creates a lock file beside it. - let committed = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("../../tests/thing-contract-parity/written-by-rs.cc"); - let work = PathBuf::from(env!("CARGO_TARGET_TMPDIR")).join("catalog-members"); - std::fs::create_dir_all(&work).unwrap(); - let copy = work.join("written-by-rs.cc"); - std::fs::copy(committed, ©).unwrap(); - let catalog = SingleFileMessagePackBackingStore::new(©).pull_schema_catalog().unwrap(); - let from_store = sorted(catalog.iter().map(|entry| group(&entry.members)).collect()); - assert_eq!(from_store, tsv_groups()); - let _ = std::fs::remove_dir_all(&work); +fn every_committed_store_carries_the_rows() { + // Each runtime's committed store, this crate's own included, declares the C# catalog. The Rust + // reader does not compare member type names when it opens a store, so a drifted name in a + // store another runtime wrote fails here. A store is copied first: reading it creates a lock + // file beside it. + for file in ["written-by-rs.cc", "written-by-cs.cc", "written-by-ts.cc"] { + let committed = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("../../tests/thing-contract-parity").join(file); + let work = PathBuf::from(env!("CARGO_TARGET_TMPDIR")).join(format!("catalog-members-{file}")); + std::fs::create_dir_all(&work).unwrap(); + let copy = work.join(file); + std::fs::copy(committed, ©).unwrap(); + let catalog = SingleFileMessagePackBackingStore::new(©).pull_schema_catalog().unwrap(); + let from_store = sorted(catalog.iter().map(|entry| group(&entry.members)).collect()); + assert_eq!(from_store, tsv_groups(), "{file}"); + let _ = std::fs::remove_dir_all(&work); + } }