Skip to content

[Repo Assist] refactor: remove redundant CategoryTitles dict in NotificationCategorizer#138

Closed
github-actions[bot] wants to merge 1 commit intomasterfrom
repo-assist/improve-notification-categorizer-titles-6997056c08eebfde
Closed

[Repo Assist] refactor: remove redundant CategoryTitles dict in NotificationCategorizer#138
github-actions[bot] wants to merge 1 commit intomasterfrom
repo-assist/improve-notification-categorizer-titles-6997056c08eebfde

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions github-actions bot commented Apr 2, 2026

🤖 This PR was created by Repo Assist, an automated AI assistant.

Problem

NotificationCategorizer maintained three separate static dictionaries mapping category keys to display information:

Dictionary Maps Example
ChannelMap channel string → (title, type) ["health"] = ("🩸 Blood Sugar Alert", "health")
IntentMap intent string → (title, type) ["health"] = ("🩸 Blood Sugar Alert", "health")
CategoryTitles category type → title only ["health"] = "🩸 Blood Sugar Alert"

CategoryTitles existed solely to look up the display title when a user-defined rule matched and provided a category string. But IntentMap already 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 CategoryTitles and derive the user-rule display title from IntentMap directly:

// Before:
var title = CategoryTitles.GetValueOrDefault(cat, "🤖 OpenClaw");

// After:
var title = IntentMap.TryGetValue(cat, out var catInfo) ? catInfo.title : "🤖 OpenClaw";

The "info" category (present in CategoryTitles but not IntentMap) correctly falls through to the "🤖 OpenClaw" default — identical runtime behaviour.

Outcome

  • 14 lines removed, 0 added (net −14)
  • Single source of truth for category → display title
  • Future category additions only require edits to ChannelMap/IntentMap

Test Status

✅ 525 passed, 20 skipped (platform-specific), 0 failed — OpenClaw.Shared.Tests
✅ 99 passed, 0 skipped, 0 failed — OpenClaw.Tray.Tests

Generated by Repo Assist ·

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@cbb46ab386962aa371045839fc9998ee4e97ca64

…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>
@shanselman
Copy link
Copy Markdown
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant