Timestamp field overrides
Two-part fix per the plan (ambient / opt-in split). Ambient: default-fields injects :sortable t on exactly :created-at / :updated-at (fresh rt_ tables get the sort indexes at creation; pre-existing tables sort unindexed, the same caveat as "Sortable :name and :email"). Opt-in: redeclaring :created-at / :updated-at in :fields is a presentation override — author plist merges over the injected def (add-to-plist, author keys win), restricted to :ui and :sortable (new *default-field-override-keys*); :ui required with :read-only t and :widget :textbox or omitted; :sortable nil rejected with the Model-value-vocabulary deferral named; :id redeclaration is a compile error naming the v1 exclusion; duplicate injected-key redeclarations signal (no silent first-wins). New validator valid-default-field-override (+ walk) runs on the raw author :fields in compile-base-type-def.
Kimi's blocker (adding :ui would enroll the timestamps in INSERT/UPDATE SQL via the (:column :ui) selection) is fixed by dml-fields (model.lisp): insert-sql / update-sql main column lists now exclude :created-at / :updated-at by explicit key, with or without an override — updated_at's sole writer is the trigger again, and created_at is never bound on UPDATE. The :id DML plumbing (base-dropped / retained on INSERT, appended on UPDATE) is untouched and pinned by tests.
Wire: fe-fields needed nothing — the merged :ui opens the widget gate, :sortable was already emitted; the base :users list form still returns (:name :email :roles) (nothing renders by itself). Tests: tests/timestamp-override-tests.lisp (two suites, 92 checks: compile probes bare, wire/behavior on the new timestamp-override-test fixture), run-timestamp-override-tests in run-tests; DML exclusion pinned as the 5a regression guard, behavior probes are labeled smoke per the plan's determinism analysis. Docs: docs/model-reference.md (:sortable row, Default fields section with the override grammar, :users row). Full suite green (2414 checks / 46 groups). Plan: timestamp-field-overrides-plan.org.
Authors today cannot present the injected :created-at / :updated-at fields: fe-fields drops any field without a :ui widget (backend.lisp, the (or (getf ui :widget) …) gate), so the timestamps never reach the wire even when named in a form — the base model's own :users list form names them and gets only (:name :email :roles) back. And an author who does write :created-at (:ui …) is silently ignored: add-default-fields blind-appends the injected defs ahead of author fields, getf returns the injected copy, and the author's plist is dead weight — no error, no effect. Neither field is :sortable t either (live-verified 2026-10-23), so no list anywhere can be ordered or reversed by date, and a :sort / :default-sort referencing them fails validation.
Two-part fix (the ambient / opt-in split, settled 2026-10-23):
- Ambient
:sortable t:default-fields(model.lisp) injects:sortable ton exactly the two timestamps — not a general "all fields sortable" default; every author field keeps today's opt-in rule. Nothing renders by itself::sortableaffects SQL legality and header clicks only, and the field still needs a:uiwidget to appear on the wire. Freshrt_tables get the sort index at creation; pre-existing built-ins (:users) sort unindexed — the same caveat as "Sortable:nameand:email", performance not correctness. - Opt-in
:uivia override: redeclaring an injected field key merges the author plist over the injected def (author keys win,add-to-plistsemantics — the base-type:type-rolesoverlay precedent), restricted to presentation keys::uiand:sortablelegal; anything structural (:type,:default,:not-null,:update,:source) is a compile error — the injection's contract cannot be reshaped.:idstays out of scope in v1. Blog fixture spelling::created-at (:ui (:label "Posted" :widget :textbox :read-only t))on comments — no:sortable tneeded.
The blog surface depends on this (its :sort (:created-at :asc), the comments tab's :default-sort (:created-at :desc), and the Created column all ride it); place it in the run-up before "Embedded child region". Also fixes the general "reverse the records" question: name Created in a list form, click the header.
Plan: timestamp-field-overrides-plan.org
- Slot
- 3700
- Status
- 60 Done
- Tags
- mvp, model, compiler
- Contributors
- Donnie, Rose, Grok
- Plans
- Timestamp field overrides (3), Timestamp field overrides (2), Timestamp field overrides