Embedded child region: 2. :children vocabulary and wire
Compiler plus be-rec. Validation: legal only on :view-form, a list of exactly one region spec, :type and :via required, :sort validated by the extracted valid-default-sort rule set against the compiled child type in a post-stage-1 cross-type pass (stage-1 compiles each type against the raw model, so a child's injected :sortable t is not visible during the parent's own compile), :hide-list t as required companion, and the walker arm so a well-formed spec does not die as "Invalid value". Wire: the spec attaches in be-rec beside :fields — not rec, not list-result, not fe-fields — only on :view-form, only inside the record guard, only when the type declares :children; :type / :via go out as strings and :sort as a two-element string pair ("field" "asc") with the direction normalized (a sort plist would serialize as {"field": "dir"} — the json-sort-echo trap), so plist-to-json emits ["created-at","asc"]; a backend test asserts the compiled def still carries :children verbatim, omitted :sort included. The models/test/blog-test.lisp fixture lands here complete for 03/04: :guest-allowed t + :api-roles ("logged-in" "public"), guest-readable types, seeded post/comment rows (suite-side, "public" roles), scalar view/add forms, the tab's :list-form and :default-sort, the full M2M tags structure, author/reference chip filtering, and the permission recipe — :new-roles (:comments-user ("create" "read")) plus flat-string :type-roles (amended 2026-11-01 after plan review: the nested :type-roles spelling never reaches RBAC correctly and leaks onto the wire verbatim). New suite tests/children-tests.lisp with the standard asd / run-* registration. No React. Docs: docs/model-reference.md gains the vocabulary rows, the emitted JSON shape, and the tree-UI guard (tree vocabulary must never grow a :children key). After this, (be-rec …) returns the region spec and (1) returns the rows; nothing consumes them until (3).
Plan: 02-children-vocabulary-wire.org
Implemented per the plan (all five review amendments). model.lisp: *form-keys* grows :children (closed set) with the per-form reject in valid-hide-list (:view-form only, even as nil; :default-sort rides :list-form via a new *form-macro-keys* skip and its own list-form-only rule); the preliminary-model-check walker arm stops at the region list; valid-sort-declaration extracted from valid-default-sort (shared rule set; presence-aware direction check — (cdr sort) — so (:created-at nil) now rejects in both the region spec and type-level :default-sort, the deliberate behavior change); valid-children + valid-children-region-surface run as the post-stage-1 cross-type pass inside validate-model (both spelling positions of :default-sort honored; compiled child's injected :sortable t visible; parent/child list-form / display / non-internal / user-category / child view+add forms; :via singular-target check against the compiled child; tree/fs-backed guard on values; stray type-level :children and :via rejected); valid-target takes the pre-rename old-field-key and grants the zero-identity storage-edge carve-out exactly for joiner-internal :reference fields; compile-field rejects a join-table list field whose other side has zero identity fields (the pinned message). backend.lisp: region-spec-list (pure emitter — downcased :type=/:via strings, ("created-at" "asc") string pair, omitted :sort defaulted) and the triple-guarded be-rec attach (record guard + :view-form + declared :children; docstring updated). Fixture models/test/blog-test.lisp (zero-identity comments, :post-tags joiner to comments+tags, :autofill :user author, reference chips on :user=/:post, :new-roles + flat :type-roles) and suite tests/children-tests.lisp (compile probes bare via blog-types mutations; DB/RBAC/wire probes under one seeded with-model; run-children-tests registered in run-tests; form-keys-closed-set updated in hide-list-tests). Docs: model-reference.md gains the :children section, the emitted JSON shape, the parent/child surface contract, the pipeline's valid-children pass, the storage-edge identity carve-out, and the quick-key index row. Three deviations, all probe-shape rather than behavior: the missing-:view-form catch is the type-level :children arm (one catch, not two — the plan's own "one catch" reading); the fs-backed tree guard probe covers the shared message via the tree arm only (an fs-backed compile probe dies in mark-path-field first because compiled fields drop :path — a mark-path-field ordering question, not this item's); valid-sort-declaration gained a listp pre-check so a keyword :sort reports the shape message instead of a (cdr keyword) type error. Full suite green (2665 checks, 49 groups).
- Slot
- 4200
- Status
- 60 Done
- Tags
- mvp, backend, frontend, model, compiler, blog
- Contributors
- Donnie