:filter-with initial state (kinddefault grammar)
Implemented per ~/workbench/filter-with-default.org, no deviations to the grammar. The model can now seed the three-state Any / Yes / No select that :filter-with :boolean renders: bare :boolean stays (sugar, no default); the configured form is the plist (:kind :boolean :default :true|:false) with :default optional and Any unspellable (:default :any is a compile error).
- Compiler (
lisp/model.lisp):*filter-with-kinds*closed kind set;filter-with-kinddefensive kind extractor (never signals);valid-filter-with-valuerewritten for the two author shapes (keyword sugar / plist with closed tail key set(:kind :default), kind membership,:default∈(:true :false), missing-:kind=, kind-set, unknown-tail-key, unspellable-Any reports — the positional(:boolean :true)dies naturally as a keyword-headed plist with no :kind);compile-fieldgate's first check now compares the extracted kind (":filter-with kind must be :boolean"); one arm inpreliminary-model-checkbeside:optionsso a future kind's list-valued tail never hits the generic walker error. - Frontend (
web/src/App.tsx):filter-withtypedstring | {kind?, default?};filterWithKind/filterWithDefaulthelpers (boolean-only by design; a future kind must extend, not ride the null fallthrough);boolDefaultsrecord computed besideboolFilterFields(wholelist-formscan);boolSeededForRefseeds once per type entry (stale-form guard: only whendata.result['type-key'] ==type=; ref blocks re-seeding on every refetch — the plan's invariant, documented at the effect);resetListQueryclears the ref; Clear filters restoresboolDefaults(authored initial view), not bare Any. Wire: the plist's:defaultarrives as a real JSON boolean ({"kind":"boolean","default":false}), so the helpers readf['default'] ==true / false= — see below. - Docs (
docs/model-reference.md)::uiper-key rules sentence and the:filter-withtable row carry the plist grammar, the unspellable Any rule, both wire forms, and the frontend-initial-state-only semantics. - Tests (
tests/widget-tests.lisp): 10 new checks — plist compiles+survives verbatim (with and without:default);:default :any/:maybe, unknown kind, positional form, unknown tail key, plist on:type :text, plist without:column tall rejected; wire tripwire overplist-to-json(default key present with the value, absent for the bare plist form). The four existing:filter-withtests keep passing unchanged. Suite 69/69,widget-all-models-compileincluded; sortable (16/16) and searchable (65/65) re-run green. - Chores flip (
models/chores.lisp)::completedmoves to(:kind :boolean :default :false)— entering the type lands on No ("open chores"), Clear restores No.
One plan deviation, in the test only: the plan asserted the wire :default renders as the quoted string "false". It actually renders as a JSON boolean false — plist-to-json-atom maps :true / :false to bare true / false (the same rule parse-json-atom inverts). The frontend helpers match the real wire (== true / false=); the wire tripwire asserts the boolean form and the test docstring records the correction. No serializer change was needed or made.
Post-DONE browser-pass fix <span class="timestamp-wrapper"><span class="timestamp">[2026-10-04 Sun]</span></span>: first build blanked the page on login (Donnie's report). Cause: the seeding useRef / useEffect were placed in the render body after the if (!loggedIn) / if (!data) early returns — a Rules-of-Hooks violation (hook count differs between login screen and list render; React fatal, blank page). Fix: boolSeededForRef moved up beside the other refs, the seeding effect moved next to the fetchList-trigger effect (both unconditional calls), and a module-level boolDefaultsOf(form) helper feeds both the effect and the Clear-filters handler. The console's source-map error is benign (no .map in dist; Firefox fetched HTML). Rebuilt (index-arbPe<sub>hb.js</sub>) and verified served on chores-stg.
Verified: widget/sortable/searchable suites green; live fe-fields emits {"kind":"boolean","default":false} on chores :completed; dataui@chores restarted cleanly and chores-stg serves the new compiler, flipped model, and rebuilt dist — /api/list shows the object, filtered :eq ":false" returns 53 of 67, health OK through HAProxy TLS.
Plan: filter-with-default.org.
- Slot
- 1400
- Status
- 60 Done
- Tags
- mvp, frontend, model, compiler, docs
- Contributors
- Donnie