ErrorsEntities, stores and migrations · rule
data.expiry_required
An entity kept in Redis doesn't say with expires_after: how long its records live.
Area 5, Entities, stores and migrations; not declinable; the next step is usually the agent's.
Why Jadpo refuses it
Redis keeps data that is short-lived and harmless to lose, so every
record of an entity kept there expires. expires_after: says how long a
record lives after its last write. Without it, a record would stay in
Redis until the server ran out of memory and dropped whatever it chose.
What it looks like
app.jadpo declares drafts, a Redis connection:
application { connections: { drafts: { driver: Driver.redis url: config.redis_url } }}config { redis_url: RedisUrl}
domains/accounts/entities/sign_up_draft.jadpo:
/// A sign-up someone has started and not yet finished.entity SignUpDraft { id: Uuid email: Email store: drafts}
error SignUpDraft is kept in Redis and doesn't say when its records expire
--> domains/accounts/entities/sign_up_draft.jadpo:2:8
|2 | entity SignUpDraft { | ^^^^^^^^^^^ no `expires_after:`
- reason
draftsis a Redis connection, which keeps data that is short-lived and harmless to lose, so every record kept there expires:expires_after:says how long one lives after its last write.- next
- Add
expires_after:toSignUpDraft, such asexpires_after: 2h(agent) - rule
- data.
expiry_ required - help
- https://jadpo.
dev/docs/errors/data. expiry_ required
(agent) at the end of the next: line means your coding agent can make
the fix itself.
How to fix it
If the records are short-lived and harmless to lose, say how long one lives after its last write:
entity SignUpDraft { ... store: drafts expires_after: 2h}
A sign-up nobody touches for two hours is gone.
If they should last until something deletes them, keep the entity in
a PostgreSQL store. domains/accounts/entities/sign_up_draft.jadpo
becomes:
/// A sign-up someone has started and not yet finished.entity SignUpDraft { id: Uuid email: Email}
Its records now live in main, and its first migration makes their table.
Related
Markdown for agents: /docs/errors/data.expiry_required.md.Built from Jadpo's main branch at commit 9080dc3.