Skip to content

feat: make channel id as a unique id with upstream. - #52

Merged
ksqeib merged 2 commits into
HyperZoneLogin:masterfrom
qyl27:feat/channel-id-indicates-a-unique-upstream
Nov 14, 2026
Merged

ksqeib merged 2 commits into
HyperZoneLogin:masterfrom
qyl27:feat/channel-id-indicates-a-unique-upstream

Conversation

@qyl27

@qyl27 qyl27 commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

变更说明

替代#51,直接更改Channel Id的语义,可用于标识唯一上游来源。
对于Offline和Floodgate,它就是对应的channelId(即offline和floodgate);
对于Yggdrasil,它是yggdrasil:<entryId>。

关联范围

  • openvc
  • auth-yggd
  • auth-offline
  • data-merge
  • profile-skin
  • api
  • 文档
  • GitHub 工作流 / 仓库配置

变更类型

  • Bug 修复
  • 新功能
  • 重构
  • 文档更新
  • 构建 / CI 调整
  • 其他

测试与验证

请说明你做了哪些验证,例如:

  • 已本地构建通过
  • 已运行相关测试
  • 已验证配置生成 / 加载正常
  • 已验证迁移逻辑或命令行为
  • 已更新相关文档

兼容性与风险

这是一个API的breaking change,更改了HyperZoneCredential#channelId的语义。

其他补充

如有截图、日志、配置示例或后续 TODO,请在此补充。

Summary by Sourcery

Make credential channel IDs uniquely identify their upstream authentication source and update the API and authentication modules to use the new semantics.

New Features:

  • Assign unique upstream-aware channel IDs to credentials, including per-entry IDs for Yggdrasil authentication.

Enhancements:

  • Move credential-channel registration into submodule registration and simplify the registry to track channel IDs only.
  • Remove channel-based registration restrictions and the associated authentication configuration, capability API, messages, and enforcement logic.

@sourcery-ai

sourcery-ai Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

API

Redefine credential channel IDs as upstream-specific identifiers, remove channel capabilities, and shift channel declaration responsibility to each submodule’s register method.

  • api/src/main/kotlin/icu/h2l/api/HyperZoneApi.kt L63
  • api/src/main/kotlin/icu/h2l/api/player/HyperZonePlayer.kt L131
  • api/src/main/kotlin/icu/h2l/api/profile/CredentialChannelRegistry.kt L28, L33-39, L50 (removed lines)
  • api/src/main/kotlin/icu/h2l/api/profile/HyperZoneCredential.kt L38
  • api/src/main/kotlin/icu/h2l/api/module/HyperSubModule.kt L30 (removed lines)
  • api/src/main/kotlin/icu/h2l/api/profile/CredentialChannelAbility.kt (deleted)

Uses of the API

Register the built-in offline and Floodgate channels explicitly, and register one channel for each configured Yggdrasil entry.

  • subplugin/auth-floodgate/src/main/kotlin/icu/h2l/login/auth/floodgate/FloodgateSubModule.kt L47 (removed lines), L49-50
  • subplugin/auth-offline/src/main/kotlin/icu/h2l/login/auth/offline/OfflineSubModule.kt L53-54
  • subplugin/auth-yggd/src/main/kotlin/icu/h2l/login/auth/online/main/YggdrasilSubModule.kt L40, L48 (removed lines), L68-71

Implementation

Generate Yggdrasil credential channel IDs from each entry ID so credentials identify their specific upstream.

  • subplugin/auth-yggd/src/main/kotlin/icu/h2l/login/auth/online/credential/YggdrasilHyperZoneCredential.kt L28, L39, L83 (removed lines)

Simplify the channel registry to store registered IDs only, and remove core startup registration based on the old submodule property.

  • velocity/src/main/kotlin/icu/h2l/login/HyperZoneLoginMain.kt L172, L293 (removed lines)
  • velocity/src/main/kotlin/icu/h2l/login/profile/CredentialChannelRegistryImpl.kt L24 (removed lines), L30-46

Remove registration-ability checks from the authentication and rename flows now that channel capabilities are gone.

  • subplugin/auth-floodgate/src/main/kotlin/icu/h2l/login/auth/floodgate/service/FloodgateAuthService.kt L27 (removed lines), L115-119, L121 (removed lines)
  • subplugin/auth-offline/src/main/kotlin/icu/h2l/login/auth/offline/service/OfflineAuthService.kt L28 (removed lines), L65 (removed lines)
  • subplugin/auth-yggd/src/main/kotlin/icu/h2l/login/auth/online/service/YggdrasilCredentialService.kt L28 (removed lines), L34 (removed lines), L72 (removed lines)
  • velocity/src/main/kotlin/icu/h2l/login/command/RenameCommand.kt L31 (removed lines), L104 (removed lines)

UI

Remove user-facing messages and rendering helpers for registration-disabled outcomes that are no longer enforced.

  • subplugin/auth-floodgate/src/main/kotlin/icu/h2l/login/auth/floodgate/FloodgateMessages.kt L36 (removed lines)
  • subplugin/auth-floodgate/src/main/resources/messages/auth-floodgate/en_us.conf L4 (removed lines)
  • subplugin/auth-floodgate/src/main/resources/messages/auth-floodgate/zh_cn.conf L4 (removed lines)
  • subplugin/auth-offline/src/main/kotlin/icu/h2l/login/auth/offline/OfflineAuthMessages.kt L55 (removed lines)
  • subplugin/auth-offline/src/main/resources/messages/auth-offline/en_us.conf L15 (removed lines)
  • subplugin/auth-offline/src/main/resources/messages/auth-offline/zh_cn.conf L15 (removed lines)
  • subplugin/auth-yggd/src/main/kotlin/icu/h2l/login/auth/online/message/YggdrasilMessages.kt L32 (removed lines)
  • subplugin/auth-yggd/src/main/resources/messages/auth-yggd/en_us.conf L4 (removed lines)
  • subplugin/auth-yggd/src/main/resources/messages/auth-yggd/zh_cn.conf L4 (removed lines)

