Skip to content

Feature: Enhance tests, fix various bus freezing bugs#200

Merged
Eli Pinkerton (wallstop) merged 3 commits into
masterfrom
dev/wallstop/more-exhaustive-tests
May 2, 2026
Merged

Feature: Enhance tests, fix various bus freezing bugs#200
Eli Pinkerton (wallstop) merged 3 commits into
masterfrom
dev/wallstop/more-exhaustive-tests

Conversation

@wallstop
Copy link
Copy Markdown
Collaborator

@wallstop Eli Pinkerton (wallstop) commented May 2, 2026

Description

This PR improves DxMessaging reliability under mutation-heavy dispatch scenarios and significantly hardens runtime/analyzer test coverage.

User-facing highlights:

  • Fixes in-flight emit edge cases so cross-priority deregistration no longer causes handlers to be skipped in the same emission.
  • Makes DxMessagingStaticState.Reset race-safe with deferred deregistration, removing spurious over-deregistration console errors.
  • Fixes MessageRegistrationToken.RemoveRegistration(handle) so removed handlers are not silently re-registered on later enable cycles.
  • Adds/expands analyzer contract coverage (especially [DxIgnoreMissingBaseCall] behavior), plus minor analyzer/editor polish.
  • Adds broader contract coverage (re-entrant emit, single-thread guarantees, null/invalid input handling, allocation expectations, and scenario parameterization across message kinds).
  • Updates docs and changelog to reflect behavior, diagnostics, and test-discipline expectations.

Related Issue

N/A

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Refactor (code change that neither fixes a bug nor adds a feature)

Checklist

  • All tests pass locally
  • Code is properly formatted
  • I have added tests that prove my fix is effective or my feature works
  • I have updated the documentation accordingly
  • I have updated the CHANGELOG
  • My changes do not introduce breaking changes, or breaking changes are documented

@wallstop Eli Pinkerton (wallstop) changed the title Enhance tests, fix various bus freezing bugs Feature: Enhance tests, fix various bus freezing bugs May 2, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR hardens DxMessaging runtime dispatch under mutation-heavy scenarios (snapshot semantics, reset/deregistration races, token removal correctness) and significantly expands/organizes test + analyzer/source-generator coverage, with updated documentation/changelog to match the strengthened contracts.

Changes:

  • Fixes runtime edge cases around in-flight deregistration, DxMessagingStaticState.Reset vs deferred teardown, and MessageRegistrationToken.RemoveRegistration(handle) re-enable behavior.
  • Adds a kind-parameterized runtime test harness (MessageScenario/ScenarioHarness) plus new contract/sentinel tests (speed budget, threading, null/invalid inputs, etc.) and applies suite categorization.
  • Expands analyzer/source-generator diagnostic coverage and updates docs/changelog/skills metadata accordingly.

Reviewed changes

