chore: centralize hardcoded configuration values into constants#4929
chore: centralize hardcoded configuration values into constants#4929
Conversation
Replace scattered magic numbers across TUnit.Engine and TUnit.Core with named constants so they can be tuned from a single location. - TUnit.Core.Defaults: TestTimeout (30 min), HookTimeout (5 min), ForcefulExitTimeout (30 s), ProcessExitHookDelay (500 ms) - TUnit.Engine.Constants.EngineDefaults: discovery timeouts, circuit breaker limits, event batch size/delay, shutdown timeout, timeout grace period, IDE streaming interval, file-write retry parameters, GitHub summary max file size, and dependency resolution retry count Closes #4902
51a041e to
7948d9f
Compare
Code ReviewPR: chore: centralize hardcoded configuration values into constants This is a clean, well-executed refactoring. The two-tier constant design (public Issue: Missing Public API Snapshot UpdatesCLAUDE.md Rule: "Changes to source generator output or public APIs require running snapshot tests. Commit The new file The project
None of these files are updated in this PR, meaning Fix: Run cd TUnit.PublicAPI
dotnet test
# Linux/macOS:
for f in *.received.txt; do mv "$f" "${f%.received.txt}.verified.txt"; done
git add *.verified.txtReviewed for: bugs, CLAUDE.md compliance (dual-mode, snapshot testing, public API changes, performance, AOT compatibility, no blocking async). |
* fix: update Core public API snapshots for all frameworks The merged PRs #4929 (hardcoded constants) and #4949 (retry policies) added new public API surface to TUnit.Core but the DotNet8_0, DotNet9_0, and DotNet10_0 verified snapshot files were not updated, causing Core_Library_Has_No_API_Changes test failures in all PR CI pipelines. * fix: update analyzer tests for CancellationToken parameter location PR #4956 changed the CancellationTokenMustBeLastParameter diagnostic to point at the CancellationToken parameter instead of the method name. Update 3 test expectations to match the new diagnostic location.
Summary
Closes #4902
TUnit.Core.Defaultswith shared constants (default test timeout, hook timeout, forceful-exit timeout, process-exit hook delay) used by both TUnit.Core and TUnit.Engine.TUnit.Engine.Constants.EngineDefaultswith engine-specific constants (discovery timeout, circuit-breaker limits, event batch parameters, shutdown timeout, timeout grace period, IDE streaming interval, file-write retry configuration, GitHub summary max file size, dependency resolution retry count).Constants introduced
Defaults.TestTimeoutDefaults.HookTimeoutDefaults.ForcefulExitTimeoutDefaults.ProcessExitHookDelayEngineDefaults.DiscoveryTimeoutEngineDefaults.MaxGenerationTimeEngineDefaults.MaxMemoryPercentageEngineDefaults.FallbackAvailableMemoryBytesEngineDefaults.DependencyResolutionMaxRetriesEngineDefaults.DefaultEventBatchSizeEngineDefaults.MinBatchDelayEngineDefaults.ShutdownTimeoutEngineDefaults.TimeoutGracePeriodEngineDefaults.IdeStreamingThrottleIntervalEngineDefaults.FileWriteMaxAttemptsEngineDefaults.BaseRetryDelayMsEngineDefaults.MaxRetryJitterMsEngineDefaults.GitHubSummaryMaxFileSizeBytesTest plan
dotnet build TUnit.Core/TUnit.Core.csprojpasses with 0 warnings and 0 errorsdotnet build TUnit.Engine/TUnit.Engine.csprojpasses with 0 warnings and 0 errors