Skip to content

fix(love): use addCollection/createTxCollectionCUD for MeetingMinutes creation#10527

Open
spatialy wants to merge 1 commit intohcengineering:developfrom
spatialy:fix/meeting-minutes-collection-counter-10526
Open

fix(love): use addCollection/createTxCollectionCUD for MeetingMinutes creation#10527
spatialy wants to merge 1 commit intohcengineering:developfrom
spatialy:fix/meeting-minutes-collection-counter-10526

Conversation

@spatialy
Copy link
Contributor

@spatialy spatialy commented Feb 18, 2026

Summary

Fixes #10526. Also related to #8785 and #7303.

After a meeting ends the Room detail view always showed "No meeting minutes" even when MeetingMinutes documents existed in the database. The MeetingMinutesSection.svelte component gates rendering on meetings > 0, but that counter was never incremented because MeetingMinutes were created with createDoc/createTxCreateDoc instead of addCollection/createTxCollectionCUD.

The collection counter trigger in server/middleware/triggers.ts (processCollection) only fires when attachedTo, attachedToClass, and collection are top-level transaction properties — which only TxCollectionCUD provides. createDoc / createTxCreateDoc puts those fields inside attributes (the document data), so the trigger never fires and the Room counter stays at 0.

Changes

  • models/love/src/index.ts — change @Model parent from core.class.Doccore.class.AttachedDoc so hierarchy.isDerived(love.class.MeetingMinutes, core.class.AttachedDoc) returns true
  • plugins/love-resources/src/meetings.ts — replace client.createDoc(...) with client.addCollection(...) for client-side MeetingMinutes creation
  • server-plugins/love-resources/src/index.ts — wrap the createTxCreateDoc in a createTxCollectionCUD so the server-side trigger correctly increments the Room's meetings counter

Test plan

  • Start a meeting in a Room, enable transcription, speak for 30+ seconds, then end the meeting
  • Room detail page → "Meeting minutes" section shows the meeting (not "No meeting minutes")
  • meetings counter on the Room document increments correctly after each meeting
  • Existing MeetingMinutes documents and transcription data are unaffected
  • Office rooms still create MeetingMinutes correctly
  • Collaborators are still attached to newly created MeetingMinutes

Workaround for existing deployments

For self-hosted CockroachDB deployments where the counter is already stuck at 0, run:

UPDATE love
SET data = jsonb_set(COALESCE(data, '{}'::jsonb), '{meetings}', (
    SELECT COALESCE(to_jsonb(count(*)), '0'::jsonb)
    FROM meeting_minutes
    WHERE "attachedTo" = love._id
    AND "workspaceId" = love."workspaceId"
)::jsonb)
WHERE _class IN ('love:class:Room', 'love:class:Office');

@huly-github-staging
Copy link

Connected to Huly®: UBERF-15586

… creation

MeetingMinutes were created via createDoc/createTxCreateDoc, which stores
attachedTo/attachedToClass/collection inside the document attributes rather
than as top-level transaction properties. The collection counter trigger in
server/middleware/triggers.ts only fires when those fields are top-level,
so the Room's `meetings` counter was never incremented and the
MeetingMinutesSection.svelte guard (`meetings > 0`) always fell through to
"No meeting minutes".

- models/love: change @model parent from core.class.Doc to
  core.class.AttachedDoc so hierarchy.isDerived works correctly
- plugins/love-resources: replace client.createDoc with client.addCollection
- server-plugins/love-resources: wrap createTxCreateDoc in createTxCollectionCUD

Fixes hcengineering#10526
Related hcengineering#8785, hcengineering#7303

Signed-off-by: Yulian Diaz <5605867+spatialy@users.noreply.github.com>
@spatialy spatialy force-pushed the fix/meeting-minutes-collection-counter-10526 branch from d13f324 to 7b864a6 Compare February 18, 2026 17:46
@aonnikov
Copy link
Member

I think the counter is less of a problem. All meeting minutes documents have to be converted to AttachedDoc with proper attachedTo and attachedToClass properties set. We usually do this via migrations.

https://github.com/hcengineering/platform/blob/develop/models/love/src/migration.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Meeting minutes not shown in Room view - collection counter never incremented

2 participants