thing-contract: every committed store's catalog is the C# catalog
All checks were successful
Portable Eve contracts and browser lowering / ubuntu-latest eve-browser-lowering (pull_request) Successful in 2m38s
Portable Eve contracts and browser lowering / ubuntu-latest eve-contracts (pull_request) Successful in 4m48s

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 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-11-28 06:37:18 +01:00
commit 66a612210d

View file

@ -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, &copy).unwrap();
let catalog = SingleFileMessagePackBackingStore::new(&copy).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, &copy).unwrap();
let catalog = SingleFileMessagePackBackingStore::new(&copy).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);
}
}