Copilot reviewed 85 out of 87 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
llms.txt Updates skills count and “Last Updated” metadata.
failed-tests.txt Adds a captured failing test log artifact.
failed-tests.txt.meta Unity meta for failed-tests.txt.
docs/architecture/performance.md Updates benchmark numbers.
docs/architecture/comparisons.md Updates comparison benchmark numbers.
Tests/Runtime/TestUtilities/ScenarioHarness.cs Adds helper API to register/emit across message kinds for parameterized tests.
Tests/Runtime/TestUtilities/ScenarioHarness.cs.meta Unity meta for ScenarioHarness.
Tests/Runtime/TestUtilities/MessageScenarios.cs Adds ValueSource scenario enumerables for message-kind permutations.
Tests/Runtime/TestUtilities/MessageScenarios.cs.meta Unity meta for MessageScenarios.
Tests/Runtime/TestUtilities/MessageScenario.cs Adds immutable scenario descriptor used by parameterized tests.
Tests/Runtime/TestUtilities/MessageScenario.cs.meta Unity meta for MessageScenario.
Tests/Runtime/TestUtilities/MessageKind.cs Adds MessageKind enum for test parameterization.
Tests/Runtime/TestUtilities/MessageKind.cs.meta Unity meta for MessageKind.
Tests/Runtime/TestUtilities/AllocationAssertions.cs Centralizes allocation assertion warmup + measurement pattern.
Tests/Runtime/TestUtilities/AllocationAssertions.cs.meta Unity meta for AllocationAssertions.
Tests/Runtime/Core/TestAttributeContractTests.cs Adds contract tests enforcing kind-parameterization + allocation coverage + static reset sanity.
Tests/Runtime/Core/SuiteSpeedBudgetTest.cs Adds default-suite wall-clock guard rail test.
Tests/Runtime/Core/SuiteSpeedBudgetTest.cs.meta Unity meta for SuiteSpeedBudgetTest.
Tests/Runtime/Core/SingleThreadContractTests.cs Adds tests pinning the single-thread/non-threadsafe contract behavior.
Tests/Runtime/Core/SingleThreadContractTests.cs.meta Unity meta for SingleThreadContractTests.
Tests/Runtime/Core/RegistrationTests.cs Marks as Stress and restores legacy registration fan-out via overridden Setup.
Tests/Runtime/Core/PostProcessorTests.cs Marks as Stress and restores legacy registration fan-out via overridden Setup.
Tests/Runtime/Core/NominalTests.cs Marks as Stress and restores legacy registration fan-out via overridden Setup.
Tests/Runtime/Core/MutationHighVolumeStressTests.cs Marks mutation high-volume suite as Stress.
Tests/Runtime/Core/OrderingTests.cs Comment punctuation tweak for clarity/consistency.
Tests/Runtime/Core/OrderingManyRegistrationsTests.cs Consolidates kind triplets into scenario-parameterized tests + helper registration/emit routing.
Tests/Runtime/Core/MutationInterceptorTests.cs Consolidates kind triplets into scenario-parameterized tests + shared helpers.
Tests/Runtime/Core/MutationDestructionTests.cs Consolidates kind triplets into scenario-parameterized tests + shared helpers.
Tests/Runtime/Core/InterceptorCancellationTests.cs Consolidates kind triplets into scenario-parameterized test + shared helpers.
Tests/Runtime/Core/MessagingTestBaseCleanupRobustnessTests.cs Adds regression tests for destroy+reset over-deregistration noise (default + custom bus).
Tests/Runtime/Core/MessagingTestBase.cs Reseeds deterministic RNG, moves reset to UnitySetup (drain destroy queue), adds drain assertions + OneTime reset.
Tests/Runtime/Core/EmitTests.cs Adds parameterized “common across kinds” emit smoke test.
Tests/Runtime/Core/EmitTests.cs.meta Unity meta for EmitTests.
Tests/Runtime/Core/EmitUntargetedSpecificTests.cs Renames/clarifies fixture purpose for untargeted-only emission semantics.
Tests/Runtime/Core/EmitUntargetedSpecificTests.cs.meta Unity meta for EmitUntargetedSpecificTests.
Tests/Runtime/Core/EmitTargetedSpecificTests.cs Renames/clarifies fixture purpose for targeted-only emission semantics.
Tests/Runtime/Core/EmitTargetedSpecificTests.cs.meta Unity meta update for EmitTargetedSpecificTests.
Tests/Runtime/Core/EmitBroadcastSpecificTests.cs Renames/clarifies fixture purpose for broadcast-only emission semantics.
Tests/Runtime/Core/EmitBroadcastSpecificTests.cs.meta Unity meta update for EmitBroadcastSpecificTests.
Tests/Runtime/Core/NullAndInvalidInputTests.cs Adds contract tests for null/invalid inputs and current boundary behaviors.
Tests/Runtime/Core/NullAndInvalidInputTests.cs.meta Unity meta for NullAndInvalidInputTests.
Tests/Runtime/Core/ReentrantEmissionTests.cs.meta Unity meta added for new reentrancy tests (script file not shown in diff excerpt).
Tests/Runtime/Core/HandlerExceptionTests.cs.meta Unity meta added for new handler-exception tests (script file not shown in diff excerpt).
Tests/Runtime/Benchmarks/ProviderResolutionBenchmarks.cs Adds Performance category tagging.
Tests/Runtime/Benchmarks/PerformanceTests.cs Adds Performance category tagging.
Tests/Runtime/Benchmarks/ComparisonPerformanceTests.cs Adds Performance category tagging.
Tests/Runtime/Benchmarks/BenchmarkHarnessRobustnessTests.cs Adds Performance category tagging.
Tests/Runtime/Benchmarks/AllocationMatrixTests.cs.meta Unity meta update for allocation matrix tests.
Tests/Editor/MessageAwareComponentFallbackEditorTests.cs Tightens wording/punctuation in editor tests’ contract commentary.
SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators.Tests/GeneratorTestUtilities.cs Comment punctuation tweak.
SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators.Tests/DxMessageIdGeneratorDiagnosticsTests.cs Expands generator diagnostics coverage (generics, record structs, nesting, nullables) + parse validation helpers.
SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators.Tests/DxAutoConstructorGeneratorDiagnosticsTests.cs Expands optional-parameter default/expression coverage and DXMSG005 boundary tests.
SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators.Tests/CompilationMessageHarvestTests.cs Comment punctuation tweaks in analyzer harvesting tests.
SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators.Tests/BaseCallTypeScannerTests.cs Comment punctuation tweaks in scanner tests.
SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators.Tests/BaseCallLogMessageParserTests.cs Comment punctuation tweaks in parser tests.
SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators.Tests/BaseCallIlInspectorTests.cs Comment punctuation tweaks in IL inspector tests.
SourceGenerators/WallstopStudios.DxMessaging.Analyzer/Analyzers/MessageAwareComponentBaseCallAnalyzer.cs Comment/message punctuation tweaks (including DXMSG010 description).
Runtime/Core/MessageRegistrationToken.cs Ensures RemoveRegistration(handle) also removes staged registration/metadata/call-count so it doesn’t re-enable later.
Runtime/Core/MessageHandler.cs Adds prefreeze helpers and switches to priority-key-preserving deregistration behavior for snapshot correctness.
Runtime/Core/MessageBus/IMessageBus.cs Documents cache-retention tradeoff for targeted/broadcast registrations under frozen-snapshot semantics.
Runtime/Core/DxMessagingStaticState.cs Makes Reset race-safe with custom global buses by bumping reset generation on active custom concrete bus.
Editor/SetupCscRsp.cs Comment punctuation tweak.
Editor/Settings/DxMessagingBaseCallIgnoreSync.cs Comment punctuation tweak.
Editor/CustomEditors/MessageAwareComponentInspectorOverlay.cs Comment punctuation and message wording tweak.
Editor/CustomEditors/MessageAwareComponentFallbackEditor.cs Comment punctuation tweak.
Editor/Analyzers/DxMessagingConsoleHarvester.cs Comment punctuation tweaks clarifying invariants and deadlock avoidance.
Editor/Analyzers/BaseCallTypeScannerCore.cs Comment punctuation tweaks.
Editor/Analyzers/BaseCallTypeScanner.cs Comment punctuation tweaks.
Editor/Analyzers/BaseCallReportAggregator.cs Comment punctuation tweaks.
Editor/Analyzers/BaseCallLogMessageParser.cs Comment punctuation tweaks.
Editor/Analyzers/BaseCallIlInspector.cs Comment punctuation tweaks.
CLAUDE.md Updates “project-wide rules” list to include message-kind parameterization expectation.
CHANGELOG.md Documents added tests/coverage and runtime fixes/behavioral contract changes.
.llm/skills/testing/tests-must-be-parameterized-by-message-kind.md Adds new testing skill doc describing message-kind parameterization rule and enforcement.
.llm/skills/testing/single-thread-contract.md Adds new testing skill doc pinning single-thread contract expectations.
.llm/skills/testing/allocation-coverage-required-for-dispatch.md Adds new testing skill doc describing allocation coverage requirements.
.llm/skills/index.md Regenerates skills index (counts/dates/categories).
.cspell.json Updates cspell word list.

