[Repo Assist] refactor: remove redundant CategoryTitles dict in NotificationCategorizer#138
Closed
github-actions[bot] wants to merge 1 commit intomasterfrom
Conversation
…izer
CategoryTitles mapped category-key → display title, e.g.:
["health"] = "🩸 Blood Sugar Alert"
IntentMap already stores the same information as the first element of
its (title, type) tuples:
["health"] = ("🩸 Blood Sugar Alert", "health")
Having a separate dictionary means every new category or emoji update
must be made in three places (ChannelMap, IntentMap, CategoryTitles),
creating a maintenance hazard.
Remove CategoryTitles and derive the user-rule title directly from
IntentMap instead:
var title = IntentMap.TryGetValue(cat, out var r) ? r.title : "🤖 OpenClaw";
The "info" category (only in CategoryTitles, not IntentMap) falls
through to the same "🤖 OpenClaw" default, preserving identical
runtime behaviour.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Collaborator
|
The CategoryTitles dictionary is not redundant — it serves user-defined rule categorization. Removing it would cause custom rule categories to silently fall back to the generic title. Closing. |
9 tasks
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.
🤖 This PR was created by Repo Assist, an automated AI assistant.
Problem
NotificationCategorizermaintained three separate static dictionaries mapping category keys to display information:ChannelMap["health"] = ("🩸 Blood Sugar Alert", "health")IntentMap["health"] = ("🩸 Blood Sugar Alert", "health")CategoryTitles["health"] = "🩸 Blood Sugar Alert"CategoryTitlesexisted solely to look up the display title when a user-defined rule matched and provided a category string. ButIntentMapalready contains exactly this information in(title, type).title. This means every category emoji or label change required three separate edits — a maintenance hazard that's easy to miss.Fix
Remove
CategoryTitlesand derive the user-rule display title fromIntentMapdirectly:The
"info"category (present inCategoryTitlesbut notIntentMap) correctly falls through to the"🤖 OpenClaw"default — identical runtime behaviour.Outcome
ChannelMap/IntentMapTest Status
✅ 525 passed, 20 skipped (platform-specific), 0 failed —
OpenClaw.Shared.Tests✅ 99 passed, 0 skipped, 0 failed —
OpenClaw.Tray.Tests