ErrorsEntities, stores and migrations · rule
data.record_version_invalid
An entity keeps more than one RecordVersion, or one that can be none.
Area 5, Entities, stores and migrations; not declinable; the next step is usually the agent's.
Why Jadpo refuses it
A field typed RecordVersion is the record's version. Jadpo sets it to 1
when the record is created and moves it on by one with every change, so
a change made from an old copy can say which version it saw and be
refused when that isn't the stored one. Every record has a version, so it
is never optional, and one version says everything two would.
What it looks like
main.jadpo:
type TodoTitle = Text { max_length: 200}entity Todo { id: Uuid title: TodoTitle version: RecordVersion revision: RecordVersion}
error Todo keeps a second version, revision
--> main.jadpo:9:5
|8 | version: RecordVersion | ------- its version9 | revision: RecordVersion | ^^^^^^^^ a second `RecordVersion`
- reason
- Jadpo keeps one version a record, which every change moves on; a second would always hold the same number as
version. - next
- Remove
revision, and readTodo.versioninstead (agent) - rule
- data.
record_ version_ invalid - help
- https://jadpo.
dev/docs/errors/data. record_ version_ invalid
(agent) at the end of the next: line means your coding agent can make
the fix itself.
A version that can be none is refused the same way:
type TodoTitle = Text { max_length: 200}entity Todo { id: Uuid title: TodoTitle version: RecordVersion?}
error Todo.version can be none
--> main.jadpo:8:5
|8 | version: RecordVersion? | ^^^^^^^ can be `none`
- reason
- A record's version is 1 when it is created and one more after every change, so every record has one;
RecordVersionis never optional. - next
- Write
version: RecordVersion(agent) - rule
- data.
record_ version_ invalid - help
- https://jadpo.
dev/docs/errors/data. record_ version_ invalid
How to fix it
If the entity keeps a version, keep one required RecordVersion,
and read it wherever the other was read:
entity Todo { id: Uuid title: TodoTitle version: RecordVersion}
Each new todo starts at version 1, and every change Jadpo makes to it
moves version on.
Related
Markdown for agents: /docs/errors/data.record_version_invalid.md.Built from Jadpo's main branch at commit 72d483f.