fix(desktop): emit singular mention feed category so alerts route correctly - #6665
Open
morgmart wants to merge 2 commits into
Open
fix(desktop): emit singular mention feed category so alerts route correctly#6665morgmart wants to merge 2 commits into
mention feed category so alerts route correctly#6665morgmart wants to merge 2 commits into
Conversation
…orrectly The Tauri home-feed builder stamped mention items with the plural section name `"mentions"` (reused from the `--types` filter vocabulary) while the frontend contract — `FeedItemCategory` in `shared/api/types.ts`, unchanged since #12 — is the singular `"mention"`. Introduced in #475. Every frontend consumer compared against the singular, so real mentions never matched: - Mentions (and thread replies that @-mention you) played the Needs-action sound via the resolver's fallback instead of the @Mentions sound. - Mention notifications used the Needs-action title format. - Mentions in muted channels were suppressed; the mute-bypass never fired. - Inbox / Home feed labelled mentions "Channel update"; the channel activity popover's mentions list was always empty. The E2E mock bridge emits the singular form, so tests never saw the drift. Fix the owner rather than the symptoms: `FeedItemInfo.category` becomes a `FeedItemCategory` enum whose serde form is the exact TS union, so the compiler rejects a mis-spelled category at the producer. A serialization test pins each variant to its wire string. On the frontend, `slotForFeedKind` now maps every known category explicitly. The needs_action fallback for unknown categories is kept on purpose — a contract drift should cost the user the wrong sound, not a missed alert — but it now warns so the drift is visible to developers. `tauri.ts` and `e2eBridge.ts` import the category union instead of retyping it. Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: morgmart <98432065+morgmart@users.noreply.github.com>
…esolver The refactor moved the mention check below the job-kind checks, so a future job event that @-mentions the user would have played its job sound instead of the Mention sound. Restore the original order and pin it with a regression test. Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: morgmart <98432065+morgmart@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Mentions — and thread replies that @-mention you — played the Needs action sound instead of the @Mentions sound. Reported by @morgmart: "I set Needs action to a different sound and it's the only one I ever hear."
Root cause
Two vocabularies got conflated in #475:
mentions,needs_action,activity,agent_activity— the shape ofFeedSections, the--typesfilter, and the agent-facing CLI docs.mention,needs_action,activity,agent_activity— theFeedItemCategorycontract indesktop/src/shared/api/types.ts, unchanged since Add desktop Home feed #12.The Tauri feed builder reused the filter string
"mentions"as each mention item'scategory. Only one word differs between the vocabularies, so only mentions broke. Every frontend consumer compares against the singular, so real mentions never matched and fell through to the resolver'sneeds_actionfallback.The E2E mock bridge emits the singular form, so tests never saw the drift.
Symptoms this fixes (all from the one mislabel)
Fix
Fix the owner, not the symptoms.
FeedItemInfo.categorybecomes aFeedItemCategoryenum whose serde form is exactly the TS union, so a misspelled category can't compile at the producer. A serialization test pins each variant to its wire string.Frontend:
slotForFeedKindmaps every known category explicitly. Theneeds_actionfallback for unknown categories is kept on purpose — a contract drift should cost the user the wrong sound, not a missed alert — but it nowconsole.warns so the drift is visible to developers instead of masquerading as intended behavior.e2eBridge.tsandtauri.tsnow derive the category type fromtypes.tsinstead of retyping it.Not touched: the plural
--typesfilter andFeedSectionskeys. Those are the section vocabulary and are correct as-is.Verification
just cigreen (file-size ratchet, Rust/Tauri/desktop/mobile tests, desktop + web builds)feed_item_category_serializes_to_frontend_contract,feed_item_from_event_carries_singular_mention_category), 3 TS insound.test.mjsincl. one that feeds the old"mentions"string and asserts fallback + warningReviewers
FeedItemCategorycontract (Add desktop Home feed #12) and most of the feed builder