Consolidate duplicated xUnit facts into theories - #2000
Merged
Conversation
| bool preWriteFile, | ||
| bool assertFileMissingAfter) | ||
| { | ||
| var filePath = Path.Combine(Path.GetTempPath(), $"netclaw-{toolName}-outside-{Guid.NewGuid():N}.txt"); |
| buildArgs(filePath)); | ||
|
|
||
| var sessionDir = Path.Combine(Path.GetTempPath(), $"netclaw-team-session-{Guid.NewGuid():N}"); | ||
| var sessionDir = Path.Combine(Path.GetTempPath(), $"netclaw-{toolName}-session-{Guid.NewGuid():N}"); |
|
|
||
| var registry = new ToolRegistry(); | ||
| var paths = new NetclawPaths(Path.Combine(Path.GetTempPath(), $"netclaw-public-tools-{Guid.NewGuid():N}")); | ||
| var paths = new NetclawPaths(Path.Combine(Path.GetTempPath(), $"netclaw-{audience}-tools-{Guid.NewGuid():N}")); |
| var segments = relativePath.Split('/'); | ||
|
|
||
| Assert.True(policy.IsDenied(Path.Combine(configDir, "future", "subsystem", "settings.json"))); | ||
| Assert.True(policy.IsDenied(Path.Combine([configDir, .. segments]))); |
Aaronontheweb
marked this pull request as ready for review
August 19, 2026 01:43
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
Aaronontheweb
force-pushed
the
refactor/test-compression
branch
from
August 19, 2026 02:08
7f9529d to
a58f8de
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 1 of a code-reduction effort: compress duplicated test code without loss of coverage. 13 files changed, 1,032 insertions, 1,745 deletions (−713 net lines).
[Fact]methods into[Theory]methods withMemberData/InlineDatarows. Each old fact maps to exactly one theory row. All assertions and input literals are unchanged.RunCheckAsyncinConfigSchemaDoctorCheckTests, gateway-delivery helper inReminderManagerActorTests, registry/policy construction inDispatchingToolExecutorTests).ConfigEditorCoverageAuditTestsnameofreferences to the merged theory.Files
What was deliberately NOT consolidated
ChannelsConfigViewModelTestsgroup "resolve channel name to id": the Slack variant drives a different flow with five extra assertions. A shared theory would obscure it.CreateApprovalGatedShellExecutorwas not substituted into the one-time-approval tests: itsapprovalService ?? new UnexpectedApprovalService()default differs from the raw constructornull. One test depends on thenullbehavior. The shared helper covers only registry/policy construction.Verification
dotnet slopwatch analyze: 0 issues. Header verification passes. Build has 0 warnings.Stack
PR 1 of a planned 4-phase stack. Next phases: cross-channel helper dedup, a
NotifyDeliveryFailedAsyncdrift fix, and a binding-actor consolidation.