Searchable picker for single-target
Implemented as :widget :search-select per searchable-picker-single-target-plan.org (all three review passes + Donnie's four decisions incorporated). widget-suite: 73 checks green (3 new: compiles-with-:target, bare-rejected, :options-rejected); nullable-fk-suite: 20 checks green (:assigned-to fixture swapped to :search-select; new wire test asserts the widget, JSON-boolean :not-null false/true via plist-to-json, and a seeded palette entry); run-backend-tests: 567 green (no movement).
- Vocabulary:
*widgets*gains:search-select;compile-field
mirrors the :select rule (bare widget without :target is a compile error). :options stays :select-only (valid-options-value untouched).
- Wire:
fe-fieldsnow emits:not-nulland
(register-json-boolean-key :not-null) makes it a real JSON boolean (add-to-plist's or drops bare nil, so without the registration the key would never arrive / arrive as []).
- Frontend: new
SearchSelect.tsx(single-select twin of
CheckboxList; shares its exported SEARCH_THRESHOLD / RENDER_CAP; current selection always rendered, palette-absent safe; ✕ clear → JSON null → SQL NULL, gated on not-null != true=; ARIA combobox/listbox + arrow/Enter keys). WIDGET_VOCABULARY, Field type, and a dispatch branch beside select wired in; npm run build green.
- Models: books
:covers :book+:my-ratings :book, modelbank
:images :model + :ratings :model swapped to :search-select; parts gains nullable :primary-image (target :files) on its own :primary-image view (:main untouched — find-table-xrefs has no edge for the joiner otherwise; the ordered-xrefs diamond). All five compile; live smoke: parts insert/update/nil-clear/delete and a REST null-clear round trip on nullable-fk-test.
- Docs: model-reference widget table + semantics bullet; AGENT.md
"new :widget values work without backend changes" corrected to the whitelist + branch reality.
- Known limitation (plan-noted): duplicate display names resolve
to one arbitrary id; palette payload ceiling deferred to "Server-side searchable allowed-values" (Post MVP).
The original description follows.
In the books model, adding a cover requires associating it with a book. That control is a drop-down listing every book (fed by allowed-values). Fine for the demo's few books; unusable with a real catalog. Single-target relations — each record points at exactly one other record — need a widget that scales.
The model to follow: the M2M searchable checkbox list (:widget :checkbox-list) works beautifully no matter how many options exist — type to filter, then click. The single-target case should feel the same: a searchable single-select picker over the same allowed-values palette the :select already consumes.
v1 is client-side search, exactly like the checkbox list (traced 2026-10-19): :target selects already eat from allowed-values, and the write path already resolves the selected display name to a UUID (resolve-reference-id). Opt-in :ui (:widget :search-select), decided 2026-10-19 — some targets have very few options and stay :widget :select. One backend change after all: the *widgets* whitelist (lisp/model.lisp) gates the vocabulary, so one keyword must be added (AGENT.md's "new :widget values work without backend changes" was stale). Models to update: books :covers :book, modelbank :images :model, and parts (new field — it has no single-target field today).
Plan: searchable-picker-single-target-plan.org.
Known ceiling: the palette ships the whole target column per request. Client-side filtering matches the M2M list's architecture deliberately; the payload problem is shared by both widgets and deferred to "Server-side searchable allowed-values" (Post MVP).
Related but different: "Searchable chip picker on list views" (DONE — filtering lists by value) and :searchable on M2M list fields (free-text search through join tables); this item is the edit-form control for picking one related record.
- Slot
- 2300
- Status
- 60 Done
- Tags
- backend, frontend, model
- Contributors
- Donnie