Skip to content

feat(network-remotemessaging): 统一消息发送器本服身份改为构造注入 - #617

Merged
AlianBlank merged 1 commit into
mainfrom
feature/auto-server-source-worker-run-11495-20261022T0410
Oct 22, 2026
Merged

AlianBlank merged 1 commit into
mainfrom
feature/auto-server-source-worker-run-11495-20261022T0410

Conversation

@AlianBlank

@AlianBlank AlianBlank commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

Linear: GFX-988

Summary by CodeRabbit

  • 破坏性变更
    • 初始化统一消息发送器时,现需明确提供本服类型和 ID;旧调用方式不再兼容。
  • 改进
    • 本服身份改为由初始化方提供,不再从全局设置读取;多 Role 进程会使用热更新加载回调提供的身份信息。
    • 本服路由继续按服务器类型(忽略大小写)和服务器 ID 判断。

UnifiedMessageSender 构造器新增必填 localServerType/localServerId 并由
InitializeWithDefaults 同签名透传,热更桥接装配点传 OnLoadSuccess 的
setting;删除构造期读取 GlobalSettings.CurrentSetting 与 Game 常量回落,
发送端本服判定不再依赖 CurrentSetting 钉住时序;新增本服判定、身份注入
与空白守卫单测,既有两处测试构造同批迁移并保持 player:Game 断言。

BREAKING CHANGE: UnifiedMessageSender 构造器与 UnifiedMessageSenderHolder.InitializeWithDefaults 签名变化,旧签名不再编译,调用方需同批传入本服身份。

Linear: GFX-988
@coderabbitai

coderabbitai Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d92ab32b-c90a-4b67-9456-95dab1988545
📥 Commits

Reviewing files that changed from the base of the PR and between cc91ac3 and d38ca32.

📒 Files selected for processing: 5
  • CHANGELOG.md
  • GameFrameX.Hotfix/Lifecycle/HotfixModuleLifecycleBridge.cs
  • GameFrameX.Network.RemoteMessaging/Unified/UnifiedMessageSender.cs
  • GameFrameX.Network.RemoteMessaging/Unified/UnifiedMessageSenderHolder.cs
  • Tests/GameFrameX.Tests/UnifiedMessaging/UnifiedMessagingTests.cs

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

📝 Walkthrough

统一消息发送器改为通过构造参数接收本服服务器类型和编号。热更桥接将配置中的身份传给发送器初始化入口。相关测试覆盖本服路由判定、跨服转发、指标和服务器类型参数校验。

Changes: 本服身份注入

层 / 文件 摘要
发送器初始化时传递本服身份
GameFrameX.Network.RemoteMessaging/Unified/UnifiedMessageSender.cs, GameFrameX.Network.RemoteMessaging/Unified/UnifiedMessageSenderHolder.cs, GameFrameX.Hotfix/Lifecycle/HotfixModuleLifecycleBridge.cs, CHANGELOG.md
构造器和 InitializeWithDefaults 新增本服服务器类型与编号参数。热更桥接传入 setting.ServerType 和 setting.ServerId。发送器不再读取全局设置,也不再回退到默认游戏服身份。
验证本服路由与参数
Tests/GameFrameX.Tests/UnifiedMessaging/UnifiedMessagingTests.cs
测试覆盖本服类型比较、服务器编号匹配、本地投递指标,以及无效服务器类型的参数异常。测试替身统计指定远程调用。

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant HotfixModuleLifecycleBridge
  participant UnifiedMessageSenderHolder
  participant UnifiedMessageSender
  HotfixModuleLifecycleBridge->>UnifiedMessageSenderHolder: 传入 setting.ServerType 和 setting.ServerId
  UnifiedMessageSenderHolder->>UnifiedMessageSender: 构造时传入本服服务器类型和编号
Loading

Possibly related issues

  • Issue 615:要求将 UnifiedMessageSender 的本服身份改为构造注入。本次变更新增身份参数,并更新初始化入口和热更装配点。
  • Issue 614:涉及热更桥接保留当前配置及后续身份传递。本次变更由热更桥接将服务器身份传给发送器。
Merge Risk: ⚪ Minimal · up to d38ca

The identity injection is ready to merge after normal checks. In-repository callers have been updated; external consumers must adopt the documented API change.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 17.86% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 28 functions across 4 files. (1 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed 标题准确概括了主要变更:将统一消息发送器的本服身份改为构造注入。标题简洁、明确,并与代码及 PR 目标一致。
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 17.86% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 28 functions across 4 files. (1 skipped: 1 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@sonarqubecloud

Copy link
Copy Markdown

@AlianBlank
AlianBlank merged commit 8cd35ea into main Oct 22, 2026
3 checks passed
@AlianBlank
AlianBlank deleted the feature/auto-server-source-worker-run-11495-20261022T0410 branch October 22, 2026 06:09
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