Personal data · rule
data.erase_unreached
A field's erase: is on a field erasing a person never reaches: one that isn't a reference, or a reference to records erasure never deletes.
Area 15, Personal data; not declinable; the next step is usually the agent's.
Why Jadpo refuses it
erase: says what erasing a person does to a record when erasure
deletes the record it refers to: deletes it too, keeps it without the
person, or keeps it as it is. Erasure deletes only the person's record and
what their references say goes with it, so an erase: on a reference to
records erasure never deletes, or on a field that is no reference at all,
would never be used. Accepted, it would look like a decision about erasure
that does nothing. Here a tag refers to a category, which is neither a
person nor anyone's.
What it looks like
main.jadpo:
type TagLabel = Text { max_length: 40}entity Category { id: Uuid}entity Tag { id: Uuid category_id: Category.id { on_delete: OnDelete.cascade erase: Erasure.deleted } label: TagLabel}
error Erasing a person never reaches Tag.category_id
--> main.jadpo:13:9
|13 | erase: Erasure.deleted | ^^^^^ erasing a person never deletes a `Category`
- reason
erase:says what erasing a person does to aTagwhen erasure deletes theCategoryit refers to. Erasure deletes a person's record and what its references say goes with it, and aCategoryisn't either, so it never deletes one.- next
- Remove
erase:fromcategory_id(agent) - rule
- data.
erase_ unreached - help
- https://jadpo.
dev/docs/errors/data. erase_ unreached
(agent) at the end of the next: line means your coding agent can make
the fix itself.
An erase: on a field that isn't a reference, such as label, is
refused the same way, and so is one on a reference to a record erasure
keeps, whose own references stay with it, and one on an event's field: an
event is sent as it was written, and erasure never rewrites it. On a field
of a person's own record that isn't a reference, it means something else
(data.erase_own_field).
How to fix it
If the record isn't anyone's, remove erase::
entity Tag { id: Uuid category_id: Category.id { on_delete: OnDelete.cascade } ...}
Deleting a category still deletes its tags, as on_delete: says.
If the records belong to a person, refer to that person (The person):
entity Category { id: Uuid owner_id: User.id { on_delete: OnDelete.cascade }}
Erasing a user now deletes their categories, and erase: says what
that does to each tag in one.
Related
Markdown for agents: /docs/errors/data.erase_unreached.md.Built from Jadpo main at e00e61f.