From a486a7cae288805ed8dace9f588cb5af70a61753 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Mon, 12 Oct 2026 04:38:53 +0200 Subject: [PATCH] ProductAndPriceCommands reads the reopened cache's own product handle; ship_cc.read treats a zero-byte file as holding no records The test asked a second cache for the handle of an object loaded by the first (identity lookup, no handle); it now asks the reopened cache for its product. cultcache-py raises an Unpack error on a zero-byte file, so ship_cc.read names the empty file through its own shape refusal. Both commits build. Co-Authored-By: Claude Opus 5.5 --- tests/Aetheria.Shared.Tests/ShipProductTests.cs | 2 +- tools/blender/aetheria_ships/ship_cc.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/Aetheria.Shared.Tests/ShipProductTests.cs b/tests/Aetheria.Shared.Tests/ShipProductTests.cs index a1d5c14d4..76e51bb43 100644 --- a/tests/Aetheria.Shared.Tests/ShipProductTests.cs +++ b/tests/Aetheria.Shared.Tests/ShipProductTests.cs @@ -236,7 +236,7 @@ public sealed class ShipProductTests : IDisposable var (hull, _, products) = ShipAuthoringStore.Load(path); var product = Assert.Single(products); using (var reopened = ShipAuthoringStore.Open(path)) - Assert.Equal(ShipModCatalog.ProductKey("mod.skiff", _acme), reopened.TryGetHandle(product).Value.Key); + Assert.Equal(ShipModCatalog.ProductKey("mod.skiff", _acme), reopened.TryGetHandle(Assert.Single(reopened.GetAll())).Value.Key); Assert.Equal(_acme, product.Manufacturer.Key); Assert.Equal(ShipModCatalog.HullKey("mod.skiff"), product.Design.Key); Assert.Equal(hull.Roles.Select(role => role.Name), product.Roles.Select(role => role.Role)); diff --git a/tools/blender/aetheria_ships/ship_cc.py b/tools/blender/aetheria_ships/ship_cc.py index 84f1747ee..50745ea3b 100644 --- a/tools/blender/aetheria_ships/ship_cc.py +++ b/tools/blender/aetheria_ships/ship_cc.py @@ -88,7 +88,8 @@ class ShipFile(NamedTuple): def read(path: str, cultlib_packages: str) -> ShipFile: cultcache, msgpack = _libraries(cultlib_packages) store = cultcache.SingleFileMessagePackBackingStore(path) - envelopes = store.pull_all() + # cultcache-py raises an Unpack error on a zero-byte file; an empty file holds no records, so the shape refusal below names it. + envelopes = [] if Path(path).is_file() and Path(path).stat().st_size == 0 else store.pull_all() ships = [envelope for envelope in envelopes if envelope.type == SCHEMA] hulls = [envelope for envelope in envelopes if envelope.type == HULL_SCHEMA] # Before S1 the hull lived inside the ship record. Saving such a file would preserve the stale hull under a ship that