Issue #3618712: Write the availability sum as the inventory controls it already is

The engine answered "how many are left" from six arguments and a boolean mode flag. That's the shape of several concepts sharing one function — except they aren't several concepts.

Revenue management named this decades ago and named it as one rule: capacity is sold into classes, a booking limit caps a class, a protection level holds capacity out of a class for a named holder, and a booking may take the least any control it passes through will still give. A limit and a protection are two ways of writing the same nested control, which is why an engine wants both.

So the sum is a fold over controls and the mode flag dissolves into the list. A class passes through its own limit and through the room; the room passes through itself alone. An allotment's hold is a protection on the room, not on the price — seats are what it holds.

Proved before it was used. 2400 combinations of the six arguments run through both the old signature and the fold, asserted equal, deliberately including the absurd: quotas larger than the room, consumption past the limit, protections exceeding capacity, every combination of unlimited. All agree. The engine now delegates, and that test is what permits it.

Behaviour unchanged, and now visible. Capacity stays shared rather than carved, so an unsold seat in one class is still sellable in another — the nested form. The literature is blunt about the alternative: with distinct allocations, a full class refuses a booker while a cheaper class sits open beside it. That was already true here; it was just implied by an argument list instead of stated.

Cost: all ten figures in the hold cost log identical, compared one by one. It's arithmetic.

First step of [#3618694], and the one that could have killed that plan cheaply — if the sum hadn't been one rule over a list, the rest was wrong.

Local, MySQL: 2500 tests green across InventoryControlTest (2400), AllotmentQueryBudgetTest, BookingChannelRestrictionTest, PoolAvailabilityBoundTest, VenueAvailabilityBoundTest, VenueAvailabilityDocumentTest, AvailablePlaceReadCountTest, PlacesInPlayTest, PlaceBookingTest, PoolOpTest, AreaCounterTest, PlaceHoldCostTest. phpcs and cspell clean.

Merge request reports

Loading
Loading