Fix s2 findings: product validate/inspect/key-collision/price-1 tests; ship_cc.read drops the zero-byte compensator
ship_cc.read lets cultcache-py refuse a zero-byte file (CultLib pins that); the test expects the refusal. New behavioural tests: ValidateJudgesProductsOnADraftAndInspectListsThem (through ShipAuthoringCommands.Run), AProductKeyAlreadyInTheCatalogExcludesThePackage, and price 1 in ASoldPackageHullNeedsAPrice. Tests only plus the add-on deletion; all commits build. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
22dba843a5
commit
ae3740a050
3 changed files with 54 additions and 4 deletions
|
|
@ -88,8 +88,7 @@ class ShipFile(NamedTuple):
|
|||
def read(path: str, cultlib_packages: str) -> ShipFile:
|
||||
cultcache, msgpack = _libraries(cultlib_packages)
|
||||
store = cultcache.SingleFileMessagePackBackingStore(path)
|
||||
# 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()
|
||||
envelopes = 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
|
||||
|
|
|
|||
|
|
@ -153,10 +153,11 @@ class ReadTests(ShipFileCase):
|
|||
with self.assertRaisesRegex(ValueError, "must hold exactly one"):
|
||||
ship_cc.read(self.path, PACKAGES)
|
||||
|
||||
def test_refuses_a_file_with_no_record(self):
|
||||
def test_refuses_a_zero_byte_file_as_cultcache_does(self):
|
||||
# An empty file is not a store (CultLib pins this): the owner's refusal passes through, the add-on adds none.
|
||||
empty = str(Path(self.path).with_name("empty.cc"))
|
||||
Path(empty).write_bytes(b"")
|
||||
with self.assertRaisesRegex(ValueError, "must hold exactly one"):
|
||||
with self.assertRaises(ValueError):
|
||||
ship_cc.read(empty, PACKAGES)
|
||||
|
||||
def test_refuses_a_ship_record_that_still_carries_the_retired_embedded_hull(self):
|
||||
|
|
|
|||
Loading…
Reference in a new issue