A Data UI model is a nested plist that describes an entire application: types, fields, views, forms, RBAC roles, hooks, and deploy metadata. The compiler expands the model into PostgreSQL schema, parameterized SQL, backend functions, REST endpoints, and a schema-driven React UI.
Tagline: “Your whole app, in an email.”
This document is the author-facing vocabulary. Companion docs:
docs/hook-registry.md: validation, lifecycle, and action hook contractsdocs/model-accessors.md: REPL/debug accessors and deploy metadata readersdocs/deployment.md: how top-level keys drive scripts/data-ui deployAGENT.md: architecture, MVP status, and agent workflowSources of truth: lisp/model.lisp, lisp/backend.lisp, lisp/predicates.lisp, lisp/database.lisp, and the example models in models/.
Each file under models/ is a bare quoted plist: no defparameter, no wrapping variable:
Precede the model plist with a ;; comment block that states what the model is for and where it came from. Put it above the opening quote. Include:
Example:
;; Purpose: Shared to-do list with tags and point scoring.
;; Author: Donnie Cameron
;; Created: 2025-06-12
;; Prompt: (not AI-generated)
'(:title "To Do List"
:name "todos"
...)
For an AI-authored model, keep the prompt verbatim so the model can be regenerated or audited later:
;; Purpose: Parts inventory with locations and reorder levels.
;; Author: Claude (via Data UI hosted tier)
;; Created: 2026-03-01
;; Prompt: Build a parts inventory app. Each part has a SKU, name,
;; location, quantity on hand, and reorder level. Users should be
;; able to filter by location.
'(:title "Parts Inventory"
...)
Load with:
(set-model "todos") ; file name only, no path, no .lisp
Conventions (models/README.md):
| File | Role |
|---|---|
models/<name>.lisp |
Named application model |
models/local/<name>.lisp |
Locally deployed (VIP) model; gitignored, shadows same-named test fixture |
models/test/<name>.lisp |
Test fixture; do not change unless changing tests |
(set-model "<name>") tries models/<name>.lisp first, then models/local/<name>.lisp, then falls back to models/test/<name>.lisp.
Because the form starts with a quote, Lisp can read it. That is useful for paren-balance checks; it is not how the compiler is invoked.
Model text is read by read-model-text (lisp/aux.lisp), which enforces a closed lexical vocabulary — the text can never execute code when read (no reader macros) and can never exhaust the stack (depth cap). Every site that reads model text goes through it: set-model, Deploy and Generate (validate-deploy-model-text), and compile_model in scripts/data-ui. Violations are one-line validation errors naming the line number.
-, :, ., (, ), and whitespace. Anything else — # (so all reader macros: #., #|...|#, #\a), |, \, backquote, comma, non-ASCII letters — is rejected.\" and \\ are the escapes. A \ outside a string is rejected.; to end of line only. No block comments (#|...|#).', followed by (. No second quote anywhere.:name, :create — no second colon), integers (-42), simple floats (digits.digits, at most 7 digits in total, e.g. 0.0005, -0.25; single precision — no exponents like 1e3, no 1d0/1f0 suffixes, no bare points .5 or 1.), and t / nil. No other symbols, no package prefixes (a:b), no dotted pairs.read silently ignores trailing forms; the scanner rejects them.Adding new syntax or value kinds means a deliberate change to the allow-lists in valid-model-shadow, valid-model-tokens, and valid-model-data (all lisp/aux.lisp).
What a number literal may look like: see the token rule above — the “any number” in the discrete-filter row and the “:precision must be a number” rule both mean a simple float or integer literal, not arbitrary Common Lisp number syntax.
Recognized keys: *top-level-keys* = (:title :name :version :domain :domain-stg :repl :guest-allowed :guest-auto :api-roles :landing-page :new-roles :usage).
:types is required alongside those settings but is handled separately by compile-model. Any other root key is ignored by top-level-settings.
| Key | Required | Value | Consumed by |
|---|---|---|---|
:title |
yes | string (display title; restricted charset) | page title, deploy |
:name |
yes | string ^[a-z][-a-z0-9]*; profile and profile-* are reserved |
deploy tag/namespace dataui-<name> |
:version |
yes | string (semver-ish) | image tag |
:domain |
yes | FQDN-like string | HAProxy map, TLS host |
:domain-stg |
no (default: -stg suffixed onto the first DNS label of :domain) |
FQDN-like string | staging exposure (profile expose); must differ from :domain; requires :domain when written explicitly |
:repl |
no (default nil) |
boolean | Swank port iff t; nil in production |
:guest-allowed |
no (default nil) |
boolean | passwordless guest login via /api/login; see Guest login |
:guest-auto |
no (default t) |
boolean | whether the frontend may auto-login as guest without showing the login page (only meaningful with :guest-allowed t; nil keeps the login page as the first screen). Served as a JSON boolean by /api/public-info |
:api-roles |
no (default ("logged-in")) |
non-empty list of role-name strings, no duplicates | app-level REST endpoints; see API roles |
:landing-page |
no | type keyword present in :types, or nil |
/api/info via be-landing-page; falls back to first non-built-in type the user can access |
:new-roles |
no | plist: role-name keyword → non-empty list of permission strings | ensure-declared-roles at set-model time |
:usage |
no (default (:state :on)) |
plist; :state :on / :off, the only recognized key |
record-usage gate; see the :usage type paragraph |
:types |
yes | plist of type-key → type-def | compiler |
:name values profile and profile-* are reserved for host-profile HAProxy backends (scripts/data-ui profile expose); models using them fail compilation. Similar words (e.g. profiles) are fine.
Minimal skeleton:
'(:title "To Do List"
:name "todos"
:version "0.1"
:domain "todo.demo.data-ui.com"
:domain-stg "todo-stg.demo.data-ui.com"
:repl t
:guest-allowed t
:landing-page :todos
:types
(:todos
(:table t
:create :auto :update :auto :delete :auto :display t
:type-roles ("todo-users")
:fields
(:name
(:type :text :identity t
:ui (:label "To Do" :widget :textbox)
:validations (:required)
:source (:view :main :column :name :agg :first)
:column t :not-null t :unique t))
:list-form (:fields t)
:update-form (:fields t)
:add-form (:fields t))))
Under :types, each entry is type-key → plist.
| Key | Meaning | Notes |
|---|---|---|
:table |
Type is backed by a DB table | Always t in real models |
:create |
Insert strategy | :auto | nil | function (base-model only). Author models use :auto |
:update |
Update strategy | :auto | nil. Exposed to FE as boolean |
:delete |
Delete strategy | :auto | nil | function. :auto + path field → FS delete |
:display |
Show in type selector | t/nil. Also requires not :internal and read permission |
:type-roles |
RBAC roles for the type | list of role-name strings, or (role-name perm…) forms. Missing roles are created. "admin" is always added |
:default-sort |
Sort used when a list request sends none | (:field :asc\|:desc); direction optional, defaults :asc (always write the direction: omitted means :asc even on measures, where the automatic policy is :desc). Field must exist and be :sortable t (compile error otherwise). Absent = current behavior (id-ASC on base types, first-sortable-measure :desc on rollups). An explicit request sort always wins. Applies to every be-list read of the type with no request sort, including allowed-values FK option lists targeting it |
:title-field |
Names a row for the :usage log detail |
a field keyword; the field must exist and be :column t (compile error otherwise; forbidden on rollups — usage events never target one). The :usage :detail prefix for view / insert / update / delete / action becomes "<title-field value> / <uuid>" (plus the button key for action) when the row’s value is non-blank; per-row fallback to the identity coalesce when blank, and models without :title-field keep the identity coalesce unchanged |
:views |
Named join views | plist; see Views. Default if omitted (non-joiner): (:main (:tables (<type-key>))) |
:fields |
Field definitions | plist; see Fields |
:list-form / :add-form / :update-form / :view-form |
FE form specs | (:fields t) or (:fields (:a :b)); absent/nil → no form. Absent :view-form means no row click opens a record (no fallback); forbidden on rollups |
:tree |
Tree-structured type | requires :parent-type |
:is-leaf |
Leaf vs directory | requires :tree t |
:parent-type |
Parent type-key | existing non-base type; requires :tree t |
:fs-backed |
Filesystem-backed paths | requires :tree t |
:user-setting |
Per-user settings type | auto-sets :suppress-roles t; category :settings if :category omitted. One row per user; lifecycle creates/deletes that row with the user |
:suppress-roles |
Hide injected :roles field |
auto when :user-setting t; can set alone |
:category |
Type-selector group (author key) | :user | :settings | :system. Put a type under the Settings tab with :category :settings. Derived if omitted |
:base |
RBAC/base type (no resources row) |
normally only in *base-model* |
:built-in |
Built-in table name (no rt_ prefix) |
base-model / secrets |
:internal |
Hidden from public BE API | default = :is-joiner; joiners are internal |
:is-joiner |
M2M join table | fields are :reference pairs; no public CRUD SQL |
:rollup |
Read-only analytical type (no table) | see Rollup types; with :grain and type-level :filter |
:page |
Read-only projection of one content row, rendered as a full page | t is the sole declaration; see Page types; with :of and type-level :filter |
:of |
The content type a page projects | page-only key (:page t); names an ordinary author table type. Compile error anywhere else |
:page-description |
Markdown intro block on the type’s list page | non-blank string; collapsed by default, rendered above the Add row via the shared markdown renderer. List mode only — add / edit / view forms never render it. The type must be visible (compile error on :user-setting types — the settings view auto-opens the single-record form so the block could never render — and on non-visible types: :display nil, a base type omitting :display, or :internal t, none of which reach the wire). A :category :settings list type without :user-setting (the secrets shape) carries the key fine; a :page t type may not declare it (the page’s content is the description) |
:page-description-open |
Expanded default for the block | t or nil; requires :page-description (compile error alone). An explicit nil is legal and serializes as false end to end — never dropped, never [] |
| Lifecycle slots | Custom logic | :pre-create :post-create :pre-update :post-update :pre-delete :post-delete; see Hooks |
For author models, use :auto or nil:
:auto: generated SQL path (insert-normal / update / remove-resource, with FS branches when applicable)nil: operation disabled:type-roles ("todo-users")
;; or with explicit permissions:
:type-roles (("models-user" :create :read :update :delete))
String form gets full CRUD permissions when the role is created. Every type that participates in RBAC also receives "admin".
A :type-roles entry gates creating a row of the type (be-insert) and seeing the type (the type selector); operations on an existing row — reads included — are decided by the roles on that row, not by the type resource (be-rec / be-id / be-update / be-action / be-delete are row-level, and the REST endpoints behind them authorize the same way). A list of an ordinary type needs only an authenticated caller and returns exactly that caller’s readable rows; rollups and built-in types keep a type-level list gate (be-list). The backend does not copy :type-roles onto a new row: it attaches only the roles explicitly supplied by the caller, plus "admin" and the creator’s exclusive role. The built-in Add form preselects the type’s roles as a convenience, and the user may change them before submission; an API caller must name any desired row roles explicitly. Consequently, type-level create does not imply update on rows created by others, and a role with :create and :read but not :update can still edit an existing row when that role is attached to the row’s resource. For the operation→resource decision table, the three paths that put a role onto a row, and recipes for common authoring goals, see docs/roles.md.
| Type | Default :type-roles |
Rationale |
|---|---|---|
:users |
("logged-in" "user-creator") |
All authenticated users can read; creators get full CRUD |
:permissions |
("logged-in" "permission-creator") |
Same pattern |
:roles |
("logged-in" "role-creator") |
Same pattern |
:settings |
("settings") |
Gated behind the settings role |
:secrets |
("settings") |
Same as settings |
:saved-views |
("settings") |
Same as settings — a signed-in user, never a guest |
:resources |
(none; internal, no CRUD) | |
:role-permissions / :resource-roles / :role-users |
(none; internal joiners) | |
:tokens |
("admin") via the no-declaration default |
:display nil (hidden from the selector) but not internal, so it still gets a type-tokens resource — and is overridable |
Types with no explicit :type-roles default to ("admin"). The "admin" role is always appended by add-type-roles regardless of what the model declares.
A model may redeclare a non-internal built-in type with only :type-roles; the author’s list replaces the default above (it is not unioned). The redeclaration is a partial overlay — fields, views, and RBAC CRUD functions come from the base model, so you never restate them:
:types
(:items (...) ; ordinary author types
:users (:type-roles ("admin")) ; hide Users from non-admins
:roles (:type-roles ("admin"))
:permissions (:type-roles ("admin")))
Rules (all compile errors via report-e):
:type-roles is the only legal key on a redeclaration (“you may retarget who sees a built-in type; you may not reshape it”). :display included — visibility is :type-roles, and hiding the tab would not close the API.:resources, the three joiners) cannot be overridden. :tokens, :settings, and :secrets can.:type-roles); nil, (), a bare string, or a redeclaration without :type-roles is rejected."admin" is still always granted by add-type-roles.Tightening roles on an existing database does not revoke old grants — add-type-roles only inserts missing resources. Role tightening needs a clean slate (reset-database / fresh deploy); new deploys are correct on first boot.
When the acting user cannot read a palette’s target type (e.g. :users restricted while listing a type with a :target :users field), allowed-values returns an empty palette for that field (key present, value null) and logs a palette suppressed p-log entry instead of failing the parent list / /api/item. A direct be-list on the restricted target still signals.
:new-roles):new-roles (:ai-user ("read")
:bank-admin ("create" "read" "update" "delete"))
Optional top-level key declaring additional roles the model needs. Keys are role-name keywords (downcased to the rbac string, :ai-user → "ai-user"); values are non-empty lists of permission strings from the closed set "create" "read" "update" "delete" — keywords ((:read)) are a compile error.
At set-model time the compiler creates each declared role that does not yet exist, granting exactly the declared permissions. Roles that already exist are never modified — a role an admin has since edited keeps its edits, and redeploying or re-running set-model is idempotent. New roles are auto-assigned to admin (rbac add-role behavior), so they are immediately usable and appear in the Roles UI / assignment palettes.
A declared role does not have to appear in any :type-roles — badge roles (e.g. :ai-user for the model-generator button, which gates on membership, not permissions) are declared exactly so they exist with known permissions. When a declared role is also named in a :type-roles string list, the declared permission list wins over the full-CRUD default that :type-roles would otherwise grant.
Reserved role names ("admin", "settings", "logged-in", "public", "guest", "user-creator", "role-creator", "permission-creator", anything ending :exclusive or prefixed admin: / guest:) are compile errors: they already exist or carry rbac semantics of their own.
:guest-allowed):guest-allowed t
Optional boolean, default nil. When t, POST /api/login accepts the seeded guest user with any password (including blank): the login handler short-circuits password verification and issues normal access and refresh tokens for the guest user id.
t opens the door even if an admin later changes the guest password, and removing the key (or setting nil) closes it again — guest login then requires the actual password.public and guest:exclusive roles, and roles are resolved from the database per request, not baked into the token.add-type-roles are admin-plus-declared-roles only, so without :type-roles (or admin role-editing) that names a guest role, guest sees an empty type selector. That selector is tab visibility, not access: a row whose resource carries public is directly readable by guest through the item / id / value / column / list endpoints even when the type itself is admin-only. Combine with :api-roles (so guest can even reach /api/types) and "public" in a type’s :type-roles (so guest can read that type) for a browse-only guest demo. Row visibility is still per-record: the built-in Add form preselects the type’s roles, so leaving public checked submits it with the insert and attaches it to the new row; the user may change that selection before submission, the backend does not copy :type-roles automatically, API callers must name row roles explicitly, and pre-existing rows need their resources edited./api/public-info (no auth) as guest-allowed (JSON boolean), so the login screen can offer — and the app auto-run — a guest sign-in without further backend support.:api-roles):api-roles ("logged-in" "public")
Optional list of role-name strings, default ("logged-in") (via model-api-roles; the default lives in the accessor, the model plist stays verbatim). Names the roles required by the app-level REST endpoints that have no type to consult: /api/types, /api/info, and /api/css-variables. A request whose user holds none of the roles gets 401.
set-model time (:new-roles / :type-roles roles are created after top-level validation runs, so an existence check would reject first loads). "logged-in" and "public" always exist after database initialization.get-type-roles — /api/insert, /api/upload, /api/validate-field, /api/validate-form); existing-row reads and writes authorize on the row’s own resource, and ordinary lists return the caller’s readable rows (see docs/roles.md → REST entry points)./api/login, /api/refresh, and /api/public-info stay unauthenticated / token-only."public" here does not open any type or row: it only lets the seeded guest user past the app-level gates. Pair it with "public" in :type-roles (see Guest login).:category is an author-facing key, not reserved. Valid values: :user, :settings, :system.
:settings: type appears under the frontend Settings tab (e.g. :secrets):system: Admin / system group:user: main app type selectorIf :category is omitted, it is derived:
| Condition | Category |
|---|---|
:user-setting t |
:settings |
:built-in t |
:system |
| else | :user |
:user-setting t is a stronger flag (one row per user + lifecycle hooks + :suppress-roles). Multi-record types that only need the Settings tab should set :category :settings without :user-setting.
/api/types returns :category so the frontend can group the type selector.
A :rollup t type is a read-only analytical view: no physical table, no DDL/DML, no CRUD. Rows are one per grain record, with measures aggregated in SQL (GROUP BY + SUM/COUNT/AVG), not collapsed in Lisp.
:user-leaderboard
(:rollup t
:grain :users ; one row per user
:type-roles ("leaderboard-viewers") ; the only type-level gate
:filter ((:chores :completed :eq t)) ; only completed chores count
:views (:main (:tables (:users :chores)))
:list-form (:fields t)
:fields
((:name (:source (:view :main :table :users :column :name :agg :first)
:ui (:label "User")))
(:total-points (:type :integer
:source (:view :main :table :chores :column :points :agg :sum)
:ui (:label "Points")))
(:chores-done (:type :integer
:source (:view :main :table :chores :column :id :agg :count)
:ui (:label "Completed")))))
Note the :fields form on a rollup is a list of (field-key def) pairs (not the plist used by table types).
| Key | Meaning | Notes |
|---|---|---|
:rollup |
Declares the type a rollup | t is the sole declaration; :type :rollup / :table nil are compile errors |
:grain |
The grain type-key | must be a type with a physical table; must appear in :views :main :tables and be first (it is the FROM anchor) |
:filter |
Model-declared row predicates | list of 4-tuples; see below. Rollup-only; absent is legal, nil/() are not |
:list-form |
Required | (:fields t) or a non-empty field list; missing / nil / (:fields nil) is a compile error |
Compiler-injected (not author-set): :phase-a-shape :measure (every type compiles with :phase-a-shape :base, :measure, or :page), :suppress-roles t, :display t (default; explicit nil honored), category :user (via the normal derivation), and a single injected :id field: a grain pass-through (users.id, :agg :first), not a column. No :created-at / :updated-at are injected, and the compiled type has no :table-name: a rollup has no physical table.
A rollup has exactly one fact table F. Every real measure (:sum / :count / :avg / :list / :distinct) reads from F; :tables is exactly the path grain → … → F. Compile errors (all report-e):
:first measure):agg :first on a non-grain table (:first is grain-only):tables but not on the path grain → F (extra arm / star):tables (a hop past F):type vs :aggThe default-to-:text rule stands (no inference). Validate against the grain / source column:
:agg |
Required :type |
|---|---|
:first |
equals the grain field’s :type (text pass-throughs may omit) |
:count |
:integer only |
:avg |
:real only |
:sum |
same numeric type as the source column (source must be numeric) |
:list / :distinct |
same type as the source column |
:filterAlways a list of 4-tuples, (table column op value), even for one clause. No singular form, no 3-ary, no sugar. The operator set is separate from the request-time one (:like / :in never appear here):
| Family | Operators | Rules |
|---|---|---|
| Discrete (boolean / text / integer / real / uuid) | :eq, :ne |
value is a real literal matching the column type (any number for real columns — a lexical-rules simple float or integer); booleans are Lisp t/nil; password columns count as text |
| Rolling date (timestamp) | :last-days |
integer 1..1825; ratings.created_at >= NOW() - INTERVAL 'n days' |
| Calendar date (timestamp) | :calendar |
value :month only (the value slot is the extension point) |
:eq / :ne on a date/timestamp column is a compile error. The referenced table must be in :views :main :tables and the column must exist on it. Grain-table clauses are not orphans (they become WHERE); non-grain clauses on the path grain → F bind into every real measure (FILTER), never a global WHERE; that would drop zero-fact grain rows.
:table, type-level :type, :tree / :fs-backed / :is-leaf / :parent-type, lifecycle slots, :write-to, :create / :update / :delete, :add-form / :update-form / :view-form (even nil), extra views beyond :main, author :id, :column t, :button fields, :suppress-roles nil, type-level :user-setting / :is-joiner / :built-in, and on fields: :action, :validations, :compose-string, :compose, :autofill, :source-all, :write-to, :join-table, :target, :identity t. :grain or :filter on a non-rollup type is also a compile error.
Rollups are fully readable. be-list / GET /api/list on a rollup runs measure Phase A: one GROUP BY grain query with aggregates, no per-record RBAC resources, no Phase B hydration. The same paging / sort / filters request surface and the same :total / :sort response shape apply (see List queries).
:filter clauses become WHERE; every non-grain clause binds into each real measure as FILTER (WHERE …) — never a global WHERE on a joined table, which would drop zero-fact grain rows.:sum → 0, :count → 0, :avg → SQL NULL (JSON null; frontend renders “N/A”), :list / :distinct → empty.:total is the live grain-row count (users in a users-grain board), never the fact count.NULLS LAST on :avg (zero-fact rows trail); every measure ORDER BY appends the grain primary key ASC as a stable-paging tiebreaker. The default sort (request sent none, no :default-sort declared) is the first sortable non-pass-through measure, descending; it is what the :sort echo reports. A declared :default-sort overrides this policy.filters on a rollup accept grain-column pass-throughs only: a field whose table is the listed rollup type with :agg :first, or the injected :id. Filters on fact tables, intermediate tables, or measure fields (HAVING) → 400. A bare UUID is rewritten to a grain-id filter — a one-row fetch is be-list with a grain-id filters value.search is rejected on rollups (no :searchable fields exist on a rollup).:scope :user on :main is honored at runtime on the grain table (grain :users → users.id = <you>; otherwise the grain’s :user column).GET /api/list and GET /api/column are allowed; /api/item, /api/id, /api/value, /api/value-id, /api/validate-*, /api/actions, and /api/upload reject it (400), and be-insert / be-update / be-delete on a rollup signal a validation error. The response carries :create / :update / :delete all false, so the frontend renders a read-only board (no Add / Edit / Delete controls).:last-days / :calendar windows compare against the server’s local clock. Timezone-aware windows are a known limitation and are post-MVP.Prose an app user is meant to edit — About page, house style guide, landing blurb — is a row, not model text. An ordinary content type holds the rows (markdown body, an :identity t slug, edited in-app through the normal forms under RBAC); a sibling :page t type is a read-only projection of one of those rows, rendered as a full page in the type selector: no list chrome, no Add / Edit / Delete controls, always expanded, and an empty state (“This page has not been written yet.”) when the selected row does not exist. Tabs stay model-declared — a content row with no page type is just a row, and a second page is another :page t type with another identity literal, not a generated tab. Static :page-description is the author-prose counterpart; a page type may not declare one (compile error — the page’s content is the description). v1 is a read-only projection: editing happens on the content type’s update form; in-page editing waits on the per-field editability machinery.
:pages
(:table t
:create :auto :update :auto :delete :auto :display t
:type-roles ("editor")
:fields (:slug (:type :text :identity t :not-null t :column t :ui (:label "Slug"))
:title (:type :text :not-null t :column t :ui (:label "Title"))
:body (:type :text :column t :ui (:widget :textarea :label "Body"))
:published (:type :boolean :column t :ui (:label "Published")))
:list-form (:fields t)
:add-form (:fields t)
:update-form (:fields t)
:view-form (:fields (:title :body)))
:about
(:page t
:of :pages
:filter ((:pages :slug :eq "about")
(:pages :published :eq t))
:type-roles ("public")
:view-form (:fields (:title :body))
:fields (:title (:ui (:label "Title"))
:body (:ui (:widget :markdown :hide-label t))
:slug (:ui (:label "Slug"))))
(The worked model omits the :source / :column t house idiom every fixture declares on content fields — see any models/test/ fixture for the full spelling.)
:page t is the sole declaration (the :rollup t precedent): :type :page, :table nil, and an explicit :page nil are compile errors, and :page t with :rollup t is a compile error. :of names the content type and is page-only vocabulary (a compile error anywhere else, including on rollups). :of must name an ordinary author table type: present in the model, not the page itself, not a rollup, not another page, not :base / :built-in / :internal / :is-joiner / :tree / :fs-backed. A page of :users or of a directory is out of v1.
Rejected on a page, even as nil where noted: :table, type-level :type, :grain, :views, :tree / :fs-backed / :is-leaf / :parent-type, :user-setting / :is-joiner / :built-in / :base / :internal, lifecycle slots, :write-to, :title-field, :default-sort, :page-description / :page-description-open, :list-form / :add-form / :update-form (key membership — absent :list-form is already structurally list-less, so no suppression mechanism is needed, and the page does not use :hide-list because it has no list to hide), a type-level :children, a type-level :via, and the compiler-owned keys (:table-name, the DDL/DML artifacts, and the computed :page-table / :page-columns / :page-where / :page-params). :create / :update / :delete must be absent or nil; author :suppress-roles nil and :display nil are errors (a page is visible or it is not a page); an explicit :category other than :user is an error — the Home strip is the page surface.
:filter)Row selection reuses the model-level :filter 4-tuple ((table column op value)) with the rollup operator set (:eq :ne :last-days :calendar); every clause’s table must be the :of type. Two rules beyond the shared validator:
:target field declares :type :text while storing a UUID, a :column nil virtual field has no column, and a :join-table field’s storage lives on another table. Every clause column (and every projected field) must be a stored scalar column of :of — an author field with :column t, no :target / :join-table, and type in (:text :integer :real :boolean :timestamp :uuid) — or an injected default field (:id / :created-at / :updated-at, all stored scalars; a :last-days ride-along on :created-at is legal whether or not the page projects it).(of field :eq literal) must be exactly the whole :identity t set of :of: identity columns form one composite unique index, so one pinned column of two guarantees nothing, and a composite identity containing a :target identity field cannot be pinned by a scalar literal at all (compile error naming the field). Clauses that are not identity :eq pins — :eq on a non-identity column, :ne, :last-days, :calendar — are ride-alongs: legal on storage-legal columns, never counting toward the pin. A filter whose every :eq is a ride-along dies as an unpinned identity set.:eq / :ne on a timestamp column is a compile error (the shared validator’s rule); use :last-days / :calendar.
:fields on a page is a non-empty plist of presentation overlays (not the rollup pair-list form): :title (:ui (:label "Title")). Each key names a column on the content type, same name — no renaming in v1. The only author key on a page field is :ui; an omitted :ui does not inherit the content field’s widget (the page author owns presentation) — finalize-ui defaults it to :textbox plus a humanized label. Projectable columns are the same stored scalar set as filter columns; not :password, :file, :button, :list, :target, :join-table, or a virtual field. Author :id and :id named in :view-form are compile errors: the compiler injects :id itself, as a non-displayed pass-through of the content row’s id.
Widgets are a positive allowlist — the finalized widget must be one of :textbox, :textarea, :code, :markdown, :stars, :checkbox, :select, :heading — with content-column type rules: :markdown / :textarea / :code / :heading need :type :text, :checkbox needs :boolean, :stars needs :integer / :real, and :select requires a non-empty static :options list (relation mode needs :target, which a page field cannot declare). :heading renders the field as the page’s headline — a bigger font, no property-sheet row — and is at most one per page (a second is a compile error, not first-wins: a page is title and body, the title is the one heading, and the markdown body makes all the headings it wants). On ordinary types :widget :heading is a compile error (page-only in v1). Anything else in the widget vocabulary is a compile error. :filter-with, :enabled-when, :directory-type, and :table on a page field’s :ui are compile errors.
:view-form is required (the rollup-requires-:list-form precedent — the reader may not hold read on the content type, so the page cannot borrow its forms) and is what renders as the page. :fields on it is t (the page type’s own fields) or a non-empty list naming declared page fields. :hide-list and :children on the view form are compile errors even as nil.
be-list / GET /api/list on a page runs one parameterized select against the content table (select <content>.<col> as <field>, ..., <content>.id as id from <content> where <compiled predicates> limit 2) and returns 0 or 1 record. The SELECT list is capped at the effective View-form projection plus :id — never the full declared :fields when the view form omits one. String / UUID / integer :eq / :ne literals are bind parameters (never embedded in quotes); booleans use truthiness forms (:eq t → bare column, :eq nil → not column, :ne the mirror), and :last-days / :calendar use clock SQL, so a page compiled Monday still filters against now.
be-list’s page shape; the rollup precedent). The content type’s type resource and the content row’s roles are never consulted — an author who writes :filter ((:pages :slug :eq "about")) with :type-roles ("public") has declared that row public by projection; a private row is a row no page selects. See docs/roles.md.filters (including the bare-UUID shorthand), sort, and non-blank search are 400s (a page’s selection is model-declared; page fields are not searchable). limit / offset are ignored — a page is not a page of a list. The frontend knows this: page tabs fetch a bare /api/list?type=<page> URL./api/item, /api/id, /api/value, /api/value-id, the validate endpoints, /api/actions, and writes (/api/insert, /api/update, /api/delete, /api/upload) all reject a page type (400), the way they reject a rollup; /api/column rejects one too (a page is not a column source). A page’s address is the tab: an id on the URL is not a permalink and is dropped on the next URL write./api/types (and the list envelope) carry page-type — boolean, present only when true, never named page (pagination owns the query-param / wire namespaces).:table-name, no DDL / DML, and no :views (:phase-a-shape :page); runtime reads use the compiled :page-table / :page-columns / :page-where / :page-params keys. A page type never appears under /p/ or in the sitemap (public-type-p excludes it); crawlable rendering of a page is a later item. The content type may still be public on its own terms — that is a different surface.:views (:main (:tables (:models :images :ratings))
:tags (:tables (:tags))
:scoped (:tables (:images :users) :scope :user))
| Key | Meaning |
|---|---|
:tables |
Ordered list of type-keys to JOIN (linear/star graphs only; diamond joins unsupported) |
:scope |
View-level row filter. Runtime implements bare :user only |
:scope :userbe-list adds a filter so only rows owned by the current user are returned (via the users join / user id). Distinct from field-level scope.
A plist form of scope is accepted by validation (valid-view-scope) but not implemented at runtime; use the keyword :user.
Compiler injects per view (not author-set): :sql, :aliases, :columns, normalized :scope.
Join emission is deterministic: field declaration order within a type does not affect the generated view SQL. The join walk skips redundant FK edges whose both endpoints are already joined and never re-joins a table that is already in the view (each table joins exactly once, through one edge). Diamond join graphs remain unsupported.
Joiners get no views.
Every list read — be-list from Lisp, GET /api/list over HTTP — accepts the same paging / sort / search parameters and returns the same response shape regardless of whether the type is a normal table type or a rollup. The caller does not choose an execution path; the compiled type declaration does.
be-list keyword arguments| Argument | Default | Meaning |
|---|---|---|
:limit |
20 |
Max records to return. Server clamps any larger value to 200. nil means all rows (no LIMIT clause) |
:offset |
0 |
Records to skip |
:sort |
nil |
(:field :asc) or (:field :desc); direction optional (defaults :asc); nil = no requested sort |
:search |
nil |
Free-text string, ILIKE-matched against the type’s :searchable t fields |
:form |
list-form |
Form key to render (:list-form / :update-form / :add-form) |
:filters |
nil |
List of (type-key field-key operator value) 4-tuples (see below); a bare UUID string is also accepted (single-record fetch) |
Filter operators (operator-sql): :eq :ne :gt :lt :gte :lte :like :ilike :not-like :not-ilike :in :not-in :has-all. :in / :not-in take a non-empty list of the field’s atom type; nil elements are rejected; :eq / :ne nil means is [not] null (translated to IS NULL / IS NOT NULL, no placeholder). :has-all is field-scoped to M2M list fields (every value must be attached; the chip picker’s emission). A filter row may target a joined table’s field (including a join-table field); that pulls the join into Phase A (SELECT DISTINCT id … JOIN …). A target-keyed :in / :eq row — target type key + target identity column, e.g. (:users :name :in ("admin")) — compares display values directly against the joined target table; that is the row the reference chip picker and list-cell chips emit. :eq / :ne on a singular :target field of the listed type (no :join-table) compares the FK storage column: a non-UUID display name resolves to the target row’s UUID (resolve-reference-id), a UUID-shaped string binds as a UUID without an existence check, null keeps IS NULL / IS NOT NULL, and no join is pulled in. An unknown non-UUID display name is a validation error there (the reference picker must not replace its target-keyed :in row with this row — that guidance stands: the chip row is the picker’s emission, and its unknown names match zero, not 400).
(be-list :todos "admin" :limit 20 :offset 40 :sort '(:name :desc)
:filters '((:todos :done :eq :false)))
List chips (filter, then open): a click on an unhighlighted list-cell chip applies its filter (:has-all on M2M fields, a target-keyed :in on :filter-with :reference fields); a click on a highlighted chip showing the arrow glyph opens the record behind the chip’s value — the tab switches to the target type and the record’s view form opens, the filter untouched; a click on any other highlighted chip (no arrow) removes that filter, and so does a click anywhere on a chip in the filter region. The arrow is the rule the user learns, and the two chip families earn it differently: a reference chip shows the arrow whenever the row carries the target id — a target row the viewer cannot read still shows it, and the open lands on the record-not-found error, exactly the view form’s target-link behavior — while an M2M chip shows it when /api/value-id resolves the value to exactly one row the viewer can read (no match, an unreadable row, or more than one match means no arrow; see the :checkbox-list bullet and the :filter-with row below). The arrow promises the next click opens that record — a chip with no arrow behaves exactly as before. Back from the opened record returns to the filtered list, filter and highlights intact.
/api/list query parameters| Param | Default | Meaning |
|---|---|---|
limit |
20 |
Non-negative integer; clamped server-side to 200 |
offset |
0 |
Non-negative integer |
sort |
— | "field:asc" / "field:desc"; direction optional (defaults asc). Unknown field, non-:sortable field, or bad direction → 400 |
search |
— | Trimmed; blank/whitespace-only ignored; silently clamped to 200 characters |
:total and :sortEvery successful be-list / /api/list response carries:
:total — always present, the pre-paging count of matching records (RBAC + scope + filters + search applied, no LIMIT/OFFSET). May exceed the number of returned records.:sort — the effective sort as {"field": "...", "dir": "asc"|"desc"} (JSON), or JSON null:
:default-sort declaration, when none was sent and the type declares one;desc);null when none was sent, the type declares no :default-sort, and it is a base (non-rollup) type;:sort default and the echoA type may declare :default-sort (see the type-key table above). When a request sends no sort, that declaration applies on both base and rollup types; an explicit request sort always wins. The :sort echo always reports the effective sort (request, declaration, or rollup policy), never the tiebreaker, so the frontend paints the applied order without asking. The declaration also orders every allowed-values FK option list targeting the type: the palette reader applies the same ORDER BY a be-list read of the target would.
Authorization → RBAC read permissions → view scope → request filters + search → sort → page. Filtering always runs on the id-selection query, never on the collapsed result; paging is the last step. The authorization step is category-gated: rollups and built-in types require read on the type resource (rollup rows have no resources; built-in types keep their system contracts — a denied list is a validation error), while an ordinary author-defined type needs only an authenticated caller and proceeds straight to the RBAC row filter, so the result contains exactly the rows that caller can read — possibly none, which is a successful empty result, not an error.
List reads on ordinary table types run in two phases:
WHERE / ORDER BY / LIMIT / OFFSET — fast and indexed. Joins appear in Phase A only when filters reference joined tables or the sort field is a :target field, in which case it becomes SELECT DISTINCT id FROM … JOIN …; with a sort, the ORDER BY column joins the SELECT DISTINCT projection, :total counts COUNT(DISTINCT id), and the base id stays the tiebreaker before paging.WHERE id = any($1::uuid[]) — the ids travel as one bind parameter, as the readable-id filter of Phase A does) and collapses join fan-out into one plist per record in Lisp (:agg :first, :list, :distinct…).Collapse is not paging. Collapse reduces fan-out rows to one record per id; it is a display-shaping step, not a result-limiting step. Paging happens entirely in Phase A; the count query runs the same predicates without ORDER BY / LIMIT / OFFSET.
On rollup types, the same request surface is served by measure Phase A (GROUP BY grain) instead — same be-list contract, no Phase B.
:sortable field, or invalid direction → 400search on a type with zero :searchable fields → 400 (rollups compile to zero searchable fields, so they reject search)limit / offset → 400REST-specific details (auth, error envelope) live in docs/rest.md → GET /api/list.
Under :fields, each entry is field-key → plist (except joiner :reference entries; see Join tables).
Reserved field keys: :update, :delete, :hide-list, and :public-url are reserved — the first two collide with the per-record capability flags injected onto every record, :hide-list with the form option fe-fields appends beside the field entries in each form object, :public-url with the public-page permalink be-list / be-rec decorate on records of a public type (see Forms and Public pages). A same-named author field is a compile error with a rename message.
| Key | Meaning | |||
|---|---|---|---|---|
:type |
Field type keyword (see below). Compile default: :text |
|||
:ui |
plist passed through to the frontend. Required for a column to participate in insert/update SQL and for fe-fields emission (needs :widget) |
:column |
t → physical DB column. Forced t if :target; forced nil if :type :button |
|
:default |
Default value. Booleans: :true/:false. Timestamps: :now. UUID: :generate-uuid |
|||
:not-null |
DDL NOT NULL. Optional on :target fields (see Foreign keys) |
|||
:unique |
DDL UNIQUE |
|||
:identity |
Natural-key participant. See Identity fields | |||
:compose |
Format string for server-side field composition. See :compose |
|||
:required |
Legacy: if truthy, compiler prepends #'v-required. Prefer :validations (:required) |
|||
:validations |
list of validation hook forms | |||
:source |
how to read the field from a view | |||
:source-all |
options source for select / checkbox-list (allowed-values) |
|||
:join-table |
M2M joiner type-key; field is a virtual list | |||
:target |
FK to another type (UUID + ON DELETE CASCADE). Display value resolved via target identity. Table creation is dependency-ordered; declaration order does not constrain FK targets |
|||
:write-to |
write-through spec (see Write-through) | |||
:autofill |
currently only :user → current username at write time |
|||
:force-sql-name |
override generated column name string (e.g. "rating_user") |
|||
:path |
marks the FS path field on fs-backed types (at most one per type) | |||
:action |
only on :type :button; single action hook form |
|||
:sortable |
t → field is eligible for ORDER BY in list queries (clickable header). Base (non-rollup) types: only valid on :column t fields; compiler emits a sort index when no covering index exists. The compiler injects :sortable t on :created-at / :updated-at for every non-rollup type — an author need not declare it (restating :sortable t inside an otherwise valid override is a legal no-op; a bare (:created-at (:sortable t)) without :ui is still a compile error; an explicit :sortable nil on either timestamp is a compile error until Model value vocabulary lands :false). Rollup types only: the :column t rule is relaxed — pass-throughs and :sum / :count / :avg measures are legal; :list / :distinct measures are a compile error. On a hybrid (regular type with aggregated fields) :sortable t on a Phase B measure stays a compile error. Compile error on :target (FK) fields of a base type only when the relaxed rule does not hold: :sortable t on a :target field sorts the list by the target’s joined display column (Model Bank :models Owner), not the stored UUID; legal only when the field’s display :source names the target’s table, the target is in the type’s :main view :tables, the field neither shares its target with another singular :target field on the type nor targets its own type, the display source resolves to a real column of the target (the source view lists the target and the column is one of its column fields — :id and timestamps included, M2M fields such as :users’ :roles not), and the target is not :resources (the injected :id field’s edge would claim the join) — each a compile error otherwise (the join walk joins every table once, so those sorts would follow the wrong row, or no column at all); no sort index is emitted for a :target field (the ORDER BY column lives on the joined table) |
|||
:searchable |
t → column is included in free-text :search (ILIKE OR-group in Phase A). Only valid on :type :text base columns without :target. Independent of :sortable. Distinct from type-level :search-sql (write-through identity lookup). Serialized as a JSON boolean (true/false, never []). See List queries |
|||
:default-from |
:user → copy username when creating user-setting rows |
|||
:css-value |
t → included in CSS-vars API (e.g. settings :dark-mode) |
|||
:primary-key |
DDL primary key (injected on :id) |
*field-types*):type |
General | SQL | Storage / behavior |
|---|---|---|---|
:text |
:text |
text |
ordinary string column |
:password |
:text |
text |
hashed on write; omitted from update payload if absent |
:real |
:number |
real |
|
:integer |
:number |
integer |
|
:boolean |
:boolean |
boolean |
values :true / :false |
:uuid |
:text |
uuid |
|
:timestamp |
:text |
timestamp |
|
:list |
:list |
(none) | virtual M2M list via :join-table |
:file |
:text |
(none) | upload token flow; excluded from list-form |
:button |
:button |
(none) | control only; requires :action |
:source:source (:view :main
:table :ratings ; optional; default = owning type
:column :rating ; required when source is present
:agg :first ; aggregation
:scope :user) ; optional field-level scope
If :source is omitted but :column t, the compiler defaults to:
(:view :main :column <field-key> :agg :first)
:agg values (aggregate-values in backend):
| Agg | Result |
|---|---|
:first |
first non-null |
:list |
list of non-null |
:distinct |
distinct non-null |
:avg |
float average |
:sum |
sum |
:count |
count of non-null |
For M2M list fields (:type :list + :join-table), the row-display :source :agg must be :distinct — it is a compile error to write any other value there (see Join tables (M2M)).
:source (... :scope :user :agg :first)
Filters aggregated rows to the current user’s UUID (via the view alias of the source table’s :user field). Used for “my rating” style fields.
M2M list fields (:type :list + :join-table) have set semantics: the row-display :source :agg must be :distinct (omitting :agg is allowed — the compiler fills :distinct; writing :list or any other agg is a compile error). :source-all keeps :agg :list. A flat LEFT JOIN view with two or more one-to-many arms yields the cross product of the arms, so :agg :list duplicates every value; see M2M row-display is :distinct.
Does not control field visibility or editability in the UI.
Requires the source table to expose a :user field in that view’s aliases.
:source-allSame shape as :source. Feeds allowed-values for dropdowns and checkbox lists (distinct from the row-display :source). Runtime prefers :source-all when present, otherwise falls back to :source.
:source (:view :main :table :tags :column :name :agg :distinct)
:source-all (:view :tags :table :tags :column :name :agg :list)
allowed-values-for-field reads :table and :column from that plist and loads the options from the related type. Simple targets (no view-level :scope, :default-sort not on a :target field, display column a stored local text/integer/real field in the target’s :list-form) are read with one ordered column query restricted to the readable ids — the same rows in the same order a be-list read of the target would show, minus everything but the display column. Scoped, join-sorted, rollup, and computed-display targets fall back to be-list-column on the related type. The plist’s :view is not used either way. Authors should still set both as in todos/modelbank: :source for row display, :source-all for the options contract. Preferring :source-all alone does not break bidirectional M2M (recursion is handled by the :skip-allowed-values flag in the backend, which the fallback path uses).
For M2M list fields, the column used for options and join lookup must be the single identity field of the related type (see Identity fields).
:ui subkeysThe :ui plist is passed through to the frontend verbatim (plus a few keys injected by fe-fields). The key set is closed (*ui-keys* in lisp/model.lisp): an unknown subkey is a compile error naming the key and the legal set. Per-key value rules: :label must be a string, :read-only and :hide-label must be t or nil, :help must be a non-blank string, :precision must be a number (a lexical-rules simple float or integer literal), :table must be a keyword, :filter-with must be :boolean, :reference, or a plist (:kind <kind> [tail]) (:boolean takes an optional :default :true | :false; the :reference tail is empty), :enabled-when must be a non-empty list of (<field> <op> <value>) rows (see the row in the table below).
| Subkey | Values / meaning |
|---|---|
:label |
display label string (auto-generated from field key if omitted) |
:widget |
:textbox | :textarea | :code | :markdown | :stars | :select | :search-select | :file | :file-path | :checkbox | :checkbox-list | :password-new | :password-read | :hidden | :button | :image | :image-list | :heading |
:read-only |
boolean (t / nil); renders display variant instead of editor |
:hide-label |
boolean (t / nil, default shown); suppresses the field label on Add, Edit, and View forms when the value is self-evident (a blog body needs no “Body” heading). Legal on any widget. List column headers always show the label. Wire form "hide-label": true (an explicit nil serializes false, not []) |
:help |
non-blank string of markdown; help text rendered beside the field label on Add / Edit / View forms via a click-to-toggle “?” button (collapsed by default; inline code for option names, bullets for choices; Esc and click-outside close the panel). Compile error together with :hide-label t — the icon anchors to the label. Legal on every widget, including inert cases: :widget :hidden fields never reach the wire and help on a rollup field never renders (rollups have no add/update form and list headers ignore it) — both are legal, documented, not rejected. List column headers ignore :help (the list-form payload still carries it, verbatim passthrough). Wire form "help": "<markdown>" |
:precision |
number; JavaScript toFixed for numeric display (e.g. average rating) |
:options |
list of non-empty strings; static dropdown values (requires :widget :select) |
:table |
keyword; overwritten on the wire by fe-fields from source table / type-key; used for /api/file URLs. Still authorable (compile-checked as a keyword) but normally left out |
:filter-with |
:boolean or (:kind :boolean [:default :true \| :false]) — legal solely on a :type :boolean field with :column t; renders a three-state Any / Yes / No select on the list toolbar. Yes/No sends an :eq filter with the string ":true" / ":false" (parse-filters coerces these to the keywords on boolean fields). :default is optional — it seeds the select’s initial state on first entry to the type (and Clear filters restores it); omitted means Any, and :default :any itself is a compile error (Any is unspellable). Wire forms: "boolean" vs {"kind":"boolean","default":true}. The default is frontend initial state only — /api/list without filter rows returns everything. :reference or (:kind :reference) (empty tail — every tail key, not just :default, is a compile error; a reference filter starts unfiltered, no :default analogue) — legal solely on a :target field (no :join-table) that the list form includes (compile error otherwise; M2M fields get automatic chip filtering instead). Renders the list-toolbar chip picker over the field’s allowed-values palette and the field’s list-cell value as a click-to-filter chip (a NULL FK renders the plain cell); the picker emits one target-keyed :in row per field — [["users","name","in",["admin"]]], first element the field’s :target type key, second the target’s identity display column (the wire :column) — union within the field (a single-value FK has no intersection reading), AND across fields except two reference fields sharing one target, which compare the one shared join column against both IN lists (distinct selections typically match nothing; per-field same-target rows are not expressible in v1 — the fix is the joined-column-aliasing relaxation, post-MVP) and with M2M chips (which keep :has-all intersection within their own field). For cell chips to match rows, the field’s :source must display the target’s identity column — cell chips filter on the displayed value — and :source-all must agree so the picker’s palette holds the same names; a :source pointing at any other column renders chips (and palette entries) that do not reliably identify the referenced row — zero matches, or wrong matches when a displayed value coincidentally equals another row’s identity; nothing in the compiler enforces the agreement yet. Values are display names compared directly against the joined target table — nothing resolves them, so an unknown name matches zero rows, never a 400. Do not “fix” the row into a listed-type row ([tasks,assigned-to,in,…] names a display column the join-free base SQL never joins — Postgres 42P01) or a resolve-reference-id story (that is the write path’s mechanism). A highlighted reference cell chip also opens the referenced record in its type’s tab — the click navigates instead of unfiltering, through the record’s own "<field>-id" list sibling (each row’s FK, so two rows showing the same display value open their own records; suppressed shapes — two FKs to one table, self-FK — emit no sibling and stay filter-only, no arrow; an unreadable target row still shows the arrow — the open lands on the record-not-found error, like the view form’s target link). Wire forms: "reference" vs {"kind":"reference"} |
:enabled-when |
non-empty list of (<field> <op> <value>) rows, legal solely on :type :button fields. Gates the button by record state: the frontend renders it disabled and be-action rejects (validation error, checked before "running" is stamped) when any row fails. Operators (v1 closed set): :eq :ne :gt :lt :gte :lte :in :not-in; :like family / :has-all are rejected as deferred. Rows are AND-composed (appending a row only restricts). :eq/:ne with an empty literal ("") compare against the single empty class — nil, :null, or "" — so (:model :ne "") disables until a model is set and (:model :eq "") is its mirror; ordering ops fail closed on type mismatch; :in/:not-in take non-empty literal lists. A row naming a field absent from the record or holding NULL fails the row (fail closed). The typical gate targets the button’s status companion — (:complete-status :ne "complete") disables only after a successful run; "failed: …" keeps the button live (the re-run recovery path) — but any field on the type works (gate the status companion, not a :completed boolean, so failed runs stay re-runnable). Wire form (keywords serialize as strings): "enabled-when": [["complete-status","ne","complete"]]. :enabled-when is the one dual-consumed :ui subkey (backend enforcement + frontend disable); the rest are presentation-only |
:directory-type |
keyword; required with :widget :file-path (and only legal there — the :options/:select precedent). Names the type whose rows fill the widget’s folder select; must name an existing type in the model (compile-checked). The frontend reads that type’s list form for the :path t field (the folder column — schema-derived, not assumed to be :name) and lists it via /api/list, so options are exactly the directories the current user can read; / is always offered and is the default when the path is empty. No filtering beyond what /api/list already enforces |
Widget semantics:
:textbox: single-line <input type="text">:textarea: multi-line <textarea> (~8 rows, resizable):code: monospace <textarea> (~12 rows):markdown: renders the value as Markdown (react-markdown + remark-gfm: tables, strikethrough, task lists, autolinks) in list cells and View mode; Edit and Add stay a plain :textarea (~8 rows, same as :textarea). Legal only on :type :text + :column t fields, never on :target fields (compile error; rollup fields are covered by the column rule — a rollup has no table). No raw HTML (default escaping, no dangerouslySetInnerHTML — anyone with update permission writes the field, so XSS would be privilege escalation); links open in a new tab (target="_blank" rel="noopener noreferrer"). List cells clamp to ~4.5em with overflow hidden (the :code treatment; View mode is the reading surface); an empty list cell renders nothing, an empty View renders an em dash:stars: interactive StarRating (editable) or static (read-only / list):checkbox: single boolean checkbox:checkbox-list: multi-select from allowed-values; the frontend adds client-side search once the option set reaches 10. On list views, chip-filterable fields (the same widget, joined table) also offer a searchable per-field chip picker fed by allowed-values (its search box appears once the option set holds 9 or more values — the forms’ threshold of 10 or the panel’s 8-row cap hiding rows, whichever binds; the panel stays open across picks and applies each one immediately), applying the same has-all filter a cell chip applies — M2M chips keep emitting has-all (intersection within the field, unchanged); the reference picker’s target-keyed :in row is the union spelling, and both operators stay wire-legal for direct API use. A highlighted list-cell chip on a join-table field also navigates: when its value resolves through /api/value-id (on the field’s wire record-lookup key) to exactly one row the viewer can read, the chip shows an arrow and the click opens that record in its type’s tab; otherwise — no match, an unreadable row, or more than one match — it behaves as before: no arrow, the click unfilters:select: <select> dropdown. Two modes:
allowed-values via :target (foreign key). Requires :target + :source + :source-all.:options (a list of non-empty strings). Requires :ui (:widget :select :options (...)). No :target or :join-table. The stored value is the option string itself. See models/test/static-select-test.lisp for an example.:widget :select with neither :options nor :target is a compile error (empty dropdowns are not a valid mode).:search-select: searchable single-select picker for :target fields — the single-select twin of :checkbox-list’s search, with the same selected-above / search / unselected-below anatomy; radios (mutually exclusive options, the selected section capped at one row) in place of checkboxes. Opt-in for large target tables (:select stays the default rendering). Client-side filter over the same allowed-values palette :select consumes (v1; server-side palettes are post-MVP). The current selection always renders in full above the list as a checked option row (even when absent from the palette); search box at ≥10 options; scroll box capped at 100 rendered rows with a “N more — type to narrow” hint. Picking an option below moves it to the top row and drops the old selection back into the list. Clicking the checked option (or its ✕) clears the value only when the field is nullable: fe-fields emits :not-null as a JSON boolean, and clearing submits JSON null, which arrives as Lisp nil and writes SQL NULL (resolve-reference-id). Required (:not-null t) targets get no clear path at all, same as today’s <select>. Requires :target (compile error otherwise); static :options is not legal here (the :options + :search-select combination signals in valid-options-value — static lists stay :select).:file: file input + two-phase upload:file-path: folder select + editable filename, for the :path t field of an fs-backed leaf type. Splits the stored path at the last / (folder = everything up to and including it, filename = the remainder), joins them back on every change, and submits the same one-string value a :textbox submits today — the API is unchanged. Folder options come from /api/list on the :directory-type type (default /, always offered); the filename is prefilled from the basename of the sibling :widget :file field’s picked file and stays editable. Requires :ui (:widget :file-path :directory-type <type>); see :directory-type above:password-new: masked input + confirmation box for creating / replacing a stored secret; on edit forms an untouched (blank) value means “keep current password”; autoComplete="new-password":password-read: single masked box for typing an existing secret that is not stored by this form (e.g. settings Current Password); no confirmation, no placeholder, autoComplete="current-password":button: action button (update form only):hidden: omitted from form entirely:image: display thumbnail (always read-only for MVP):image-list: display thumbnail grid (always read-only for MVP)Compiler default injection (missing keys get safe compile-time defaults):
:widget → compiler injects :widget :textbox:read-only on :image or :image-list → compiler injects :read-only t (both are display-only for MVP):read-only nil on :image or :image-list → compile error (editable image widgets are post-MVP):label (when :ui is present) → humanized field key: split on - / _, title-case each word, join with spaces (e.g. :average-rating → “Average Rating”, :name → “Name”):hidden is never implied by omission; it must be set explicitlyAbolished keys and values (compile-time errors if present):
:input-type: renamed to :widget:render-as: deleted; presentation derives from :widget:form-control: rejected name; never shipped:line as a widget value: use :textbox:text as a widget value: use :textarea:password as a widget value: split by intent — :password-new to create/replace a stored secret, :password-read to collect an existing one (the field type :type :password is untouched):read-only as a widget value: use :read-only t boolean flagNotes:
:widget :hidden → excluded from fe-fields:widget :button is required on button fields so the FE renders a control:target):user
(:type :text
:autofill :user
:force-sql-name "image_user"
:ui (:label "Owner" :widget :textbox :read-only t)
:target :users
:source (:view :main :table :users :column :name :agg :first)
:source-all (:view :users :table :users :column :name :agg :list)
:column t :not-null t)
uuid with references … on delete cascade:identity t field:name), not the UUID:autofill :user fills the current username on insert:not-null is optional: the compiler respects the author’s :not-null setting on :target fields. Set :not-null t for a required FK (the common case); omit it (or :not-null nil) for a nullable / optional FK reference. When :not-null is absent, the generated DDL omits NOT NULL, and the backend accepts nil / :null values on insert and update (writing SQL NULL). Validation (v-type, value-type-p) also passes nil for nullable fields without complaint.:type :list + :join-table); the join table can be empty, so the relationship is naturally optional.:sortable t sorts the list by the target’s display column through the FK join — Model Bank’s :models Owner header — not by the stored UUID. The target must be in the type’s :main view :tables and the display column must resolve on the target (full rule in the :sortable row); NULL references sort last ascending, first descending.:identity t marks natural-key participants. Behavior depends on how the type is used:
| Use | Multiple :identity t fields? |
Mechanism |
|---|---|---|
| Uniqueness / write-through search | Yes: all identity columns form one composite unique index ix_<table>_identity |
create-table-sql, search-sql, identity-keys |
Type is a :target of an FK |
No: exactly one identity field | valid-target (compile error otherwise) |
| Type is the other side of an M2M list | No: join insert/update resolves checkbox values via identity-field → single key, then list-ids |
insert-join-table-rows, update-join-tables |
One narrow storage-edge exception to the :target rule: a pre-rename :reference field declared on the internal joiner type (the (:reference (:target …)) idiom, before compile-fields renames it) may target a type with zero author-declared identity fields — the joiner row stores bare UUIDs and no display resolution ever runs on that edge. A field merely named :reference on an ordinary type does not qualify, a joiner :reference to a multi-identity target still fails, and an ordinary :target to a zero-identity type is still a compile error. The blog’s :post-tags joiner (references to zero-identity :comments and identity-carrying :tags) is the canonical case. This is not a display path onto comments: fe-fields is unchanged, and a later ordinary :target to a zero-identity type remains illegal.
Separately, a join-table list field whose :source :table other side has zero identity fields is a compile error at the compile-field join-table validation point:
Join-table list field :COMMENTS on :TAGS requires an identity field on other side :COMMENTS; got zero identity fields
Without the guard, identity-field returns nil and the existing list-ids / be-value-id validation fails at runtime as “Invalid field key NIL”. This is not a generalized M2M zero-identity list-value contract: insert-join-table-rows and unknown-values retain their identity-field calls, no source-column write-resolution change exists, and no zero-identity round trip is promised.
Composite identity is real (Model Bank :ratings uses :book + :user both :identity t). That works because ratings are matched by write-through search, not by a single display string in a checkbox list.
Referenced types need a scalar display identity. If authors (or any type) appear in another type’s :type :list / :join-table field or as a :target, they must have exactly one :identity t field. That field’s values are what the UI sends and what the backend looks up.
Do not mark only :last-name (or any non-unique part of a name) as identity when the type is M2M-referenced: the unique index is then on that column alone, so two “Cameron” rows collide (23505 on ix_rt_<type>_identity), and the checkbox list cannot distinguish them.
Workaround for structured names (first / middle / last):
:name = “Donald Roy Cameron”). Optionally keep first/middle/last as ordinary non-identity columns if you still want them on the form.Composed identity field (preferred for structured names): keep the parts as ordinary fields and add a stored identity field whose value is composed server-side via :compose. The compiler synthesizes :compose-string lifecycle hooks for :pre-create and :pre-update that build the composed value before validation and write:
:first-name (:type :text ...)
:middle-name (:type :text ...)
:last-name (:type :text ...)
:full-name (:type :text :identity t :unique t :not-null t
:compose ":first-name :middle-name :last-name"
:ui (:label "Full Name" :widget :textbox :read-only t)
...)
See :compose below for the format language and constraints.
Rule of thumb: if another type’s list or select must point at this type, give it one unique identity string. Use composite identity only for types that are write-through targets (or otherwise searched by full identity key sets), not for checkbox-list labels.
:composeThe :compose field attribute is sugar for the :compose-string lifecycle hook. It lets the compiler build a stored field value from other fields on the same type, most commonly to create a single composed identity string from structured parts (e.g. full name from first / middle / last).
:full-name (:type :text :identity t :unique t :not-null t
:compose ":first-name :middle-name :last-name"
:ui (:label "Full Name" :widget :textbox :read-only t)
:source (:view :main :column :full-name :agg :first)
:column t)
The :compose value is a template string using the same format language as :compose-string:
:first-name, :last-name, etc.nil, or :null placeholders become empty string.For each field with :compose, the compiler synthesizes :compose-string forms and appends them to the type’s :pre-create and :pre-update hook lists after any author-declared hooks. The composed value is therefore available to validation and written to the database like any field value.
:into target is the field itself; no separate :into needed.:compose template may not reference itself.:compose and the same field is targeted by a manual :compose-string hook (via :pre-create or :pre-update), compilation fails.:compose-string (alternative)For cases needing more control (e.g. composing into a field from a different hook, or conditional logic alongside composition), use the :compose-string lifecycle hook directly on :pre-create / :pre-update:
:pre-create (:compose-string
:format ":first-name :middle-name :last-name"
:into :full-name)
See docs/hook-registry.md → Registered Lifecycle Hooks for the full :compose-string contract.
:add-form: omit the composed field. The server builds it from the parts; showing it is redundant and it has no value until save.:update-form: include the composed field with :read-only t so users can see the derived value but not edit it directly (editing would be overwritten on the next save).:list-form (:fields t)
:add-form (:fields (:name :description :model))
:update-form (:fields t)
:view-form (:fields (:title :body))
Keys under each form: :fields selects fields; :hide-list suppresses the list; :children declares the embedded child region (:view-form only — below). The closed set is (:fields, :hide-list, :children); any other key is a compile error. :default-sort may ride :list-form (the tab spelling) and is validated there by valid-default-sort; on the other forms it is a compile error:
| Value | Meaning |
|---|---|
t |
all eligible fields |
| list of keywords | explicit set; :id is always prepended by form-field-keys |
| absent / nil | no form |
:hide-list t (sibling of :fields, legal on :view-form / :update-form / :add-form only — compile error on :list-form, even as an explicit nil) suppresses the list table, the pagination, and the record count while that form is open: the public reader of a post has no business seeing the table, and half-hidden chrome would look broken. Omitted means show (the writing-aid default keeps the table under an open form — the shape of an ISBN, a date, the last post is guidance). The key is per form, not per type, and not view-only: view and edit of the same type can disagree (an author adding a post may want the last one underneath — forbidding the key on add/update would make a focused editor unspellable), and an explicit :hide-list nil is a legal show that survives the wire. The tab with no form open still shows the list — that is what keeps a :posts type a list type rather than a page type. A page type does not use it; it has no list. A declaration on a type whose form never opens is inert and legal.
fe-fields)A field is emitted when:
t or explicit list; non-base :roles always eligible when shown on :add-form / :update-form — never :list-form, never :view-form):ui :widget (or is injected roles):hidden:list-form and :type :file):list-form, :add-form, or :view-form and :type :button)Buttons appear on the update form only (an explicit :button in a view-form field list is compile-legal, v1 unused — the wire excludes it).
If an explicit :update-form lists a button field, the compiler auto-appends the companion :<button>-status field (augment-update-form). A view form gets no auto-append; under :fields t the status companions land in the view form (accepted feature — a read surface showing a deploy outcome is desirable), and a view form that wants one names it.
Emitted field meta includes :default, :path, :table, and the full :ui plist.
:view-form specificsAbsent :view-form means no view surface — the frontend row click opens a record only when the /api/list payload carries view-form; the View form’s Edit button renders only when the fetched record’s update flag is true (row-level — a creator can edit rows their role sits on without type-level update); there is no fallback to update-form or list-form (same uniformity as absent :add-form meaning no Add surface). Payload presence ⇔ declaration: fe-fields emits :view-form only for types that declare it, so an undeclared type’s payload stays byte-identical. Rollup types must not declare it (compile error; only :list-form is legal there). A view form may declare :hide-list t so a reader opening a record does not see the table; the list returns on close.
:children, view-form only):posts (:table t ...
:view-form (:fields (:title :body)
:hide-list t
:children ((:type :comments
:via :post
:sort (:created-at :asc)))))
:children embeds one child region in the parent’s reading form (the blog comments-under-post surface). Legal only on :view-form — the same key on :add-form / :list-form / :update-form is a compile error even as an explicit nil, and a type-level :children (with no :view-form) is the missing-:view-form compile error. The value is a list of exactly one region spec plist; zero, two, an atom, a dotted list, or a non-plist spec are compile errors. :hide-list t is a required companion on the same :view-form (an explicit :hide-list nil is the same error — key membership, not truthiness).
Spec alphabet (v1): :type (required, the child type), :via (required, the child’s FK field), :sort (optional, the request-sort shape — (:field) or (:field :asc|:desc); an omitted direction is legal, a present nil direction is a compile error for :children :sort and type-level :default-sort alike). :sort validates against the compiled child in a post-stage-1 cross-type pass (validate-model → stage-1 → valid-children, which returns the compiled model), because stage-1 compiles each type against the raw model and a child’s injected :sortable t on :created-at is not visible during the parent’s own compile. The omitted default is (:created-at :asc) and is deliberately not validated in that pass (injected timestamps are sortable on every legal type; a present :sort naming another field is what the shared valid-sort-declaration checks).
Parent/child surface contract (compile checks, not doc hopes — valid-children-region-surface): both sides need a declared non-nil :list-form (the parent’s because App.tsx returns its no-data shell without one; the child’s because it is both the tab the escape hatch opens and the collapsed-row column set the region renders — the app’s region columns honor the child’s :list-form :fields, the public page region renders through the child’s :view-form), truthy :display and non-internal compiled defs (the model-side half of be-types’ visibility gate; per-user RBAC allowed remains runtime), and compiled :category :user (per compute-category: explicit :category wins, :user-setting → :settings, :built-in → :system, everything else :user); the child additionally needs declared non-nil :view-form and :add-form (fe-fields emits only declared forms; the region renderer has no update-form fallback). :via names a singular :target field on the compiled child whose target is the declaring parent, with no :join-table — anything else is a compile error, and a stray type-level :via (which survives compilation) is rejected. :children is not legal on tree / fs-backed types: the tree vocabulary uses :parent-type and must never grow a :children key (a compile check, not a doc line).
Wire: the spec rides be-rec’s :view-form payload beside :fields (never rec, never list-result, never fe-fields), triple-guarded — inside the record guard, only for :view-form, only when the type declares :children. :type / :via go out as downcased strings and :sort as a two-element string pair (an omitted or direction-less sort normalizes to ("created-at" "asc")); plist-to-json emits:
"children":[{"type":"comments","via":"post","sort":["created-at","asc"]}]
The string pair — never a sort plist, which would serialize as {"field":"dir"} (the json-sort-echo trap) — is what 03’s region fetch builds its fk-eq tuple and request sort from. The compiled def keeps the author spec verbatim (omitted :sort stays omitted); normalization happens at attach time only. Between 02 and 03 the key is inert by design: nothing consumes it until the region renderer lands.
Panel widgets: the region’s Add/Reply panel renders every widget fe-fields can emit on an add-form with the main Add form’s markup and semantics — select, search-select, checkbox, checkbox-list, code, file + file-path (the two-phase upload: POST /api/upload for a file-token, then POST /api/insert carrying it), password-new with its confirm box, password-read, beside the original hidden, read-only, markdown / textarea, stars, and textbox. That is the panel’s widget alphabet — a different alphabet from the region spec alphabet above (:type / :via / :sort), which it does not change.
Virtual list field on the owning type:
:tags
(:type :list
:ui (:label "Tags" :widget :checkbox-list)
:validations (:join-items-exist)
:source (:view :main :table :tags :column :name :agg :distinct)
:source-all (:view :tags :table :tags :column :name :agg :list)
:join-table :todo-tags)
On :type :list + :join-table:
:source :agg must be :distinct (omit :agg and the compiler fills :distinct):source (... :agg :list) is a compile error:source-all stays :agg :list (dedicated single-table view; no fan-out):agg values on that :source are compile errors:distinct even on a one-joiner view (todos tags) so a later second arm does not duplicate values:checkbox-list above) looks each chip’s displayed value up in the :source :column column itself — like with like — so declare the target’s single, unique-indexed identity column there: a non-identity display column still navigates exactly while its values are unique, but a duplicated value is non-navigable (no arrow — be-id’s more-than-one-match), never a wrong linkJoiner type:
:todo-tags
(:table t :is-joiner t :internal t
:fields
(:reference (:target :todos)
:reference (:target :tags)))
:reference is rewritten to :<singular-target>-id (e.g. :todo-id, :tag-id):internal t on joiners is conventional but redundant (:is-joiner defaults internal):chore-tags and :chore-users). Each joiner’s insert/update/delete SQL is isolated to its own two FK columns. List field keys need not match the target type key; :source :table identifies the other side (e.g. :completed-by → :users).:distinct (fan-out duplicate guard)The compiler enforces the rule above: on any :type :list field backed by a :join-table, the row-display :source :agg must be :distinct (:list or any other value is a compile error; an omitted :agg is injected as :distinct).
Why the rule exists: when a type’s :main view includes two or more one-to-many arms (e.g. :chores joins both chore-tags → tags and chore-users → users; or :books joins authors plus ratings), the flat LEFT JOIN view SQL produces the cross product of the arms: a chore with 3 tags and 2 completers yields 3 × 2 = 6 rows, where every tag value appears twice and every user value appears three times.
:agg :list collects every non-null value from those rows, so the duplicates become visible in list cells and edit forms: a single completer renders as ("amanda" "amanda") as soon as the chore has 2 tags. With only one arm in the view (e.g. todos: tags only) :list would show each value once; the bug is invisible until a second arm is added — which is why the rule is unconditional, not “two or more arms”.
This is inherent to flat-join view SQL (no per-arm subqueries in the MVP); the data itself is not duplicated. :source-all stays :agg :list; it reads a dedicated single-table view, so it has no fan-out to dedupe.
;; chores: main view joins chore-tags AND chore-users arms
:completed-by
(:type :list
...
:source (:view :main :table :users :column :name :agg :distinct)
:source-all (:view :users :table :users :column :name :agg :list)
:join-table :chore-users)
Cousin (not covered by the rule): 1:N list fields without :join-table (Model Bank :images, FK-based) can still fan out when the view has another arm; authors should use :agg :distinct there too.
Related trap, not fixed by :distinct: numeric aggs (:avg / :sum / :count) over a sibling arm can still double-count the cross product (a book’s average rating counts each rating once per author). That is a separate backlog item; do not treat :distinct on list fields as fixing it.
Both ends of a joiner may have :type :list fields. The backend breaks the allowed-values ↔ be-list recursion by skipping nested allowed-values computation when fetching column values in service of building options (:skip-allowed-values t on the inner be-list-column call — the fallback palette path; the simple-target fast path never enters be-list at all, so the flag describes the fallback only).
Pattern (both sides share one joiner):
| Side | :type :list + :join-table? |
Main view joins through joiner? |
|---|---|---|
Either end (e.g. :books) |
Yes | Yes: (:books :joiner :authors) |
Other end (e.g. :authors) |
Yes | Yes: (:authors :joiner :books) |
| Joiner | n/a | :is-joiner t + two :references |
Each side needs:
:type :list field with :join-table pointing at the shared joiner:source joining through the joiner in the main view for row display:source-all pointing at a named view on the other type for options:authors (:tables (:authors))) for :source-allExample (abbreviated):
:books
(:table t
:views (:main (:tables (:books :book-authors :authors))
:authors (:tables (:authors)))
:fields
(:title (:type :text :identity t ...)
:authors (:type :list
:source (:view :main :table :authors :column :name :agg :distinct)
:source-all (:view :authors :table :authors
:column :name :agg :list)
:join-table :book-authors))
...)
:authors
(:table t
:views (:main (:tables (:authors :book-authors :books))
:books (:tables (:books)))
:fields
(:name (:type :text :identity t ...)
:books (:type :list
:source (:view :main :table :books :column :title :agg :distinct)
:source-all (:view :books :table :books
:column :title :agg :list)
:join-table :book-authors))
...)
:book-authors
(:table t :is-joiner t :internal t
:fields
(:reference (:target :books)
:reference (:target :authors)))
Both ends share one joiner type; do not invent a second joiner for the reverse direction.
Unidirectional M2M (list field on one end only) continues to work as before. Base model follows that pattern: users have :roles, roles have :permissions; not users↔roles both as list fields.
Checkbox-list values are the related type’s single identity field values (strings). On insert/update, the backend maps those strings to UUIDs with list-ids + identity-field. The list field’s :source / :source-all :column should be that identity field (commonly :name).
If the identity column is not unique in practice (e.g. last name only), join rows attach to the wrong row or inserts fail the identity unique index.
Write-through lets a field on type A upsert a related row on type B when A is inserted or updated. Used by Model Bank ratings.
:rating
(:type :integer
:ui (:label "My Rating" :widget :stars)
:validations ((:in-range :min 1 :max 5))
:source (:view :main :table :ratings :column :rating
:scope :user :agg :first)
:write-to (:table :ratings
:model :this
:user :user
:rating :value))
:write-to structure| Key | Meaning |
|---|---|
:table |
target type (existing, non-internal) |
| other keys | field names on the target type |
| values | :this (primary record UUID) | :user (current user UUID) | :value (this field’s value) |
Rules (write-to in model.lisp):
:value tag is required (the payload); with more than one, the first silently wins — write exactly one:identity t field on the target must appear as a keyA plain integer :rating column on the parent type only stores one value per row, not per-user ratings and not an average. For multi-user ratings, follow Model Bank:
:ratings type with composite identity (e.g. :book + :user, or :model + :user), each a :target FK, plus a :rating integer column. Include those types in views as needed.:books):
:source from ratings with :scope :user and :agg :first; :write-to upserts the ratings row (:book :this, :user :user, :rating :value). UI label “My Rating”, :widget :stars, :validations ((:in-range :min 1 :max 5)).:type :real, :source from ratings with :agg :avg, :widget :stars :read-only t, optional :precision 1. No :write-to, no :column required on the parent.(:main (:tables (:books :book-authors :authors :ratings))).(:fields (:title :isbn :description :average-rating :authors))(:fields (:title :isbn :description :rating :authors))(:fields t) is fineWrite-through target identity keys in :write-to must match the ratings type field names (:book / :user / :rating, not hard-coded :model unless the type uses :model).
See models/modelbank.lisp for the canonical example.
execute-write-to)search-sql on target identitiesadmin and the creator’s exclusive role), so its visibility matches what it was derived from (a rating inherits the rated model’s visibility) with no author declarationhandler-case; errors are logged, not rolled backMVP: not transactional with the primary write. Clear-to-NULL and other edge cases are still open (see AGENT.md).
:deploy
(:type :button
:ui (:label "Deploy Model" :widget :button)
:action (:deploy-model :field :model))
| Requirement | Detail |
|---|---|
:type :button |
no storage column |
:action |
single registry form (keyword or (:name …params)); only valid on buttons |
:ui :widget |
must be :button |
For button field F, compiler injects :F-status if absent (else compile error):
| Property | Value |
|---|---|
:type |
:text |
:column |
t |
:default |
"idle" |
:not-null |
t |
:ui |
(:label "<ButtonLabel> Status" :widget :textbox :read-only t) |
:source |
(:view :main :column :F-status :agg :first) |
Status writes go through be-set-field-value only.
| Status | Who sets | Terminal? |
|---|---|---|
idle |
column default | yes |
running |
be-action before hooks |
no |
complete |
framework (sync) or worker via set-status |
yes |
failed: <reason> |
framework (sync error) or worker | yes |
"running":ui :enabled-when): refuse to start when the gate fails against the current record (see :ui subkeys); checked before "running" is stamped. The canonical gate — ((<button>-status :ne "complete")) — disables only after a successful run, keeping "failed: …" re-runnablecomplete / failed: …:async t): worker must call set-status; process restart can leave running forever (no job queue in MVP)update access, same as be-update (the row’s own resource; base types degenerate to the type resource)POST /api/actions with {"type", "id", "field"}Full contract and registered actions: docs/hook-registry.md.
:directories
(:table t :create :auto :update :auto :delete :auto :display t
:tree t :is-leaf nil :parent-type :directories :fs-backed t
:type-roles ("directories-user")
:fields
(:name
(:type :text :identity t :path t
:ui (:label "Directory" :widget :textbox)
:validations (:required)
:source (:view :main :column :name :agg :first)
:column t :not-null t :unique t))
...)
:files
(:table t ...
:tree t :is-leaf t :parent-type :directories :fs-backed t
:fields
(:name (... :path t ...)
:file (:type :file
:ui (:label "Select File" :widget :file)
:validations (:required)))
...)
Constraints (validate-tree):
:is-leaf, :parent-type, :fs-backed each require :tree t:tree t requires :parent-type naming an existing non-base type:path t field per type (mark-path-field); if omitted, compiler picks :name or the sole user text fieldBehavior:
add-root-fs-resources inserts logical "/" for non-leaf tree types/; leaves must notbe-update rejects any change to a :path field’s value with a validation error (directory moves are not supported; rename desynchronizes row / RBAC resource / filesystem)A model with :guest-allowed t can publish a crawlable, script-free HTML face beside the SPA: guest-readable types that declare a :view-form render on request at /p/, /p/<type>/, and /p/<type>/<uuid>, with a per-type RSS 2.0 feed at /p/<type>/rss.xml, a sitemap.xml, and a robots.txt. The pages look a little like the app, carry OG / article: meta and a BlogPosting JSON-LD block, and a visible “Open in app” link leads to the SPA. Rendering is on request (nothing to rebuild after data changes or a snapshot restore), and the anonymous reach of /p/ never exceeds the guest token’s reach — it is a strict subset: eligibility also requires type-level guest read. The site header and footer on every public page read the :styling slots through site-chrome (see Built-In Types) — the banner replaces the header’s title link, the footer slot renders before “Open in app”.
No model key turns this on. Publication is guest read on a row of an eligible type in a guest-enabled model. There is no :public-form, slug, or publication checkbox. The author controls the projection by what :view-form names, and sensitive text is public exactly when the author puts it on that form and the guest can read the row — the same reach the guest login already has.
A type is eligible when all of these hold:
:guest-allowed t (a model with guest login off publishes nothing, whatever its :type-roles say — no documents, no files, no wire key)"public" (or whatever grant the guest holds) is among the type’s :type-roles — a type whose :type-roles lack it publishes nothing even where a guest-readable row would show in the guest’s API list:view-form whose :fields is t or a non-empty list/p/files/, they are not documents), not a joiner, rollup, user-setting, built-in, or base type, and has no view-level :scope (a user-scoped view cannot be a public blog)The rendered projection is the type’s own :view-form, filtered a second time: :password, :file, and :button fields, :widget :hidden fields, :roles, :id, and the timestamps never render. Timestamps come from a separate query — an explicit :view-form :fields list carries only the named fields, so nothing downstream could recover them. A declared :view-form :children region renders the child rows (unpaged, through the child’s own :view-form, default sort (:created-at :asc) when the region omits :sort). Forward FK fields render as links to the target’s public page when the target is itself eligible (targets of :users never link); two singular targets on one type render as text. Image widgets emit /p/files/<asset-type>/<path> URLs — the route authorizes the file row as guest at fetch time, so a private image is a 404 at fetch, never a leak; external and data: markdown images become alt text.
Markdown bodies are rendered by a custom walker that escapes all text and passes every URL through one policy: relative /p/ paths, fragments, clean mailto:, and credential-free absolute http/https links render; javascript:, data:, file:, vbscript:, protocol-relative, and credentialed URLs print their label as text. Raw HTML in a body is visible escaped text, never markup. Fenced code blocks and tables render (no syntax coloring).
Public files: only whitelisted image extensions (png, jpg, jpeg, gif, webp) of a guest-readable fs-backed file row, always as full 200s.
The wire records of a public type (from /api/list and /api/item) carry a public-url string — the absolute /p/<type>/<uuid> page for that row, computed from a fresh guest-read check; the key is omitted when there is no public page. :public-url is a reserved field name (like :update, :delete, and :hide-list) — an author field of that name is a compile error naming the collision.
All custom logic attaches via the registry (data-only forms). Raw lambdas are not an author surface; register a custom hook with register-hook instead. Details: docs/hook-registry.md.
:required ; bare keyword
(:max-length :max 19) ; parameterized
(:in-range :min 1 :max 5)
(:deploy-model :field :model) ; action
| Kind | Where | Compile | Runtime |
|---|---|---|---|
| validation | field :validations |
compile-validations (always prepends type check; optional required) |
validate-field-internal |
| lifecycle | type :pre-create :post-create :pre-update :post-update :pre-delete :post-delete |
compile-lifecycle-hooks |
run-lifecycle-hooks in be-insert/update/delete |
| action | field :action on :button |
→ :compiled-hook |
be-action |
Lifecycle may be a single form or a list. Validation is always a list.
| Name | Params | Behavior |
|---|---|---|
:required |
n/a | reject empty/nil |
:user-name |
n/a | username policy |
:password |
n/a | password policy |
:email |
n/a | email format |
:join-items-exist |
n/a | each list item exists |
:exists |
n/a | single referenced value exists |
:max-length |
:max integer |
string length ≤ max (no-op if empty) |
:in-range |
:min :max integers |
numeric inclusive (no-op if empty) |
| Name | Params | Behavior |
|---|---|---|
:deploy-model |
:field keyword |
deployer role required; validate model text in-process; async deploy worker (writes models/local/, no git commit) |
:generate-model |
:description-field, :model-field keywords |
ai-user role required; system prompt = model reference + # Examples section with all top-level models/ demos verbatim; non-empty :model-field rides the user message as prior art; persists description/model from the action :data before generating; async LLM call writes a validated model into :model-field; each real LLM call logs its full prompt (structured: reference + examples) to /data/k8s/data-ui/generate-log/ (one org-mode file, best-effort); on validation failure the failed model + ;; failed: error line replace the field only when it is empty or already failed (config in the admin llm-config secret) |
:spawn |
:close plist, :clear list |
close the record + insert a fresh successor (recurring-instance pattern); sync; reserved close values :now / :user |
Full contracts and per-hook detail: docs/hook-registry.md.
(Test-only hooks may also be registered in the live image: :test-sync, :test-async, :test-error.)
validation: (type-key field-key value user) → nil | error-string
lifecycle: (type-key data user &key id roles record) → nil | plist
nil = no change; plist = merge into data; non-plist = error
action: (type-key field-key record user &key roles status-field set-status)
→ nil | (:async t :message "…")
Lifecycle hooks, action hooks, and write-through are not transaction-wrapped with the primary write. A failing hook fails the operation without rolling back prior side effects. Design for eventual transactional wrapping; do not assume atomicity today.
default-fields)Every non-internal type receives:
| Field | Type | Notes |
|---|---|---|
:id |
:uuid |
PK; non-base → :target :resources; base/joiner → :default :generate-uuid |
:created-at |
:timestamp |
:default :now, :not-null t, :sortable t (injected) |
:updated-at |
:timestamp |
:default :now + trigger set_<table>_updated_at, :sortable t (injected) |
Marked :base-field t. Not part of author field lists — but the two timestamps may be redeclared as presentation overrides (below); :id cannot be redeclared (v1; compile error). Fresh rt_ tables get ix_<table>_created_at / ix_<table>_updated_at at creation; pre-existing tables (built-ins, any leftover rt_ table) sort correctly but unindexed until recreated (same caveat as sortable :name/:email; see gotcha 17).
A field never reaches the wire without a :ui widget, so naming :created-at in a form does nothing by itself. Redeclare it in :fields to present it:
:created-at (:ui (:label "Posted" :widget :textbox :read-only t))
The author plist merges over the injected def (author keys win). Legal keys are exactly :ui and :sortable; anything structural (:type, :default, :not-null, :update, :source, …) is a compile error — the injection’s contract cannot be reshaped. :ui is required, must carry :read-only t (the field is never writable; an editable widget would drop the edit on save), and :widget must be :textbox or omitted (a hidden field never reaches the wire; the date-time picker is a future item). A redeclaration without :ui is a compile error. :sortable need not be declared (the injected default is t); a :sortable t restated inside an otherwise valid override is a legal no-op, but an explicit :sortable nil is a compile error until “Model value vocabulary” lands the :false spelling. Duplicate redeclarations of the same injected key signal a compile error (no silent first-wins). Base-type :fields overlays remain :type-roles-only — presenting :users’ timestamps is a separate question.
Non-base types without :suppress-roles get a synthetic :roles checkbox-list on the add and update forms only (never the view form or list views). allowed-values.roles is filtered to roles the current user may assign: their own roles, “public”, the type’s :type-roles, and every other user’s shareable exclusive role (point-to-point sharing).
| Kind | Table name |
|---|---|
| built-in | to_sql_identifier(type) e.g. users, settings |
| user types | rt_<name> e.g. rt_todos |
Columns: <singular_table>_<field> unless :force-sql-name, default field, or simple joiner FK.
If any field has :identity t:
create unique index if not exists ix_<table>_identity
on <table> (<identity columns>);
*base-model*)Always merged into every compiled model:
| Type | Flags | Notes |
|---|---|---|
:users |
base, built-in | custom create/delete; settings row lifecycle; :name and :email are :searchable t and :sortable t; :created-at / :updated-at are :sortable t (injected) — its list form names them and they still do not render (no :ui); :name must be lowercase letters, digits, and dashes — start with a letter, end with a letter or digit (^[a-z][a-z0-9-]*[a-z0-9]$, 2+ chars) — login keeps the looser rbac policy so legacy names still work |
:resources |
base, built-in, internal | no CRUD; declares no forms at all (internal + display nil — no UI surface can request them) |
:permissions |
base, built-in | :name is :searchable t and :sortable t |
:roles |
base, built-in | :name is :searchable t and :sortable t |
:role-permissions, :resource-roles, :role-users |
base, built-in, joiner, internal | |
:settings |
base, built-in, user-setting | dark-mode, display-name, bio; view scope :user; no-column :current-password (:widget :password-read) / :new-password (:widget :password-new) + :change-password button (self-service password change — see docs/hook-registry.md → :change-password; the password fields never persist via a normal Save) |
:secrets |
built-in, not base, suppress-roles, category :settings |
per-user secrets; :name is :searchable t |
:saved-views |
built-in, not base, no display, suppress-roles | per-user saved list views (the filter bar’s saved views); view scope :user; identity is user + list type + name (one unique index); the owner is stamped on write |
:tokens |
built-in, not base, no display | internal token store |
:usage |
built-in, not base, :type-roles ("usage"), append-only, category :system |
admin-facing action log; :ip records the original caller address |
:styling |
built-in, not base, :type-roles ("styling"), category :system |
site chrome slots (banner / footer / heading); :value is restricted HTML, sanitized on write |
:usage is the append-only action log. A helper (record-usage, called from the REST layer) writes one row per app event — login, login-failed, list, view, insert, update, delete, action — with the actor’s name (:user-name, always filled, guest included), the actor’s :user FK when the name is a real user (nullable; on delete set null, so deleting a user keeps their rows), the target type (:on), a capped 80-char :detail, and :when, the full UTC timestamp as text (2026-11-02T10:14:03). :detail names the touched row for every write-shaped event: view / insert / update / delete store "<identity> / <uuid>", action stores "<field-key> / <identity> / <uuid>" (which button, which row), and list stores the search string (the listing is many rows — no single identity; an absent search stores NULL, as do login / login-failed). The identity segment is the row-titling value: the type’s :title-field value when one is declared and non-blank (per row), else the first non-blank :identity t value in declaration order. The uuid is always last and never truncated; a missing identity degrades to uuid-only. Read access is the usage role (:type-roles ("usage"); admin is force-attached to every type at compile time) — grant the role to widen who can read the log; the type’s caps keep it read-only. Search is one ILIKE across every searchable column, so an hour search must be typed as a prefix of the stored spelling — 2026-11-02T10: is 10:00 UTC; a bare 10 matches anything containing those characters, not the hour. All six text columns are also :sortable t (:user-name, :event, :on, :detail, :ip, :when), sorted lexicographically like any text column — no IP-aware collation; the :user FK stays unsortable by choice — :user-name is the sortable spelling of the same fact. Repeated lists by the same user with the same event + type + detail collapse inside 60 seconds (sort and offset are not in the key); every other event always writes. :ip is the original caller address (real-remote-addr, the HAProxy X-Forwarded-For value), nullable text, searchable and sortable (text-column lexicographic order — 9.x sorts after 203.x; no IP-aware collation), not in the dedup key, and NULL on rows written before the column and on non-REST writes; an existing usage table does not gain the column from heal-model or create-tables (both stop when the table is present), so deploying this code onto an unmigrated database silently stops logging (record-usage swallows the undefined-column error). A top-level :usage (:state :off) stops record-usage before any query — no insert, no dedup read — while everything else stays: the table is never dropped, the tab remains, history freezes rather than vanishes, and admin-only visibility is unchanged; turning logging back on is a model edit + reload. Absent key or (:state :on) means on; unknown :state values and unknown keys in the plist are compile errors. No add or update forms; be-update / be-delete reject the type. A REPL be-insert writes no usage row — the log is about people using the app. The e-demo nightly reset destroys the table with everything else; the journal remains the record that survives the night.
RBAC types are treated like user-defined types at the API level (e.g. assign roles the same way you assign tags). :users, :roles, :permissions, :settings, and :secrets carry :view-form (:fields t) beside their :update-form (the built-in reading surfaces); :resources declares no forms at all.
:saved-views is the saved-list-view store behind the filter bar’s saved views (one row per named list query: list type, name — unique per user per list type — and the canonical hash query without #/app?, the page, and the open record); it is hidden from every selector including admin’s, row-isolated like :secrets, and never rendered by the frontend as a list — a view is applied by navigating to its hash. Its stamp-saved-view-owner hook stamps the owner on every write (the acting user on create, the row’s existing owner on update), and the type key is reserved: an author model’s own :saved-views fails compilation, while a :type-roles-only redeclaration is how an author restricts who may save views.
:styling holds the site’s chrome as data: one row per named appearance slot the system reads, not the user. The slot vocabulary is frozen — *styling-slots* = banner / footer / heading in v1 — and write-enforced (v-options, auto-attached from the field’s static :ui (:widget :select :options …), rejects an unknown :name — the dropdown is the admin’s discovery surface); adding a slot is a code change (one vocabulary entry, one reader call site, one doc line), never a model change. The heading slot is a single styled span: the app lifts its style attribute onto the page headline (the :widget :heading field — see Page types); absent or blank, the headline keeps its built-in style. The tab and row creation sit behind the styling role (:type-roles ("styling"); admin is force-attached to every type at compile time, so admin keeps full access). The type is deliberately not role-suppressed: the Add form’s Roles palette preselects styling, so a row created through the UI carries the role and every holder can see and edit it — grant styling to a trusted non-admin and they manage the chrome without admin powers (rows created before the grant are the empty-list trap; the full anatomy, including pre-existing rows, is docs/roles.md’s worked example — now the shipped default). The design is rows, not columns: create-tables never alters an existing table, so a column-per-slot design would strand every live database at the first new slot; :name is :identity t :unique t (belt: the unique index rejects a duplicate slot whatever path wrote it, including raw SQL or a restored snapshot). The value is restricted HTML sanitized on the write path (a :pre-create / :pre-update hook rewrites :value through sanitize-styling-html) and again on read (styling-slot, the belt for rows written around the hook): tags a / img / span / strong / em / br / center / p / div / hr / ul / ol / li / code / small / sup / sub (unknown tags unwrap, raw-text and form elements drop with their content), attributes per tag with class and a closed style property list (background excluded, background-color and text-align in; values carrying url( / image-set( / expression / javascript: / import / @ drop the whole attribute), href only /p/…, clean mailto: (one @, queries allowed — the markdown rule), or userinfo-free https://, src only /p/files/<type>/… (no off-site images — one rule for the SPA and the public pages), a 4096-character cap, and drop-not-reject semantics (an admin pasting <script> gets a banner missing the script, not a 400). The type carries a :page-description (collapsed on the styling page) that names the slots’ purpose and spells out this grammar for the admin editing a value — *styling-page-description* in lisp/model.lisp, manually synced with the policy (one grammar test probes every policy tag into the string). The engine reads the slots with its own authority (one direct SQL query per slot — no viewer identity, no permission machinery), so every viewer of the same deployment sees the same chrome. banner replaces the logged-in SPA header’s <h1> and the public pages’ <h1 class="site"> — the header stops being a home link when the banner renders (the Home button is the guaranteed way home; a banner may carry its own anchors); footer renders at the SPA shell level and before the “Open in app” link on public pages. Absent, blank, or unreadable slot means today’s default chrome — a styling problem must never take a page down. The browser tab (document.title) and the login screen keep reading the model’s :title; no per-user or per-role chrome exists (the “User styles” item owns that future).
set-model
→ top-level-settings ; validate A keys → *top-level-settings*
→ compile-model (:types)
validate-model:
stage-1:
append *base-model*
preliminary-model-check
per type:
ensure-action-on-buttons
synthesize-status-fields
compile-fields (+ validations, write-to, action)
mark-path-field
validate-tree
compile-lifecycle-hooks
compute-category / suppress-roles
augment-update-form
valid-children (post-stage-1 cross-type :children
pass over the compiled model; returns it)
stage-2:
enrich-views (SQL / aliases)
insert / update / delete / search SQL
create-table-sql
stage-3:
compile-fields-stage-2 (alias-key, scope-alias on sources)
→ create-tables
→ ensure-model-roles / add-type-roles
→ add-system-user-settings
→ add-root-fs-resources
→ start-web-server
Pure validation without side effects: validate-model (used by :deploy-model before spawning a deploy).
Do not set these in model files. They appear on *compiled-model* after compile:
Type-level: :table-name, :create-table-sql, :insert-sql, :update-sql, :delete-sql, :search-sql, compiled lifecycle function lists, resolved :category / :internal, :searchable-fields (stage 3), :phase-a-shape (:base, :measure, or :page), and the page’s computed query parts (:page-table, :page-columns, :page-where, :page-params).
View-level: :sql, :aliases, :columns, normalized :scope, :phase-a-base-sql, :phase-a-join-sql; on rollups also :measure-phase-a-select / -group-by / -count-select / -grain-where.
Field-level: :name-sql, :type-sql, :create-sql, compiled :validations (function list), :base-field, :compiled-hook, :status-field, source enrichments (:alias-key, :column-name, :scope-alias, :scope-kind).
Abbreviated from models/todos.lisp (which additionally sets :domain-stg, :guest-allowed t, :guest-auto nil, :api-roles, :default-sort, :sortable / :searchable on fields, "public" in :type-roles, and D1 :type-roles overlays on the built-in :users / :roles / :permissions):
'(:title "To Do List"
:name "todos"
:version "0.1"
:domain "todo.demo.data-ui.com"
:repl t
:landing-page :todos
:types
(:todos
(:table t
:create :auto :update :auto :delete :auto :display t
:type-roles ("todo-users")
:views (:main (:tables (:todos :todo-tags :tags))
:tags (:tables (:tags)))
:fields
(:name
(:type :text :identity t
:ui (:label "To Do" :widget :textbox)
:validations (:required (:max-length :max 80))
:source (:view :main :column :name :agg :first)
:column t :not-null t :unique t)
:done
(:type :boolean :default :false
:ui (:label "Done" :widget :checkbox)
:source (:view :main :column :done :agg :first)
:column t :not-null t)
:tags
(:type :list
:ui (:label "Tags" :widget :checkbox-list)
:validations (:join-items-exist)
:source (:view :main :table :tags :column :name :agg :distinct)
:source-all (:view :tags :table :tags :column :name :agg :list)
:join-table :todo-tags))
:list-form (:fields t)
:update-form (:fields t)
:add-form (:fields t))
:tags
(:table t
:create :auto :update :auto :delete :auto :display t
:type-roles ("todo-users")
:fields
(:name
(:type :text :identity t
:ui (:label "Tag" :widget :textbox)
:validations (:required)
:source (:view :main :table :tags :column :name :agg :first)
:column t :not-null t :unique t))
:list-form (:fields t)
:update-form (:fields t)
:add-form (:fields t))
:todo-tags
(:table t :is-joiner t :internal t
:fields
(:reference (:target :todos)
:reference (:target :tags)))))
:rating
(:type :integer
:ui (:label "My Rating" :widget :stars)
:validations ((:in-range :min 1 :max 5))
:source (:view :main :table :ratings :column :rating
:scope :user :agg :first)
:write-to (:table :ratings
:model :this
:user :user
:rating :value))
:average-rating
(:type :real
:ui (:label "Rating" :widget :stars :read-only t :precision 1)
:source (:view :main :table :ratings :column :rating :agg :avg))
:deploy
(:type :button
:ui (:label "Deploy Model" :widget :button)
:action (:deploy-model :field :model))
:complete
(:type :button
:ui (:label "Complete" :widget :button
:enabled-when ((:complete-status :ne "complete")))
:action (:spawn
:close (:completed :true
:completed-at :now
:completed-by :user)
:clear (:notes :instance-id)))
One click closes the record (close fields written to the old row, which becomes history) and inserts a fresh successor with definition fields copied and cleared fields reset to their defaults. A spawnable type’s :identity t field should carry :default :generate-uuid so cleared successors never collide on the identity index. See docs/hook-registry.md → :spawn.
:files
(:table t
:create :auto :update :auto :delete :auto :display t
:tree t :is-leaf t :parent-type :directories :fs-backed t
:type-roles ("file-users")
:views (:main (:tables (:files)))
:fields
(:name
(:type :text :identity t :path t
:ui (:label "File" :widget :file-path
:directory-type :directories)
:validations (:required)
:source (:view :main :column :name :agg :first)
:column t :not-null t :unique t)
:file
(:type :file
:ui (:label "Select File" :widget :file)
:validations (:required)))
:list-form (:fields t)
:update-form (:fields t)
:add-form (:fields t))
Obsolete patterns: older notes mentioning :checks-fn, :options-fn, root-level :widget, or :lookup-field are dead. Use :validations, :source-all, and :ui instead.
:required dual path: field key :required t and/or :validations (:required). Prefer the validations form (what all current models use).
Field :update nil: documented for status fields in AGENT.md but not retained by compile-field. Status protection is practical (read-only UI + be-set-field-value), not a compiler-enforced update block.
View scope plist form: validated, not implemented. Use :scope :user.
Type→widget inference: not implemented; all fields default to :textbox regardless of :type. Smarter inference (e.g. :type :text → :textarea) is an MVP Backlog item.
:type :file validation: models comment that :valid-file should exist; it is not implemented yet.
Diamond join graphs: unsupported.
Write-through clear-to-NULL and transactions: transactions post-MVP / open. Clear-to-NULL is now implemented for nullable scalar columns on the main write path: explicit nil on a nullable :text / :integer / :real / :uuid / :timestamp column writes real NULL through db-value (insert and update alike; the driver binds bare Lisp nil as SQL FALSE, which 22007’d timestamps and silently stored "false" in text). Write-through inherits it for its :value column only — the one value execute-write-to routes through db-value — and only when that column is one of those five types. :boolean nil stays false (a legitimate encoding); join-table writes have their own paths and never see the map.
:source-sel: handled in stage-2 plumbing but unused by any model; treat as unfinished.
Joiner :internal t: redundant with :is-joiner default; still conventional in examples.
Bidirectional M2M list fields: Resolved. Both ends of a joiner may now have :type :list fields. The backend breaks the allowed-values ↔ be-list recursion via a :skip-allowed-values flag on the inner column fetch. See Bidirectional M2M.
Reference identity is scalar: types used as :target or M2M list targets need exactly one :identity t field. Composite identity is for write-through / uniqueness, not checkbox-list lookup (see Identity fields).
No computed/composed fields: Resolved. The :compose field attribute and :compose-string lifecycle hook now support server-side composition of stored field values (e.g. full name from first/middle/last). See :compose and Identity fields.
Sorting a CRUD list by an aggregated field is not supported. A regular (non-rollup) type’s :agg fields — e.g. Model Bank :models :average-rating — are computed in Phase B and cannot be sorted honestly under LIMIT. :sortable t on such a field is a compile error on base types (the :column t rule). Ranked-by- aggregate UX uses a rollup type instead (see MVP Backlog “Regular-type computed-field sort”).
:new-roles is additive-only. Removing a role from :new-roles does not delete it from the database, and changing the permission list of a role that already exists has no effect until the role is deleted (the role keeps whatever permissions it had).
:type-roles override on built-in types does not revoke live grants. add-type-roles only inserts missing resources, so tightening :users to ("admin") on an already-initialized database leaves "logged-in" attached to type-users. Clean slate (new deploy / reset-database) required. A denied palette no longer fails the parent list: allowed-values catches the permission error per field and returns an empty palette (key present, value null), logging palette suppressed — see Overriding defaults on built-in types.
DDL changes never reach an existing table. create-tables runs table / trigger / index DDL only when the table is absent, and the first set-model after image start skips reset-tables (guarded by *compiled-model* being nil), so adding :identity t (composite unique index), :unique t, or new columns to a type whose table already exists in a persistent DB silently does nothing. hard-reset doesn’t help: base tables are truncated, not dropped, and the :force reload nils *compiled-model* again. Recover by dropping the table and re-running create-tables, or hand-writing the DDL. Related post-MVP item: idempotent database initialization. Ordering within the walk is dependency-aware: create-tables creates tables in FK-dependency order (type-ddl-order), not declaration order, so a type may target a later-declared type; a dependency cycle among types whose tables are absent is a DDL-time report-e naming the cycle.
Empty values on the wire. Internally a missing value is Lisp nil, which plist-to-json renders as [] by default. Record values on /api/list, /api/item, and /api/value are converted at the REST edge: a scalar field’s nil goes out as null, a list-valued field’s nil (:type :list, :join-table, :agg :list / :distinct) stays [] (docs/rest.md → Data retrieval). Other payloads with an unregistered nil key still emit [] (e.g. the unread top-level settings in /api/info, the action result’s message), so a client must not treat [] as a present value.
Top-level: :title :name :version :domain :domain-stg :repl :guest-allowed :guest-auto :api-roles :landing-page :new-roles :usage :types
Type: :table :create :update :delete :display :type-roles :default-sort :title-field :views :fields :list-form :add-form :update-form :view-form :tree :is-leaf :parent-type :fs-backed :user-setting :suppress-roles :category :base :built-in :internal :is-joiner :rollup :grain :filter :page :of :page-description :page-description-open lifecycle slots
Form: :fields :hide-list :children (:view-form only)
View: :tables :scope
Field: :type :ui :column :default :not-null :unique :identity :compose :required :validations :source :source-all :join-table :target :write-to :autofill :force-sql-name :path :action :sortable :searchable :default-from :css-value :primary-key / joiner :reference
UI: :label :widget :read-only :hide-label :help :precision :options :table :filter-with :enabled-when :directory-type
Source: :view :table :column :agg :scope
Write-to tags: :table + target fields mapped to :this | :user | :value
Field types: :text :password :real :integer :boolean :uuid :timestamp :list :file :button
Aggs: :first :list :distinct :count :avg :sum