Skip to content

Self-hosted project management for devs and their clients: tickets, time tracking, docs and meetings, with an AI assistant that cites its sources. AGPL-3.0.

feat(glossary): add the glossary right with GlossaryPolicy

Guido Boyke63db707c89e9
diff --git a/.github/workflows/guards.yml b/.github/workflows/guards.yml
index 2d5d9f8..13e7fa7 100644
--- a/.github/workflows/guards.yml
+++ b/.github/workflows/guards.yml
@@ -346,6 +346,7 @@ jobs:
spec/models/person_spec.rb
spec/models/glossary_term_spec.rb
spec/models/term_correction_spec.rb
+ spec/requests/organisations/roles_glossary_right_spec.rb
spec/requests/organisations/people_spec.rb
spec/requests/organisations/shown_email_spec.rb
spec/requests/user_preferences_email_visibility_spec.rb
diff --git a/app/helpers/roles_helper.rb b/app/helpers/roles_helper.rb
index 710e233..1201b3e 100644
--- a/app/helpers/roles_helper.rb
+++ b/app/helpers/roles_helper.rb
@@ -48,6 +48,10 @@ module RolesHelper
'people' => {
'view_people' => I18n.t('views.helpers.roles.descriptions.people.view_people'),
'manage_people' => I18n.t('views.helpers.roles.descriptions.people.manage_people')
+ },
+ 'glossary' => {
+ 'view_glossary' => I18n.t('views.helpers.roles.descriptions.glossary.view_glossary'),
+ 'manage_glossary' => I18n.t('views.helpers.roles.descriptions.glossary.manage_glossary')
}
}
@@ -63,7 +67,8 @@ module RolesHelper
'meetings' => I18n.t('views.helpers.roles.categories.meetings'),
'users' => I18n.t('views.helpers.roles.categories.users'),
'assistant' => I18n.t('views.helpers.roles.categories.assistant'),
- 'people' => I18n.t('views.helpers.roles.categories.people')
+ 'people' => I18n.t('views.helpers.roles.categories.people'),
+ 'glossary' => I18n.t('views.helpers.roles.categories.glossary')
}
names[category] || category.humanize
diff --git a/app/models/glossary_term.rb b/app/models/glossary_term.rb
index 04bc0c6..91dddc1 100644
--- a/app/models/glossary_term.rb
+++ b/app/models/glossary_term.rb
@@ -26,6 +26,12 @@ class GlossaryTerm < ApplicationRecord
enum :status, STATUSES.index_by(&:itself), validate: true
+ # Terms and heard forms share one right (GlossaryPolicy), for authorize,
+ # policy and policy_scope alike.
+ def self.policy_class
+ GlossaryPolicy
+ end
+
before_validation :normalize_term
validates :term, presence: true, length: { maximum: MAX_LENGTH }
diff --git a/app/models/permission.rb b/app/models/permission.rb
index 40786e6..089004f 100644
--- a/app/models/permission.rb
+++ b/app/models/permission.rb
@@ -101,15 +101,26 @@ class Permission < ApplicationRecord
people: %w[
view_people
manage_people
+ ],
+ # The glossary of the organisation (GlossaryTerm, K4a). Its own category
+ # for the same reason as :people: an action under :projects would join the
+ # guest ceiling's forbidden list, and whether a billable: false role may
+ # read or keep the glossary is the admin's choice. manage_glossary (create,
+ # change, confirm, reject, merge, delete) implies view_glossary
+ # (IMPLIED_BY). No role gets either automatically; account admins need none.
+ glossary: %w[
+ view_glossary
+ manage_glossary
]
}.freeze
# A right that another right includes: [category, action] => the actions of
- # the same category that grant it too. Asked by PersonPolicy (who may view)
- # and RolePolicy#change_permission? (who may grant it), so the two cannot
- # disagree.
+ # the same category that grant it too. Asked by PersonPolicy and
+ # GlossaryPolicy (who may view) and RolePolicy#change_permission? (who may
+ # grant it), so the two cannot disagree.
IMPLIED_BY = {
- %w[people view_people] => %w[manage_people]
+ %w[people view_people] => %w[manage_people],
+ %w[glossary view_glossary] => %w[manage_glossary]
}.freeze
# The actions of a category that grant [category, action]: itself and every
diff --git a/app/models/term_correction.rb b/app/models/term_correction.rb
index 1c34c2c..843f6b9 100644
--- a/app/models/term_correction.rb
+++ b/app/models/term_correction.rb
@@ -38,6 +38,12 @@ class TermCorrection < ApplicationRecord
DIGEST_FORMAT = /\A\h{64}\z/
+ # Terms and heard forms share one right (GlossaryPolicy), for authorize,
+ # policy and policy_scope alike.
+ def self.policy_class
+ GlossaryPolicy
+ end
+
before_validation :normalize_heard
validates :heard, presence: true, length: { maximum: GlossaryTerm::MAX_LENGTH }
diff --git a/app/policies/glossary_policy.rb b/app/policies/glossary_policy.rb
new file mode 100644
index 0000000..856ef72
--- /dev/null
+++ b/app/policies/glossary_policy.rb
@@ -0,0 +1,104 @@
+# frozen_string_literal: true
+
+# The glossary of an organisation (GlossaryTerm and its heard forms,
+# TermCorrection; K4a). A right of its own (Permission::CATEGORIES[:glossary],
+# E2): account admins have it without a row, every other role only when an
+# admin grants it; no role gets it by itself. manage_glossary (create, change,
+# confirm, reject, merge, delete) implies view_glossary
+# (Permission::IMPLIED_BY). Grantable to billable: false roles.
+#
+# view_glossary shows the WHOLE glossary with its heard forms, speakers and
+# projects, also from projects the reader may not read (E3). The title and the
+# link of a meeting are not part of that: they need read access to the
+# meeting (MeetingPolicy), and the link to a person needs view_people
+# (PersonPolicy). Both are asked where they are shown.
+#
+# Every predicate asks for an ACTIVE membership itself:
+# User#has_permission_in_organisation? reads the role and does not look at
+# membership.active (the reason of PersonPolicy).
+class GlossaryPolicy < ApplicationPolicy
+ class Scope < ApplicationPolicy::Scope
+ # The rows of this organisation (terms or heard forms), nothing without
+ # the right.
+ def resolve
+ return scope.none unless organisation && GlossaryPolicy.view_allowed?(user, organisation)
+
+ scope.where(organisation: organisation)
+ end
+ end
+
+ def self.view_allowed?(user, organisation)
+ return false unless user.active_member_of_organisation?(organisation)
+
+ user.account_admin_in?(organisation) ||
+ Permission.granting_actions('glossary', 'view_glossary').any? do |action|
+ user.has_permission_in_organisation?(organisation, 'glossary', action)
+ end
+ end
+
+ def self.manage_allowed?(user, organisation)
+ return false unless user.active_member_of_organisation?(organisation)
+
+ user.account_admin_in?(organisation) ||
+ user.has_permission_in_organisation?(organisation, 'glossary', 'manage_glossary')
+ end
+
+ def index?
+ can_view?
+ end
+
+ def show?
+ can_view? && same_organisation?
+ end
+
+ def create?
+ can_manage?
+ end
+
+ def new?
+ create?
+ end
+
+ def update?
+ can_manage? && same_organisation?
+ end
+
+ def edit?
+ update?
+ end
+
+ def destroy?
+ update?
+ end
+
+ def confirm?
+ update?
+ end
+
+ def reject?
+ update?
+ end
+
+ def merge?
+ update?
+ end
+
+ private
+
+ def can_view?
+ return false unless organisation
+
+ self.class.view_allowed?(user, organisation)
+ end
+
+ def can_manage?
+ return false unless organisation
+
+ self.class.manage_allowed?(user, organisation)
+ end
+
+ # A term or a heard form of the current organisation, never a class.
+ def same_organisation?
+ (record.is_a?(GlossaryTerm) || record.is_a?(TermCorrection)) && record.organisation_id == organisation.id
+ end
+end
diff --git a/app/views/organisations/roles/edit.html.erb b/app/views/organisations/roles/edit.html.erb
index 854a7ca..5c20216 100644
--- a/app/views/organisations/roles/edit.html.erb
+++ b/app/views/organisations/roles/edit.html.erb
@@ -135,6 +135,7 @@
when 'users' then 'bi-people'
when 'assistant' then 'bi-chat-square-text'
when 'people' then 'bi-person-vcard'
+ when 'glossary' then 'bi-book'
else 'bi-list-check'
end %>
<i class="bi <%= category_icon %> text-xl mr-2"></i>
diff --git a/config/locales/views_extracted.de.yml b/config/locales/views_extracted.de.yml
index fb0998c..8575c89 100644
--- a/config/locales/views_extracted.de.yml
+++ b/config/locales/views_extracted.de.yml
@@ -201,6 +201,9 @@ de:
people:
view_people: Personen ansehen
manage_people: Personen bearbeiten (inkl. Löschen)
+ glossary:
+ view_glossary: Glossar ansehen, mit den gehörten Formen, Sprechern und Projekten aller Meetings der Organisation
+ manage_glossary: Glossar pflegen (Begriffe anlegen, ändern, bestätigen, verwerfen, zusammenführen und löschen)
none_available: Keine Beschreibung verfügbar
categories:
assistant: Assistent
@@ -210,6 +213,7 @@ de:
meetings: Meetings
users: Benutzer
people: Personen
+ glossary: Glossar
layouts:
docs:
title_with_page: "%{page} · Lalabase Docs"
diff --git a/config/locales/views_extracted.en.yml b/config/locales/views_extracted.en.yml
index 8270d41..2e4dcc5 100644
--- a/config/locales/views_extracted.en.yml
+++ b/config/locales/views_extracted.en.yml
@@ -195,6 +195,9 @@ en:
people:
view_people: View people
manage_people: Edit people (including delete)
+ glossary:
+ view_glossary: View the glossary, with the heard forms, speakers and projects of every meeting of the organisation
+ manage_glossary: Keep the glossary (create, change, confirm, reject, merge and delete terms)
none_available: No description available
categories:
assistant: Assistant
@@ -204,6 +207,7 @@ en:
meetings: Meetings
users: Users
people: People
+ glossary: Glossary
layouts:
docs:
title_with_page: "%{page} · Lalabase Docs"
diff --git a/spec/models/permission_spec.rb b/spec/models/permission_spec.rb
index c704e14..8aa549c 100644
--- a/spec/models/permission_spec.rb
+++ b/spec/models/permission_spec.rb
@@ -448,4 +448,33 @@ RSpec.describe Permission, type: :model do
end
end
end
+
+ # The glossary (K4a): its own category for the same reason as :people. No
+ # role gets it by itself; whether a guest role may hold it is the admin's
+ # choice, so it stays off the guest ceiling list.
+ describe 'glossary category' do
+ it 'knows view_glossary and manage_glossary' do
+ expect(Permission::CATEGORIES[:glossary]).to eq(%w[view_glossary manage_glossary])
+ end
+
+ it 'is not on the guest ceiling list' do
+ expect(Role::FORBIDDEN_BILLABLE_FALSE_CATEGORIES).not_to include('glossary')
+ end
+
+ it 'lets manage_glossary grant view_glossary, and not the other way round' do
+ expect(Permission.granting_actions('glossary', 'view_glossary')).to eq(%w[view_glossary manage_glossary])
+ expect(Permission.granting_actions('glossary', 'manage_glossary')).to eq(%w[manage_glossary])
+ end
+
+ %w[view_glossary manage_glossary].each do |action|
+ it "stays grantable to a billable: false role (#{action})" do
+ ActsAsTenant.with_tenant(organisation) do
+ guest_role = create(:role, billable: false)
+ permission = build(:permission, role: guest_role, category: 'glossary', action: action, allowed: true)
+
+ expect(permission).to be_valid
+ end
+ end
+ end
+ end
end
diff --git a/spec/models/role_spec.rb b/spec/models/role_spec.rb
index fb2b018..8ba1b01 100644
--- a/spec/models/role_spec.rb
+++ b/spec/models/role_spec.rb
@@ -124,6 +124,16 @@ RSpec.describe Role, type: :model do
expect(role).to be_valid
end
+ it 'allows billable: false with glossary-category permissions (the admin decides for guest roles)' do
+ role = create(:role, billable: true)
+ create(:permission, role: role, category: 'glossary', action: 'view_glossary', allowed: true)
+ create(:permission, role: role, category: 'glossary', action: 'manage_glossary', allowed: true)
+
+ role.billable = false
+
+ expect(role).to be_valid
+ end
+
it 'does not block a non-billable role with no forbidden permissions' do
role = build(:role, billable: false)
diff --git a/spec/policies/glossary_policy_spec.rb b/spec/policies/glossary_policy_spec.rb
new file mode 100644
index 0000000..4317ac9
--- /dev/null
+++ b/spec/policies/glossary_policy_spec.rb
@@ -0,0 +1,138 @@
+# frozen_string_literal: true
+
+require 'rails_helper'
+
+# The glossary is a right of its own (E2): account admins without a row,
+# everyone else only with view_glossary / manage_glossary, and only while the
+# membership is active. Invented words only.
+RSpec.describe GlossaryPolicy, :ci_guard, type: :policy do
+ let(:organisation) { create(:organisation) }
+ let(:other_organisation) { create(:organisation) }
+
+ before { ActsAsTenant.current_tenant = organisation }
+ after { ActsAsTenant.current_tenant = nil }
+
+ let(:reads) { %i[index? show?] }
+ let(:all_predicates) { reads + %i[create? update? destroy? confirm? reject? merge?] }
+
+ def role_with(*actions, billable: true, title: nil)
+ role = create(:role, organisation: organisation, billable: billable, **{ title: title }.compact)
+ actions.each { |action| create(:permission, role: role, category: 'glossary', action: action, allowed: true) }
+ role
+ end
+
+ def member_with(role, active: true)
+ user = create(:user)
+ create(:membership, user: user, organisation: organisation, role: role, active: active)
+ User.find(user.id)
+ end
+
+ let(:admin) { member_with(role_with(title: Role::ACCOUNT_ADMIN_TITLE)) }
+ let(:viewer) { member_with(role_with('view_glossary')) }
+ let(:manager) { member_with(role_with('manage_glossary')) }
+ let(:nobody) { member_with(role_with) }
+ let(:term) { create(:glossary_term, organisation: organisation) }
+
+ def allowed(user, record = term)
+ policy = described_class.new(user, record)
+ all_predicates.select { |predicate| policy.public_send(predicate) }
+ end
+
+ it 'is the policy of terms and heard forms' do
+ expect(Pundit::PolicyFinder.new(GlossaryTerm).policy).to eq(described_class)
+ expect(Pundit::PolicyFinder.new(TermCorrection.new).policy).to eq(described_class)
+ end
+
+ it 'lets an account admin do everything without a permission row' do
+ expect(Permission.where(category: 'glossary').exists?).to be(false)
+ expect(allowed(admin)).to eq(all_predicates)
+ end
+
+ it 'lets view_glossary read, not write' do
+ expect(allowed(viewer)).to eq(reads)
+ end
+
+ it 'lets manage_glossary read and write (it implies view_glossary)' do
+ expect(allowed(manager)).to eq(all_predicates)
+ expect(described_class.view_allowed?(manager, organisation)).to be(true)
+ end
+
+ it 'denies a member without the right' do
+ expect(allowed(nobody)).to be_empty
+ end
+
+ it 'does not count the people right' do
+ role = create(:role, organisation: organisation)
+ %w[view_people manage_people].each do |action|
+ create(:permission, role: role, category: 'people', action: action, allowed: true)
+ end
+
+ expect(allowed(member_with(role))).to be_empty
+ end
+
+ it 'lets a guest role (billable: false) with the right use it' do
+ expect(allowed(member_with(role_with('view_glossary', billable: false)))).to eq(reads)
+ expect(allowed(member_with(role_with('manage_glossary', billable: false)))).to eq(all_predicates)
+ end
+
+ it 'denies a deactivated member who still holds the right' do
+ expect(allowed(member_with(role_with('view_glossary'), active: false))).to be_empty
+ expect(allowed(member_with(role_with('manage_glossary'), active: false))).to be_empty
+ end
+
+ it 'denies a deactivated account admin' do
+ expect(allowed(member_with(role_with(title: Role::ACCOUNT_ADMIN_TITLE), active: false))).to be_empty
+ end
+
+ it 'denies a member of another organisation' do
+ stranger = create(:user)
+ ActsAsTenant.with_tenant(other_organisation) do
+ role = create(:role, organisation: other_organisation, title: Role::ACCOUNT_ADMIN_TITLE)
+ create(:membership, user: stranger, organisation: other_organisation, role: role)
+ end
+
+ expect(allowed(User.find(stranger.id))).to be_empty
+ end
+
+ it 'answers no for a term or a heard form of another organisation' do
+ foreign_term, foreign_correction = ActsAsTenant.with_tenant(other_organisation) do
+ found = create(:glossary_term, organisation: other_organisation)
+ [found, create(:term_correction, organisation: other_organisation, glossary_term: found)]
+ end
+
+ expect(allowed(admin, foreign_term)).to eq(%i[index? create?])
+ expect(allowed(admin, foreign_correction)).to eq(%i[index? create?])
+ end
+
+ it 'answers for a heard form of this organisation like for its term' do
+ correction = create(:term_correction, organisation: organisation, glossary_term: term)
+
+ expect(allowed(viewer, correction)).to eq(reads)
+ expect(allowed(manager, correction)).to eq(all_predicates)
+ end
+
+ describe 'Scope' do
+ let!(:mine) { term }
+ let!(:theirs) { ActsAsTenant.with_tenant(other_organisation) { create(:glossary_term, organisation: other_organisation) } }
+
+ def rows(user, model = GlossaryTerm)
+ described_class::Scope.new(user, model).resolve
+ end
+
+ it 'lists the terms of this organisation with the right' do
+ expect(rows(viewer)).to contain_exactly(mine)
+ expect(rows(manager)).to contain_exactly(mine)
+ expect(rows(admin)).to contain_exactly(mine)
+ end
+
+ it 'lists the heard forms of this organisation with the right' do
+ correction = create(:term_correction, organisation: organisation, glossary_term: mine)
+
+ expect(rows(viewer, TermCorrection)).to contain_exactly(correction)
+ end
+
+ it 'lists nothing without the right' do
+ expect(rows(nobody)).to be_empty
+ end
+ end
+end
diff --git a/spec/policies/inactive_membership_scope_guard_spec.rb b/spec/policies/inactive_membership_scope_guard_spec.rb
index b9d6230..9d8f2af 100644
--- a/spec/policies/inactive_membership_scope_guard_spec.rb
+++ b/spec/policies/inactive_membership_scope_guard_spec.rb
@@ -116,6 +116,25 @@ RSpec.describe 'Policy scopes and a deactivated membership', :ci_guard, type: :p
end
end
+ # The glossary (K4a) has no project either: GlossaryPolicy::Scope asks the
+ # membership itself (GlossaryPolicy.view_allowed?), for terms and heard forms.
+ describe 'GlossaryPolicy::Scope' do
+ let!(:term) { create(:glossary_term, organisation: organisation) }
+ let!(:correction) { create(:term_correction, organisation: organisation, glossary_term: term, project: project) }
+
+ it 'drops the terms and heard forms once the membership is deactivated' do
+ create(:permission, role: role, category: 'glossary', action: 'view_glossary', allowed: true)
+
+ expect(rows(GlossaryPolicy::Scope, GlossaryTerm)).to include(term)
+ expect(rows(GlossaryPolicy::Scope, TermCorrection)).to include(correction)
+
+ membership.update!(active: false)
+
+ expect(rows(GlossaryPolicy::Scope, GlossaryTerm)).to be_empty
+ expect(rows(GlossaryPolicy::Scope, TermCorrection)).to be_empty
+ end
+ end
+
describe 'ChatPolicy::Scope' do
let!(:org_thread) { create(:chat, user: user, organisation: organisation) }
diff --git a/spec/policies/role_policy_spec.rb b/spec/policies/role_policy_spec.rb
index 4f6d77f..c729551 100644
--- a/spec/policies/role_policy_spec.rb
+++ b/spec/policies/role_policy_spec.rb
@@ -336,5 +336,20 @@ RSpec.describe RolePolicy, :ci_guard, type: :policy do
expect(may_change?(editor, 'people', 'view_people')).to be(true)
expect(may_change?(editor, 'people', 'manage_people')).to be(false)
end
+
+ # The glossary (K4a) follows the same rule through the same table.
+ it 'lets an editor with manage_glossary change view_glossary too' do
+ editor = editor_with(%w[glossary manage_glossary])
+
+ expect(may_change?(editor, 'glossary', 'view_glossary')).to be(true)
+ expect(may_change?(editor, 'glossary', 'manage_glossary')).to be(true)
+ end
+
+ it 'does not turn view_glossary into manage_glossary' do
+ editor = editor_with(%w[glossary view_glossary])
+
+ expect(may_change?(editor, 'glossary', 'view_glossary')).to be(true)
+ expect(may_change?(editor, 'glossary', 'manage_glossary')).to be(false)
+ end
end
end
diff --git a/spec/requests/organisations/roles_glossary_right_spec.rb b/spec/requests/organisations/roles_glossary_right_spec.rb
new file mode 100644
index 0000000..30fe331
--- /dev/null
+++ b/spec/requests/organisations/roles_glossary_right_spec.rb
@@ -0,0 +1,46 @@
+# frozen_string_literal: true
+
+require 'rails_helper'
+
+# The glossary right in the role editor (K4a, plan §9): both actions appear
+# with their descriptions in German and English, and an admin can grant them
+# to a guest role (billable: false).
+RSpec.describe 'Glossary right in the role editor', :ci_guard, type: :request do
+ let(:organisation) { create(:organisation) }
+ let(:admin) { create(:user) }
+ let(:guest_role) do
+ ActsAsTenant.with_tenant(organisation) { create(:role, organisation: organisation, title: 'Kunde', billable: false) }
+ end
+
+ before do
+ ActsAsTenant.with_tenant(organisation) do
+ create(:membership, organisation: organisation, user: admin, role: create(:admin_role, organisation: organisation))
+ end
+ sign_in admin
+ end
+
+ %w[de en].each do |locale|
+ it "lists the category with both rights and their descriptions (#{locale})" do
+ get edit_organisation_role_path(organisation, guest_role, locale: locale)
+
+ expect(response).to have_http_status(:ok)
+ I18n.with_locale(locale) do
+ expect(response.body).to include(ERB::Util.html_escape(I18n.t('views.helpers.roles.categories.glossary')))
+ %w[view_glossary manage_glossary].each do |action|
+ expect(response.body).to include("permissions[glossary][#{action}]")
+ expect(response.body).to include(ERB::Util.html_escape(I18n.t("views.helpers.roles.descriptions.glossary.#{action}")))
+ end
+ end
+ end
+ end
+
+ it 'grants both rights to a guest role' do
+ patch organisation_role_path(organisation, guest_role),
+ params: { role: { title: guest_role.title }, permissions: { glossary: { view_glossary: '1', manage_glossary: '1' } } }
+
+ allowed = ActsAsTenant.with_tenant(organisation) do
+ guest_role.permissions.reload.where(category: 'glossary', allowed: true).pluck(:action)
+ end
+ expect(allowed).to contain_exactly('view_glossary', 'manage_glossary')
+ end
+end
diff --git a/spec/support/prosopite.rb b/spec/support/prosopite.rb
index a046b3f..e052439 100644
--- a/spec/support/prosopite.rb
+++ b/spec/support/prosopite.rb
@@ -61,7 +61,7 @@ Prosopite.allow_stack_paths = [
'signal_count_in_organisation', # Notifications::UnreadSignals: one access-filtered count per OTHER organisation that has unread notifications at all (a grouped query decides first), bounded by the user's org count; the per-tenant loop of aggregate_org_slice, for the org switcher dot
'refresh_later', # Notifications::UnreadSignals.refresh_later: one UnreadSignalsJob per recipient of an in-app notification (fanout of a comment, bulk_transition!), bounded by the recipients of one event. The job carries limits_concurrency, and Solid Queue dispatches such jobs one by one even from perform_all_later (dispatch_all_one_by_one), so each enqueue reads its own semaphore — not a request N+1
'personal_tasks_for_org', # Dashboard::PersonalTaskRollup: one open-to-dos read per org for the cockpit roll-up (bounded by the user's org count) — the repeated identical SQL is the intentional per-tenant loop, not a per-record N+1
- 'role_permission_sync', # RolePermissionSync: one find_or_initialize_by per submitted permission when saving a role's permissions; bounded by Permission::CATEGORIES (~30 actions), not an unbounded request N+1
+ 'role_permission_sync', # RolePermissionSync: one find_or_initialize_by per submitted permission when saving a role's permissions; bounded by Permission::CATEGORIES (32 actions on 2026-11-04), not an unbounded request N+1
'share_with', # SmartFolder#share_with, called per user by Actors::ShareSmartFolder: one find_or_initialize_by (share existence check) per user when sharing a folder with the picked set — bounded by the handful of users a person selects, each share is an independent write, not a request N+1
'create_tutorial_tickets', # Actors::SeedOnboarding: one create! per tutorial ticket (bounded by the ~4 content entries, runs once per registration) — per-record callbacks (numbering, activities) are the point, not a request N+1
'assign_to_user_as_system', # Actors::SeedOnboarding: one TicketAssignmentSync per tutorial ticket (same bounded seed loop as above)