Extract duplicated channel helpers into Netclaw.Channels - #2002
Merged
Conversation
Collapse groups of near-identical [Fact] methods into [Theory] methods with MemberData or InlineData rows. Extract repeated arrange blocks into shared helpers. Each old fact maps to exactly one theory row. All assertions and input literals are unchanged. No production code changes. Files: - Cli.Tests: ExposureModeDoctorCheckTests, ConfigSchemaDoctorCheckTests, WebhooksCommandTests, ApprovalsCommandTests, ChannelsConfigViewModelTests - Daemon.Tests: RetryingChatClientTests - Security.Tests: ToolPathPolicyTests, MagicByteValidatorTests, RegexPromptInjectionDetectorTests - Actors.Tests: DispatchingToolExecutorTests, WebFetchToolTests, ReminderManagerActorTests (helper extraction only) - ConfigEditorCoverageAuditTests: update nameof references to the merged theory
Consolidate five helper groups that Slack, Discord, and Mattermost duplicated. Behavior is unchanged. No shared actor base class is introduced. - MessageChunker: one newline-aware chunk algorithm for Discord and Mattermost. Each actor keeps its own max-length constant. - UserQueryNormalizer.StripLeadingAt: one strip-at helper for the Slack and Mattermost lookup tools. Discord keeps its mention-tag path. - PendingApprovalRequest<TPromptId>: one generic base for the in-memory pending-approval record. Each channel keeps a thin subclass with its transport-specific property name. The journaled types are untouched. - PendingApprovalLookup.Resolve: one copy of the approval lookup. The ApprovalButtonValueCodec.CanApprove requester check now lives in one place for Discord and Mattermost. - PendingApprovalRecovery.ApplyTracked/ApplyCleared: one copy of the cold-spawn recovery replay for all three channels.
Aaronontheweb
force-pushed
the
refactor/channel-warmups
branch
from
August 19, 2026 02:08
f6f3f4c to
c3c857d
Compare
Aaronontheweb
marked this pull request as ready for review
August 19, 2026 02:09
Aaronontheweb
force-pushed
the
refactor/channel-warmups
branch
2 times, most recently
from
August 19, 2026 03:39
66a0437 to
c3c857d
Compare
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.
What
Phase 2 of the code-reduction stack (on top of #2000). Consolidates five helper groups that the Slack, Discord, and Mattermost channel code duplicated. Behavior is unchanged. No shared actor base class is introduced — that is a later phase.
Netclaw.Channels)MessageChunker.Chunk(text, maxLength)UserQueryNormalizer.StripLeadingAtLookupSlackUserTool+LookupMattermostUserTool;DiscordAddressResolverkeeps its mention-tag path and delegates the non-mention pathPendingApprovalRequest<TPromptId>PendingApprovalPromptTracked/Clearedtypes are untouched — no wire-compat impactPendingApprovalLookup.ResolveResolvePendingRequest+ApprovalLookupResultin Discord + Mattermost. TheApprovalButtonValueCodec.CanApproverequester check now has one copy instead of two. Slack's lookup has a genuinely different shape and stays as-isPendingApprovalRecovery.ApplyTracked/ApplyCleared_hasObservedApprovalRequeststays actor-localWhy
These triplicated regions are where fixes historically land in one channel and miss the others. Centralizing the approval lookup and recovery replay means a future security fix to the requester check cannot drift between channels. This also stages the ground for the larger binding-actor consolidation planned in a later phase of this stack.
Verification
Netclaw.Actors.Testssuite: 3,439 passed, 0 failed, 1 skipped (pre-existing Windows-only skip)SessionBindingContractTests+ApprovalRehydrationTests(172), chunking/contract/serialization suites (254),ChannelRegistryRegistrationTests(21) — all greendotnet slopwatch analyze: 0 issues; header verification passesStack
PR 2 of 4. Base:
refactor/test-compression(#2000). Next:NotifyDeliveryFailedAsyncdrift fix.