Skip to content

catch TypeError on nested YAML anchors in contracts

Request Summary

So far, anchors for list elements cannot be used in case they are extracted into another list.

I'm not sure whether this is a standard use case or rather a special one, but in terms of the contracts example I provide below, I think it is a case that can occur. Also, it is pretty hard to spot and debug.

Use case

Here is an example of contracts for MultiAgent storage agents 7 and 8:

AgentGroups:
  - &exchange 1
  - &forecaster 6
  - &storage [7, 8]

Contracts:
##########################
# -- Forecasting --      #
##########################
  - SenderId: *storage
    ReceiverId: *forecaster
    ProductName: PriceForecastRequest
    FirstDeliveryTime: -21
    DeliveryIntervalInSteps: 3600

  - SenderId: *forecaster
    ReceiverId: *storage
    ProductName: PriceForecast
    FirstDeliveryTime: -19
    DeliveryIntervalInSteps: 3600

##########################
# -- Bidding --          #
##########################
  - SenderId: *exchange
    ReceiverId: [*storage, *forecaster]
    ProductName: GateClosureInfo
    FirstDeliveryTime: -30
    DeliveryIntervalInSteps: 3600

  - SenderId: *storage
    ReceiverId: *exchange
    ProductName: Bids
    FirstDeliveryTime: 0
    DeliveryIntervalInSteps: 3600

  - SenderId: *exchange
    ReceiverId: *storage
    ProductName: Awards
    FirstDeliveryTime: 4
    DeliveryIntervalInSteps: 3600

This won't work for the GateClosureInfo. It would require the list of storage agents to be flattened when referencing the respective anchor.

Other

It should be checked first, whether it is always desired to flatten the list or whether nested lists are a thing that might be desired when referencing the YAML anchor. In the latter case, it would not be possible to distinct what is desired without additional user specification.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information