Personal data · rule
data.erase_field_required
Erasing a person would clear a field that can't be none: a reference whose record erasure keeps, a marked field of a record it anonymises, or a marked field of the person's own record it keeps.
Area 15, Personal data; not declinable; the next step is usually the human's.
Why Jadpo refuses it
Erasure keeps some records without the person. One kept with
Erasure.anonymised, which an OnDelete.cleared reference means, loses
its reference to the person and every field marked personal:. One kept
with Erasure.retained loses only the reference. A field whose type
doesn't end in ? must always hold a value, so erasure couldn't clear
it, and the person's data would stay. A person's own record kept with
erase: Erasure.retained on one of its fields loses every other marked
field the same way. Here a comment is kept when its author is erased, but
the name it was signed with can't be cleared.
Jadpo won't choose for you: whether the comment is kept without the name, or deleted with its author, is a decision about your records.
What it looks like
main.jadpo:
type CommentText = Text { max_length: 500}type SignedName = Text { max_length: 80}entity User { id: Uuid email: Email { personal: PersonalData.contact } person: true}entity Comment { id: Uuid author_id: User.id? { on_delete: OnDelete.cleared } body: CommentText signed_as: SignedName { personal: PersonalData.identifying }}
error Erasing a User can't clear Comment.signed_as
--> main.jadpo:24:5
|20 | author_id: User.id? { | --------- keeps the record without the person24 | signed_as: SignedName { | ^^^^^^^^^ personal data that can't be `none`
- reason
author_idisOnDelete.cleared, which meansErasure.anonymised: erasing aUserkeeps each comment that refers to them, clearing the reference and every marked field.signed_asis markedpersonal:, and only an optional field (SignedName?) can be cleared.- next
- Make
signed_asSignedName?, or sayerase: Erasure.deletedonauthor_idto delete the comment instead (human) - rule
- data.
erase_ field_ required - help
- https://jadpo.
dev/docs/errors/data. erase_ field_ required
(human) at the end of the next: line tells your coding agent to stop
and ask you which fix you want, because the choice is yours to make: it
decides whether a person's comments outlive them.
A reference erasure clears is refused the same way. Erasure.retained
or Erasure.anonymised on author_id: User.id, which can't be none,
keeps the comment while it still points at someone who is gone.
How to fix it
The question is whether a comment is kept once its author is erased.
If the comment stays without its author's name, make the field one
that can be none:
entity Comment { ... signed_as: SignedName? { personal: PersonalData.identifying }}
Erasing a user now keeps each of their comments with author_id and
signed_as set to none. The body isn't marked, so it stays.
If the comment goes with its author, say Erasure.deleted on the
reference:
entity Comment { id: Uuid author_id: User.id? { on_delete: OnDelete.cleared erase: Erasure.deleted } ...}
Erasing a user now deletes their comments. Ordinary code deleting a
user still keeps them, with author_id set to none.
Related
Markdown for agents: /docs/errors/data.erase_field_required.md.Built from Jadpo main at e00e61f.