allowed-values must not fail the parent list
A permission error raised while building one field's option palette fails the whole parent list (and /api/item). lisp/backend.lisp — allowed-values walks every field with :target, :join-table, or :ui :options; for each, allowed-values-for-field does (or :source-all :source) and calls (be-list-column target-type … user). That inner be-list still runs valid-user-permissions on the target type. :skip-allowed-values t only stops recursion (bidirectional M2M); it does not skip the permission check. list-result has no handler-case, so a permission error on the target fails the outer list. This is what makes :users (:type-roles ("admin")) unsafe on Model Bank / chores / books (any type with a :target :users field).
Plan: allowed-values-nfpl-plan.org — catch validation-error per field, return an empty palette, log it. Does not apply the :users override (separate follow-up once this lands).
Implemented per the plan (see plan for full detail):
lisp/backend.lisp:allowed-values-for-fieldwraps thebe-list-columncall in ahandler-casecatchingvalidation-error; the handler calls the newlog-palette-denied(pl:perror,:status "palette suppressed", greppable) and returns nil, so the palette key stays present with a null value (the existing:users:rolesremove-ifbranch then runs on nil harmlessly). Directbe-liston a restricted target still signals; the:ui :optionsbranch is untouched (no DB access).- New fixture
models/test/allowed-values-test.lisp: one:itemstype with a:target :usersfield (modelbank shape,:views :mainlisting:usersis load-bearing) plus a:ui :options:ratingfield;:users (:type-roles ("admin"))overlay is the point of the fixture. - New suite
tests/allowed-values-tests.lisp(run-allowed-values-testsintests/helpers.lisp, registered indata-ui.asdandrun-tests): non-admin list survives, palette key-present-value-nil (admin gets usernames), directbe-list :usersstill signals,be-recdelivers a readable row with an empty palette,:optionsliterals unaffected. Two fixture surprises discovered while wiring it (both pinned as a test + fixture comment, both plan deviations):- a field omitted from a
be-insertplist reaches db-value as nil, which the driver binds as SQL false — Postgres 22P02s; every non-nullable column needs a:default(fixture adds one) or the insert must supply it; :ui :optionsvalidates with#'equalagainst the literal list, and every options list in the codebase is strings — an:integerfield with("1" "2" "3")options fails v-options once full-data fills the default, so the fixture uses:type :text(the static-select-test shape).
- a field omitted from a
- Smoke:
palette suppressedlog entry verified in the REPL p-log sink (tests/repl.log) carrying type / field / target / user / condition text; no permanent model edit. docs/model-reference.md: "Known gap" paragraph under Overriding defaults on built-in types rewritten (empty palette + log instead of failure); gap 16 updated to match.- Full suite via
scripts/data-ui tests: 2062 checks, 38 groups, all passed (2042 → 2062 with the new suite's 17 + the item's groups recount).
- Slot
- 2500
- Status
- 60 Done
- Tags
- mvp, backend, bug
- Contributors
- Donnie