ErrorsPersonal data · rule
data.rule_erased_field
A rule across an entity's fields reads a field that erasure or retention clears, so erasing a person could break it.
Area 15, Personal data; not declinable; the next step is usually the agent's.
Why Jadpo refuses it
A rule across an entity's fields holds for every record stored, whichever
write stores it. Erasure and retention change records without any write
of yours: erasing a person clears what was theirs on the records it
keeps, and a field's retention: clears its value once its time is up.
Erasing a person must always succeed, so neither may break a rule, and a
rule may not read a field either of them clears.
Here a visitor's signup_ip is cleared 30 days after they sign up, and
the rule says a visitor always has one.
What it looks like
main.jadpo:
config { signup_ip_kept: Duration { default: 30d }}entity Visitor { id: Uuid signup_ip: IpAddress? { retention: { after: config.signup_ip_kept since: created_at } } created_at: Instant { generated: Generated.on_create } rule known: match signup_ip { none -> false some(ip) -> true }}
error The rule Visitor.known reads signup_ip, which erasure or retention clears
--> main.jadpo:19:10
|19 | rule known: match signup_ip { | ^^^^^ reads `signup_ip`
- reason
Visitor.signup_ipis cleared without any write of yours, since itsretention:clears it once its time is up, and that must always succeed, so no rule may be broken by it: a rule across an entity's fields reads only fields erasure and retention leave as they are.- next
- Check
signup_ipwhere it is written, in theInputthe write takes, rather than in a rule onVisitor(agent) - rule
- data.
rule_ erased_ field - help
- https://jadpo.
dev/docs/errors/data. rule_ erased_ field
(agent) at the end of the next: line means your coding agent can make
the fix itself.
How to fix it
If a visitor must give an address when they sign up, check it where
it is written instead, on the Input a route takes, so a request without
one is refused before anything runs, and let the stored record lose it
when its time is up. main.jadpo becomes:
config { signup_ip_kept: Duration { default: 30d }}entity Visitor { id: Uuid signup_ip: IpAddress? { retention: { after: config.signup_ip_kept since: created_at } } created_at: Instant { generated: Generated.on_create }}type SignUp = Input { signup_ip: IpAddress}
SignUp has to hold an address, and a stored visitor's goes after 30
days.
Related
Markdown for agents: /docs/errors/data.rule_erased_field.md.Built from Jadpo's main branch at commit ee389ee.