Problem
channel.rs is 3,419 lines mixing two concerns backed by different database tables:
- Channel CRUD (~1,200 lines,
channels table): create_channel, get_channel, update_channel, archive_channel, list_channels, set_topic, set_purpose, etc.
- Membership management (~1,500 lines,
channel_members table): add_member, remove_member, is_member, get_members, get_accessible_channel_ids, lock_member_snapshot, get_member_role, advisory-lock helpers, roster fence verification
Plus ~700 lines of tests.
Proposed change
Split into:
channel.rs — channel CRUD, types (ChannelRecord, ChannelUpdate, AccessibleChannel), and channel-scoped queries
channel_members.rs — membership operations, types (MemberRecord, LockedMemberSnapshot, BotMemberRecord), advisory-lock helpers, roster fence verification
Priority
Medium — second-largest domain file with a clear natural seam at the table boundary.
🤖 AI review update (2026-08-23)
The seam is valid. Split channel CRUD from membership/roster locking as one self-contained #2 slice, moving the relevant tests and datastore spans in the same PR. Keep TTL/channel-lifecycle locking with the domain that owns its invariant rather than grouping solely by table name.
Problem
channel.rsis 3,419 lines mixing two concerns backed by different database tables:channelstable):create_channel,get_channel,update_channel,archive_channel,list_channels,set_topic,set_purpose, etc.channel_memberstable):add_member,remove_member,is_member,get_members,get_accessible_channel_ids,lock_member_snapshot,get_member_role, advisory-lock helpers, roster fence verificationPlus ~700 lines of tests.
Proposed change
Split into:
channel.rs— channel CRUD, types (ChannelRecord,ChannelUpdate,AccessibleChannel), and channel-scoped querieschannel_members.rs— membership operations, types (MemberRecord,LockedMemberSnapshot,BotMemberRecord), advisory-lock helpers, roster fence verificationPriority
Medium — second-largest domain file with a clear natural seam at the table boundary.
🤖 AI review update (2026-08-23)
The seam is valid. Split channel CRUD from membership/roster locking as one self-contained #2 slice, moving the relevant tests and datastore spans in the same PR. Keep TTL/channel-lifecycle locking with the domain that owns its invariant rather than grouping solely by table name.