Text chat 19: core-dms-settings (#269) #350
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "textchat-19-core-dms-settings"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What this builds
fluxer-coreDMs, relationships and chat settings (spec §6.2 "DMs" and "Settings", §3.8, §9.8 core side).CreateDm(one recipient opens or selects the DM; several make a group DM, capped at the instance'smax_group_dm_recipients - 1),AddRecipientsup to the free places,RemoveRecipient(owner only),CloseDmremoves the channel locally on success,EditGroupDm(name at most 100 chars; icon static images only, sent as a data URI).RELATIONSHIP_*events andGET /users/@me/relationships(app.chat.dms.relationships);CHANNEL_RECIPIENT_ADD|REMOVEupdaterecipients.dm_row(with the #207 avatar cluster of 2 or 3 avatars),dm_name,dm_welcome,friend_picker(friends only, query filter,selected,max).ChatSettings(every Advanced chat control of §3.8 with the original's defaults) inLocalSettings::chat. Synced display settings (render_embeds,inline_attachment_media,inline_embed_media,render_reactions,render_spoilers,sanitize_urls) are read fromuser_settings/prefs and written withPATCH /users/@me/settings. Changes show at once and revert on failure.sanitize_urlsgoes through the synced preferences, and only field 82 is rewritten. Older settings files still load.Testing
crates/fluxer-core/tests/chat_dms.rshas 7 tests andcrates/fluxer-core/tests/chat_settings.rshas 3, as named in the plan. I wrote them first and confirmed they failed before writing the code.FLUXER_SCREENSHOT_TESTS=1 cargo xtask cipasses locally after merging the currentorigin/textchat(9fcc13d).Deviations / files outside the Files list
effect.rs: newApiRequest::EditGroupDmIcon { channel_id, name, icon: FileRef }. The store holds no file bytes, so the runtime (Text chat 21) reads the file and builds thedata:URI. Task 21 needs to execute this request.event.rs: newUserAction::{OpenFriendPicker(Option<Snowflake>), ToggleFriendPick(Snowflake), CloseFriendPicker}for the friend picker modal state.app.rs/chat/mod.rs/chat/state.rs:Chat::display: SyncedDisplay(the shown synced display values), the settings reducer split, and DM follow-ups (selecting a newly opened DM) after the reduce pass.persist.rstakes&ChatSettingssoSetChatSettingsaves the local settings.tests/chat_ports.rs:stubs_emit_nothingnow skipsCreateDm, which is no longer a stub.Review follow-up (head
1630a19)ChatSettingsnow hashide_muted_channels_by_default(default false,UserSettings.defaultHideMutedChannels; stored only, channel muting comes later) andupload_attachments_before_sending: Option<bool>(PrivacyPreferences.preuploadMessageAttachments). When it is unset,ChatSettings::uploads_before_sending(user_id)turns it on for accounts created at or after 2026-06-04T16:10:00Z, as the original does (PREUPLOAD_MESSAGE_ATTACHMENTS_DEFAULT_ON_AFTER). There are matchingChatSettingChange::{HideMutedChannelsByDefault, UploadAttachmentsBeforeSending}variants.local_chat_settings_defaults_and_persistcovers both, and the new testupload_before_sending_defaults_by_account_agechecks the age rule.synced_preferences(Text chat 14 and 19).origin/textchat(b87bcd9). Conflicts inapp.rs,channels.rs,selectors/mod.rs,README.mdandtests/chat_ports.rswere resolved by keeping both sides.FLUXER_SCREENSHOT_TESTS=1 cargo xtask cipasses locally.dm_rowsignature, a hidden second pending change,DmOpenedmatching and test gaps) are as noted in the review.Closes #269
🤖 Generated with Claude Code
Independent review: Text chat 19 (core-dms-settings)
Scope:
git diff 9fcc13d..origin/textchat-19-core-dms-settings(head1b43f7a). LocalFLUXER_SCREENSHOT_TESTS=1 cargo xtask ciin a fresh review worktree: all steps passed.Checks
chat_dms.rs: create_dm_one_vs_group, recipient_cap, recipient_events_update_channel, close_dm_removes_on_success, group_icon_data_uri_static_only, dm_row_cluster_two_and_three, friend_picker_filters_friends_only;chat_settings.rs: synced_display_settings_read_and_patch, local_chat_settings_defaults_and_persist, old_settings_files_load). They assert the spec's values: cap 50 so 49 others, group name ≤ 100, PATCH name/icon, static icon only (GIF/APNG refused, 10 MiB avatar limit), a cluster of 2 or 3 avatars (#207), friends only in the picker, one field per PATCH, and a revert when a write fails.app.chat.dms.relationships,selectors::{friend_picker, dm_row, dm_welcome},FriendPickerModel { friends, selected, max },DmAvatar::{User, GroupIcon, Cluster(Vec<Avatar>)},DisplaySettings,PatchUserSettingswrites and theChatSettingChangesynced variants all exist. The gap inChatSettingsis listed below.EditGroupDmIconcarries aFileRefwith no bytes, and the path is hidden inDebug. No new fixtures: the tests reuse the existing server-shaped ones. Server data cannot panic the client here: the cap is clamped, unknown channels and recipients are ignored, and an undecodable prefs snapshot is never written over.sanitize_urlschange decodes the account's snapshot, flips only field 82 and re-encodes it throughfluxer_proto::prefs, which keeps the other fields. A change back writes the original snapshot byte for byte, and this is tested.Findings
[blocking]
ChatSettingsmisses two Advanced chat controls that the interface promises. Task 19's Interfaces block says "ChatSettings(local: every Advanced chat control of spec §3.8 with the original's defaults)". Spec §3.8 and the originalAdvancedChatControls.tsx(HIDE_MUTED_CHANNELS_BY_DEFAULT_DESCRIPTOR,UPLOAD_ATTACHMENTS_BEFORE_SENDING_DESCRIPTOR) both include "Hide muted channels by default" and "Upload attachments before sending". Neither is inChatSettings, inChatSettingChangeor inlocal_chat_settings_defaults_and_persist. Task 33 (fluxer-ui settings) cannot add core fields, and parity entrieschat-settings-hide-muted-channelsandchat-settings-preupload-attachments(spec §11) cannot move to done. Fix: add both fields with the original's defaults and theirChatSettingChangevariants, and cover them in the defaults/persist test. Hide-muted can stay stored-only, as §11 notes.[minor] Two writers of
synced_preferences(cross-task, for whoever merges second with Text chat 14).SyncedDisplay::writerebuilds the whole snapshot fromdisplay.synced_preferences. The branchtextchat-14-core-expressionskeeps its ownprefs.baseand also PATCHes whole snapshots. If one write is in flight while the other is sent, the second can overwrite the first: picker frecency or favourites written by 14 could be replaced by an older copy, or asanitize_urlstoggle undone. The window is small (one round trip) but it touches Review Focus 3. Suggest one owner of the snapshot, for example routing the field 82 change through the expressions prefs writer or sharing its base. Please open afollow-upissue.[minor]
dm_rowsignature. The plan saysdm_row(&App, channel) -> DmRowModel. The code returnsOption<DmRowModel>and addschannel_id,statusandmention_count. That is reasonable, and since Task 32 builds against merged code it is fine. Noted for the integrator.[minor] Second pending display change hidden while in flight.
take_accountclears every pending change when anyUserSettingsPatchedarrives. With two quick toggles, the first answer briefly hides the second until its own answer arrives. This is cosmetic: no data is lost.[minor]
DmOpenedis not matched to its request.creating.take()selects whicheverDmOpenedcomes first. A profile's "Message" answer that lands while a Create DM is in flight would select the wrong channel. This is a narrow race.[minor] Test gaps.
dm_row_cluster_two_and_threecomments that "Unread follows the read state" but asserts nothing about unread. The sanitize test compares only emoji_picker, favorite_gifs and skin_tone, not every field. Byte-for-byte equality is covered by the round-trip assertion and by Text chat 3's codec tests.Verdict: changes requested. There is 1 blocking finding: the two missing Advanced chat controls in
ChatSettings/ChatSettingChange. CI is green locally.Independent review (second pass): Text chat 19 (core-dms-settings)
Scope:
git diff b87bcd9..origin/textchat-19-core-dms-settings(head1630a19).Checks
upload_before_sending_defaults_by_account_agechecks the cutoff 1_780_589_400_000 ms, which is 2026-06-04T16:10:00Z, as inPrivacyPreferences.ts:11.relationships,friend_picker,dm_row,dm_welcome,DmAvatar::{User, GroupIcon, Cluster},ChatSettingsand theChatSettingChangevariants for the synced and local settings, including the two added this round (HideMutedChannelsByDefault,UploadAttachmentsBeforeSending), all exist. The earlier blocking finding is fixed.EditGroupDmIconcarries aFileRef), and no new fixtures. Server data cannot panic the client: the cap is clamped and indexing is guarded.sanitize_urlsrewrites only field 82, and a change back writes the original snapshot byte for byte (tested). The race between the two writers is tracked in #370.CreateDmis correct. It is the only DM action that can act on the stub fixture (it opens a DM with a known user). The other DM actions do nothing for an unknown group.Findings
ApiRequest::EditGroupDmIconis not executed by Text chat 21. Ontextchat-21-app-textchat-runtime(PR #368), the chat request match ends in_ => Err(not_a_chat_request())(501CLIENT_NOT_WIRED). Once both branches merge, a new group icon fails with an error. Neither #271 nor #368 mentions it. Please add a note on #368, or open a follow-up issue, before merge.LocalSettings::chatis never written tosettings.toml.fluxer-platform::settings::SettingsFilehas nochattable, so every local chat setting, every draft and the recent searches are lost on restart.old_settings_files_loadpasses because the core test only checks theSaveSettingseffect. Opened #371 (bug).dm_rowreturnsOptionand has extra fields, and Text chat 32 builds against the merged code; there is a pending-change display flicker;DmOpenedis not matched to its request.CI
I started local
FLUXER_SCREENSHOT_TESTS=1 cargo xtask ciin a fresh review worktree, but it was still compiling when this review had to report, so I have no local result for head1630a19. The implementer reports it green. The integrator should check the remote runners.Verdict: no blocking findings. The code is approvable once CI is confirmed green.
Review round 1, minor findings (no blocking findings). No code change on this branch: each finding is outside its files or already tracked. Head stays
1630a19;FLUXER_SCREENSHOT_TESTS=1 cargo xtask ciis green locally on it.ApiRequest::EditGroupDmIconnot run by the Text chat 21 runtime (crates/fluxer-core/src/effect.rs): checked and confirmed. The chat request match inapps/fluxer/src/runtime.rsontextchat-21-app-textchat-runtimeends in_ => return Err(not_a_chat_request()). The fix belongs inapps/fluxer, which is the runtime task's crate, not this one. I opened follow-up #372 and left a note on #368.dm_rowreturnsOption<DmRowModel>with extra fields (crates/fluxer-core/src/selectors/sidebar.rs): carried over from the first review. No change: the merged code is the source of truth, and Text chat 32 builds against it.synced_preferences, a second pending display change hidden until its answer arrives,DmOpenednot matched to its request (crates/fluxer-core/src/chat/settings.rs): carried over from the first review. All three are tracked in follow-up #370, so this PR does not change them.🤖 Generated with Claude Code
Independent review (third pass): Text chat 19 (core-dms-settings)
Scope:
git diff b87bcd9..origin/textchat-19-core-dms-settings(head1630a19). Localcargo xtask ciin a fresh review worktree (tc-review-19): all steps passed (EXIT 0).Checks
chat_dms.rs:create_dm_one_vs_group,recipient_cap,recipient_events_update_channel,close_dm_removes_on_success,group_icon_data_uri_static_only,dm_row_cluster_two_and_three,friend_picker_filters_friends_only;chat_settings.rs:synced_display_settings_read_and_patch,local_chat_settings_defaults_and_persist,old_settings_files_load). They assert the spec values: cap 50 so 49 others, free places when adding, name trimmed and at most 100 characters, static icons only (GIF and APNG refused) and 10 MiB, a 2 or 3 avatar cluster, friends only, one field per PATCH, revert on failure. Defaults checked against the fork (UserSettings.ts:309-329,PrivacyPreferences.ts:11; 1_780_589_400_000 ms = 2026-06-04T16:10Z; SVG is inRASTER_FULL; group status priority online, idle, dnd asGroupDMAvatar.tsx:36).app.chat.dms.relationships,selectors::{friend_picker, dm_row, dm_welcome},FriendPickerModel { friends, selected, max },DmAvatar::{User, GroupIcon, Cluster(Vec<Avatar>)},DmRowModel { name, avatar, subtext, unread, muted, .. },ChatSettingsinLocalSettings::chat, andChatSettingChangevariants for every synced and local setting are all present.dm_rowreturnsOption<DmRowModel>(the plan saysDmRowModel); the merged code is the source of truth for Text chat 32.EditGroupDmIconcarries aFileRef); no new fixtures; the one log line carries no data. Server data cannot panic: the limit is filtered for NaN and negative values and clamped,others[0]is guarded by the match arm, and there are no unwraps on server data.sanitize_urlsdecodes the last server snapshot, changes only that field and re-encodes it. Setting it back writes the original snapshot byte for byte (tested). A snapshot that does not decode is never written over.Findings
ApiRequest::EditGroupDmIcon: it falls through tonot_a_chat_request. Changing a group icon fails with an error, and nothing panics, until #372 lands. It is a new request variant that the plan does not name, so #368 needs to pick it up before both merge.settings.toml(fluxer-platform) has no[chat]table, so local chat settings are lost on restart. The core tests check only theSaveSettingseffect.sanitize_urlswrite made while a frecency or picker patch is still unanswered starts from the older snapshot.UserSettingsPatchedclears every pending change, including writes that are still on their way. A toggle can flick back until its own answer arrives. It is cosmetic and converges.Verdict: no blocking findings; local CI green. Approvable.