ErrorsReads and writes · rule
query.include_hidden_unused
A query says include_hidden: true for an entity no lifecycle hides records of.
Area 6, Reads and writes; not declinable; the next step is usually the agent's.
Why Jadpo refuses it
include_hidden: true lets a query read the records an entity's
lifecycle hides, such as those in the bin, as well as the visible ones.
Only a lifecycle with a visible: hides records. Without one, every
record is already read, so the line would read as though the query
reaches records that don't exist. A person's record that erasure kept is
another matter, which include_erased: true reaches.
What it looks like
main.jadpo:
type Title = Text { max_length: 80}entity Note { id: Uuid title: Title}type NoteRow = Output { pick: [Note.id, Note.title]}query every_note() -> List<NoteRow> { from: Note order: [Note.title asc] limit: 20 include_hidden: true}
error every_note includes hidden records, and no lifecycle hides a Note
--> main.jadpo:18:5
|18 | include_hidden: true | ^^^^^^^^^^^^^^ nothing to include
- reason
include_hidden: truereaches the records a lifecycle'svisible:leaves out, andNotehas no lifecycle with avisible:, so every record of it is already read. A person's record erasure kept is reached byinclude_erased: trueinstead.- next
- Remove
include_hidden: true(agent) - rule
- query.
include_ hidden_ unused - help
- https://jadpo.
dev/docs/errors/query. include_ hidden_ unused
(agent) at the end of the next: line means your coding agent can make
the fix itself.
How to fix it
The question is whether a note should be hidden once deleted.
If it shouldn't, remove the line:
type Title = Text { max_length: 80}entity Note { id: Uuid title: Title}type NoteRow = Output { pick: [Note.id, Note.title]}query every_note() -> List<NoteRow> { from: Note order: [Note.title asc] limit: 20}
The query reads every note there is.
If it should, give the entity a lifecycle that hides deleted notes (Lifecycle):
type Title = Text { max_length: 80}entity Note { id: Uuid title: Title deleted_at: Instant? lifecycle: { visible: deleted_at == none transitions: { delete: { when: deleted_at == none set: { deleted_at: clock.now } } } }}type NoteRow = Output { pick: [Note.id, Note.title]}query every_note() -> List<NoteRow> { from: Note order: [Note.title asc] limit: 20 include_hidden: true}
The query now reads the deleted notes as well as the others.
Related
Markdown for agents: /docs/errors/query.include_hidden_unused.md.Built from Jadpo's main branch at commit 9080dc3.