Configuration

Remove the core disable-registration option and its localized configuration comments along with the obsolete configuration class.

  • velocity/src/main/kotlin/icu/h2l/login/config/AuthConfig.kt L22-32
  • velocity/src/main/kotlin/icu/h2l/login/config/CoreConfig.kt L53 (removed lines)
  • velocity/src/main/resources/config-comments/en_us.conf L14 (removed lines)
  • velocity/src/main/resources/config-comments/zh_cn.conf L14 (removed lines)

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've found 3 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="subplugin/auth-yggd/src/main/kotlin/icu/h2l/login/auth/online/credential/YggdrasilHyperZoneCredential.kt" line_range="38" />
<code_context>
     private val knownUserUUID: UUID? = null,
 ) : HyperZoneCredential, IPropertiesHolder by PropertiesHolder() {
-    override val channelId: String = CHANNEL_ID
+    override val channelId: String = "$CHANNEL_ID:$entryId"
     override val credentialId: String = "$entryId:$authenticatedUUID"

</code_context>
<issue_to_address>
**Disabled registration is bypassed**

When registration is disabled and an unbound Yggdrasil credential reaches the rename flow, `RenameCommand` looks up the credential’s `yggdrasil:<entryId>` channel ID, but `YggdrasilSubModule` registers only `yggdrasil`. The lookup returns null, so the `canRegister == false` check does not block user creation and registration proceeds despite the restriction.

Make the rename flow check the registered Yggdrasil ability for per-entry credentials before creating a user.
</issue_to_address>

### Comment 2
<location path="subplugin/auth-yggd/src/main/kotlin/icu/h2l/login/auth/online/credential/YggdrasilHyperZoneCredential.kt" line_range="38" />
<code_context>
     private val knownUserUUID: UUID? = null,
 ) : HyperZoneCredential, IPropertiesHolder by PropertiesHolder() {
-    override val channelId: String = CHANNEL_ID
+    override val channelId: String = "$CHANNEL_ID:$entryId"
     override val credentialId: String = "$entryId:$authenticatedUUID"

</code_context>
<issue_to_address>
**Per-upstream registration blocks are ignored**

When `disableRegistration` contains `yggdrasil:<entryId>` for an upstream and a player authenticates through it, `YggdrasilCredentialService` checks registration ability using the fixed `yggdrasil` ID, while the credential now identifies itself as `yggdrasil:<entryId>`. A `disableRegistration` entry for one upstream therefore does not stop the service from creating a user automatically after authentication with that upstream.

Register each configured Yggdrasil entry’s channel ID and have the authentication service check the corresponding credential’s channel ID.
</issue_to_address>

### Comment 3
<location path="subplugin/auth-yggd/src/main/kotlin/icu/h2l/login/auth/online/credential/YggdrasilHyperZoneCredential.kt" line_range="38" />
<code_context>
     private val knownUserUUID: UUID? = null,
 ) : HyperZoneCredential, IPropertiesHolder by PropertiesHolder() {
-    override val channelId: String = CHANNEL_ID
+    override val channelId: String = "$CHANNEL_ID:$entryId"
     override val credentialId: String = "$entryId:$authenticatedUUID"

</code_context>
<issue_to_address>
**Player API documents stale Yggdrasil ID**

When a consumer uses `HyperZonePlayer.authChannelId` to identify Yggdrasil authentication, `VelocityHyperZonePlayer.authChannelId` returns the submitted credential’s `channelId`, so Yggdrasil players now report `yggdrasil:<entryId>`. The exported `HyperZonePlayer` contract still lists `"yggdrasil"` as the example value, leaving consumers that compare against the documented value unable to recognize Yggdrasil authentication.

Update the `authChannelId` contract to document the entry-specific format and clarify how consumers should identify the Yggdrasil family of channels.
</issue_to_address>

Sourcery assessment

Approval pending. 3 findings to address first.

Blocking findings: subplugin/auth-yggd/src/main/kotlin/icu/h2l/login/auth/online/credential/YggdrasilHyperZoneCredential.kt:38, subplugin/auth-yggd/src/main/kotlin/icu/h2l/login/auth/online/credential/YggdrasilHyperZoneCredential.kt:38, subplugin/auth-yggd/src/main/kotlin/icu/h2l/login/auth/online/credential/YggdrasilHyperZoneCredential.kt:38


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Signed-off-by: 秋雨落 <i@rain.cx>
@qyl27
qyl27 force-pushed the feat/channel-id-indicates-a-unique-upstream branch from 9060600 to 856098e Compare November 13, 2026 12:09
Signed-off-by: 秋雨落 <i@rain.cx>
@ksqeib
ksqeib merged commit 3d42f60 into HyperZoneLogin:master Nov 14, 2026
1 of 2 checks passed
@qyl27
qyl27 deleted the feat/channel-id-indicates-a-unique-upstream branch November 15, 2026 00:19
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