Comment thread .cspell.json Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 85 out of 87 changed files in this pull request and generated 2 comments.

Comment thread failed-tests.txt Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 83 out of 86 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (3)

Tests/Runtime/Core/EmitTargetedSpecificTests.cs.meta:3

  • The Unity .meta GUID changed for an existing script. GUID churn can break Unity asset references (scenes/prefabs/serialized test assets) that point at this script. Unless the file was intentionally recreated and you’re sure nothing references it, please restore the original GUID and keep the .meta stable across renames/edits.
    Tests/Runtime/Core/EmitBroadcastSpecificTests.cs.meta:3
  • The Unity .meta GUID changed for an existing script. GUID churn can break Unity asset references (scenes/prefabs/serialized test assets) that point at this script. Unless the file was intentionally recreated and you’re sure nothing references it, please restore the original GUID and keep the .meta stable across renames/edits.
    Tests/Runtime/Benchmarks/AllocationMatrixTests.cs.meta:3
  • The Unity .meta GUID changed for an existing test asset. GUID churn can break Unity asset references to this file. Unless this was an intentional recreation and nothing references it, please revert the GUID change to keep the asset stable.

@wallstop Eli Pinkerton (wallstop) merged commit a9c5c4b into master May 2, 2026
32 checks passed
@wallstop Eli Pinkerton (wallstop) deleted the dev/wallstop/more-exhaustive-tests branch May 2, 2026 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants