[Repo Assist] refactor: remove dead ClassifyNotification method, fix reflection tests#98
Draft
github-actions[bot] wants to merge 1 commit intomasterfrom
Conversation
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>
22 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 is an automated contribution from Repo Assist.
What
Removes a dead private static method
ClassifyNotificationfromOpenClawGatewayClientand updates the corresponding tests to call the correct public API directly.Root Cause
ClassifyNotificationwas a private static method that simply delegated toNotificationCategorizer.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_categorizerinstance directly.The reflection-based test approach was brittle: removing or renaming the private method caused 12 tests to throw
NullReferenceExceptionat runtime, with no compile-time safety.Changes
OpenClawGatewayClient.cs: Remove the unusedprivate static (string title, string type) ClassifyNotification(string text)method.OpenClawGatewayClientTests.cs: UpdateGatewayClientTestHelper.ClassifyNotificationandGetNotificationTitleto callNotificationCategorizer.ClassifyByKeywordsdirectly — 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.