Skip to content

PQA015 — Entity has both 'id' and 'address' defined

An access-model entity declares a natural key and a framework-allocated address at the same time.

An entity is addressed one of two ways, and they are not combinable.

address is a slot the framework allocates. The adapter does not choose it, the panel's memory layout does: card slot 41, time-zone slot 7. The value is excluded from the entity's content hash, because moving a record to a different slot does not change what the record says.

id is a natural key the data itself carries — a card number, a user code. The adapter receives it as a constructor parameter and it is part of the hash, because a different id is a different entity.

Why the build refuses this

The two answer the same question differently. Pairing, hashing and change detection all ask "is this the same entity as before?". address answers by slot, id answers by value. Declaring both leaves the differ with two contradictory answers and no rule for choosing.

Silent divergence follows. An entity paired by one key and hashed by the other reports itself unchanged when it moved, or changed when it did not — and a panel is written accordingly.

How to fix it

Ask who assigns the value. If the panel or the framework assigns the slot, it is address with a range. If the entity carries the value from the outside world, it is id naming an existing property.

# framework-allocated slot
address: uint
range: [1, 250]
# natural key from the data
id: card_number

What is not reported

An entity with neither. Not every model entity is individually addressed.

If you disagree with a report

Do not suppress it. A wrong report is a bug in the check — report it with the YAML that triggered it.