Skip to content

[Repo Assist] refactor: remove dead ClassifyNotification method, fix reflection tests#98

Draft
github-actions[bot] wants to merge 1 commit intomasterfrom
repo-assist/remove-dead-classifynotification-20260323-b6cc2fe58411a903
Draft

[Repo Assist] refactor: remove dead ClassifyNotification method, fix reflection tests#98
github-actions[bot] wants to merge 1 commit intomasterfrom
repo-assist/remove-dead-classifynotification-20260323-b6cc2fe58411a903

Conversation

@github-actions
Copy link
Contributor

🤖 This is an automated contribution from Repo Assist.

What

Removes a dead private static method ClassifyNotification from OpenClawGatewayClient and updates the corresponding tests to call the correct public API directly.

Root Cause

ClassifyNotification was a private static method that simply delegated to NotificationCategorizer.ClassifyByKeywords. It was never called from any production code — the only consumers were tests accessing it via reflection. The method became orphaned at some point when its callers were refactored to use the _categorizer instance directly.

The reflection-based test approach was brittle: removing or renaming the private method caused 12 tests to throw NullReferenceException at runtime, with no compile-time safety.

Changes

  • OpenClawGatewayClient.cs: Remove the unused private static (string title, string type) ClassifyNotification(string text) method.
  • OpenClawGatewayClientTests.cs: Update GatewayClientTestHelper.ClassifyNotification and GetNotificationTitle to call NotificationCategorizer.ClassifyByKeywords directly — no reflection needed, and the intent is explicit.

Test Status

503 tests pass, 18 skipped (Windows-only integration tests skipped in Linux CI). All 12 previously-reflection-based tests pass with the direct API calls.

Generated by Repo Assist ·

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@cbb46ab386962aa371045839fc9998ee4e97ca64 
The private static ClassifyNotification method in OpenClawGatewayClient was never called from production code - only from tests via reflection. It simply forwarded to NotificationCategorizer.ClassifyByKeywords. - Remove the dead ClassifyNotification method from OpenClawGatewayClient - Update GatewayClientTestHelper to call NotificationCategorizer.ClassifyByKeywords directly instead of using brittle reflection to invoke a private method The reflection-based approach was fragile: any refactor of the private method would silently break the tests (as demonstrated when the method was removed). Calling the public API directly is clearer and more robust. 503 tests pass, 18 skipped. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment