Skip to content

Return uncategorized commands for a null category in GetCommandsByCategory [patch] - #158

Merged
matt-edmondson merged 1 commit into
mainfrom
fix/category-null-140
Sep 30, 2026
Merged

matt-edmondson merged 1 commit into
mainfrom
fix/category-null-140

Conversation

@matt-edmondson

Copy link
Copy Markdown
Contributor

Fixes #140

Problem

CommandRegistry.GetCommandsByCategory passed the CommandCategory? to string.Equals. A null CommandCategory converts to "", not null, so null matched nothing while "" and " " matched the uncategorized commands.

Change

  • Null, empty and whitespace now all select the uncategorized commands. A named category is trimmed and compared case-insensitively, the same as before.
  • The ICommandRegistry doc comment now says what a blank category means.
  • I checked for other string.Equals calls on nullable SemanticStrings, as the triage suggested. There are none: the only other one compares a JSON property name.

Tests

New CommandCategoryFilterTests:

  • null, "" and " " each return only file.save. The null row fails on main (expected 1, got 0) and passes with the fix.
  • "Edit", "edit" and " Edit " each return only edit.copy.
  • Passing each command's own Category back in finds that command.

The full suite passes locally: 141/141.

🤖 Generated with Claude Code

https://claude.ai/code/session_019UNSUUrn4o84JfkEVaD3xg


Generated by Claude Code

…egory [patch]

A null CommandCategory converts to "" rather than null, so comparing it with
string.Equals made GetCommandsByCategory(null) match nothing while "" and "  "
returned the uncategorized commands. Null, empty and whitespace now all select
the uncategorized commands.

Fixes #140

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019UNSUUrn4o84JfkEVaD3xg
@sonarqubecloud

Copy link
Copy Markdown

@matt-edmondson
matt-edmondson merged commit 9eacc52 into main Sep 30, 2026
14 checks passed
@matt-edmondson
matt-edmondson deleted the fix/category-null-140 branch September 30, 2026 04:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GetCommandsByCategory(null) returns nothing, while "" and " " return the uncategorized commands

2 participants