Data UI Backlog

Multiple M2M per type

When a type has more than one M2M joiner (e.g. :chores has both :chore-tags and :chore-users), the compiler generates incorrect insert SQL for each joiner. Each joiner's INSERT statement includes columns from all joiners on the type, not just its own two FK columns.

Example from the chores model (two joiners: chore-tags and :chore-users):

COMPLETED-BY → insert into rt_chore_users
  (chore_id, user_id, chore_id, tag_id) values ($1, $2, $3, $4)
TAGS         → insert into rt_chore_tags
  (chore_id, user_id, chore_id, tag_id) values ($1, $2, $3, $4)

Both statements have 4 columns — a union of all joiner FK columns. Each should have only its own two (chore_id, tag_id for one; :chore_id, user_id for the other). The param-key lists are also merged (CHORE-ID USER-ID CHORE-ID TAG-ID for both).

This causes be-insert to fail with NO-APPLICABLE-METHOD-ERROR on rbac:get-id because the backend tries to resolve values against the wrong columns.

The existing todos model only has one joiner (todo-tags), so this has never been exercised. The compiler bug is in the join-table insert SQL generation in lisp/model.lisp — it does not isolate joiners from each other when building per-joiner INSERT statements.

Until fixed, models are limited to one M2M joiner per type (see docs/model-reference.md → Join tables).

;; Ordered for impress-MVP (Dec 2026 video / new-user wow). Priority ;; bands: demo wow → product feel → real-app capability → author ;; friction → correctness footguns → scale/polish.

Slot
23100
Status
60 Done
Tags
mvp, backend, compiler, bug
Contributors
Donnie