Skip to content

refactor(dds): UserEndpointManager の責務を分離#104

Merged
OJII3 merged 6 commits into
mainfrom
refactor/user-endpoint-manager-testability
Jul 1, 2026
Merged

refactor(dds): UserEndpointManager の責務を分離#104
OJII3 merged 6 commits into
mainfrom
refactor/user-endpoint-manager-testability

Conversation

@OJII3

@OJII3 OJII3 commented Jun 30, 2026

Copy link
Copy Markdown
Owner

概要

UserEndpointManager (411 行) を責務ごとに 3 つのコンポーネントに分離し、public API を一切変更せずに contract 単位の単体テストを追加します。

背景

UserEndpointManager はローカル user endpoint の登録状態とマッチングを担う中心的なコンポーネントだったが、内部に lock 保持・receiver 副作用・match 判定・locator 解決が混在しており、EditMode / .NET unit test で挙動を絞りにくかった。\n
ドメイン participant のテスタビリティ向上 (docs/superpowers/specs/2026-06-30-domain-participant-testability-design.md) と同じパターン (interface 抽出 + 純関数ヘルパー + 副作用分離) を適用する。

設計

詳細: docs/superpowers/specs/2026-06-30-user-endpoint-manager-testability-design.md

アーキテクチャ

コンポーネント 責務 種類
EndpointRegistry local writer/reader の登録状態管理 状態 holder
EndpointMatcher match / unmatch 判定 + remote unicast locator 解決 純ロジック
IEndpointReceiver + ParticipantRtpsReceiverAdapter ParticipantRtpsReceiver への register / unregister 呼び出しを隠蔽 副作用境界
UserEndpointManager (改修) 上記 3 つを束ねるオーケストレータ。public API は据え置き オーケストレータ

コミット

  • 3e9c660 refactor(dds): IEndpointReceiver interface と adapter を追加
  • fb8479b refactor(dds): EndpointMatcher を抽出 (match 判定 + locator 解決)
  • b38c104 refactor(dds): EndpointRegistry を抽出 (状態 holder)
  • 171bda5 refactor(dds): UserEndpointManager を Registry/Matcher/Receiver へ委譲

影響範囲

新規ファイル (src/rosettadds/Dds/ 配下):

  • EndpointRegistry.cs (+ .meta)
  • EndpointSnapshot.cs (+ .meta)
  • LocalWriter.cs (+ .meta)
  • LocalReader.cs (+ .meta)
  • MatchDecision.cs (+ .meta)
  • EndpointMatcher.cs (+ .meta)
  • IEndpointReceiver.cs (+ .meta)
  • ParticipantRtpsReceiverAdapter.cs (+ .meta)

変更ファイル:

  • UserEndpointManager.cs — 内部実装を委譲
  • DomainParticipant.cs — adapter を渡すよう 1 行変更
  • 既存テスト 2 件: UserEndpointManagerTests.cs (コンストラクタ呼び出しのみ更新)

新規テストファイル (tests/rosettadds.Tests/Dds/ 配下):

  • EndpointRegistryTests.cs (10 tests)
  • EndpointMatcherTests.cs (18 tests)
  • UserEndpointManagerRefactoredTests.cs (6 tests)
  • FakeEndpointReceiver.cs (fake impl)
  • ParticipantRtpsReceiverAdapterTests.cs (5 tests)

非目標

  • UserEndpointManager / DomainParticipant の public API 変更なし
  • ParticipantRtpsReceiver の interface 化なし (adapter で wrap のみ)
  • DiscoveryDb の interface 化なし
  • DDS / RTPS wire protocol の変更なし

受け入れ基準

  • 新規 39 テストが全て緑
  • 既存 UserEndpointManagerTests.cs の 2 件が緑のまま
  • 既存 DDS 統合テストが緑のまま (1 件の既知 flaky テスト PublisherBatchTests を除く)
  • UserEndpointManager の public API への破壊的変更なし
  • DomainParticipant の public API への破壊的変更なし
  • check_unity_meta.sh クリーン

@OJII3 OJII3 marked this pull request as ready for review July 1, 2026 02:54
@OJII3 OJII3 merged commit 6995f9d into main Jul 1, 2026
1 check passed
@OJII3 OJII3 deleted the refactor/user-endpoint-manager-testability branch July 1, 2026 02:54
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.

1 participant