Brand: ItemData.Get already refuses an unset ref; drop the duplicate IsSet guard

Stryker's one survivor in the first sweep was the guard's `true ?` mutant: the
cache's Get(ref) extension already returns null for an unset reference, so the
guard was a second path. Adds the removed-product fact the spec names.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-10-08 19:04:09 +02:00
commit ec081b9b6d
2 changed files with 13 additions and 1 deletions

View file

@ -216,7 +216,7 @@ public class ItemManager
};
if (!maker.IsSet()) return (null, null);
var product = lot.Product.IsSet() ? ItemData.Get(lot.Product) : null;
var product = ItemData.Get(lot.Product);
return (ItemData.Get(maker), product);
}

View file

@ -92,6 +92,18 @@ public sealed class ItemTitleTests : IDisposable
Assert.Equal("Array", _items.Title(unit));
}
[Fact]
public void A_lot_whose_product_left_the_catalog_brands_its_maker_only()
{
var lot = _items.CreateLot(_panopticon);
_items.Lots[lot].Product = new CultRecordRef<FactionProductData>(new CultRecordKey("removed-product"));
var unit = (CraftedItemInstance) _items.CreateInstance(lot);
var (maker, product) = _items.Brand(unit);
Assert.Equal("Finch", maker.Name);
Assert.Null(product);
Assert.Equal("Array", _items.Title(unit));
}
[Fact]
public void Unbranded_units_are_titled_by_design()
{