Allow :type-roles override on base-model types
lisp/model.lisp — The base model hardcodes :type-roles on system
types (e.g. :users gets ("logged-in" "user-creator"), meaning
every authenticated user can see the users tab). Model authors cannot
change this today.
Approach: when the user model includes a base-model type (e.g.
:users) with a :type-roles value, the compiler merge should let
the user's value override the base model's default. This follows the
existing merge philosophy. Example: a model that includes
:users (:type-roles ("admin")) would restrict the users type to
admins only.
This unblocks type categorization (system types hidden from non-admin users) and is needed for apps like Model Bank where users should not browse other users.
Plan: type-roles-override-plan.org.
Summary (2026-09-07): Implemented per plan, no deviations.
lisp/model.lisp: newvalid-base-type-overrides(allowlist: non-internal base key, def is a plist with exactly:type-roles, non-empty list —report-eotherwise) andmerge-with-base-model(base order,add-to-plistpatch of:type-rolesonly, user-only types appended in author order;*base-model*not mutated).stage-1now uses the merge instead of rawappend, so the old duplicate-:userswalk cannot recur.add-type-roles/ensure-model-rolesuntouched (admin still appended; stale-grant behavior documented, not fixed).tests/type-roles-override-tests.lisp(new suite, registered indata-ui.asd): 15 compile probes + 5 behavioral tests.models/test/type-roles-override-test.lispfixture restricts:users/:roles/:permissionsto("admin");:settingsdeliberately unrestricted.tests/helpers.lisp:run-type-roles-override-testsadded and wired intorun-tests.docs/model-reference.md: "Overriding defaults on built-in types" subsection (replace-not-union, partial overlay, allowlist, clean-DB caveat, FK-picker gap) + Known gap 16.- Tests: suite 36/36 green; full
run-tests1691 checks, 30 groups, 100% pass. - Demo models untouched (blocked on the
allowed-valueshardening item); no frontend changes.
- Slot
- 27500
- Status
- 60 Done
- Tags
- mvp, compiler
- Contributors
- Donnie