偿还 lewan 工程债:模块拆分、默认角色降级与短链收口

将 kuaishou-cloud 大入口拆为 prepare/rebind/probe/refresh 等模块;默认角色仅作诊断;补充兑换状态单测;短链明确只读兼容历史链接。
This commit is contained in:
yml2213
2026-07-10 14:01:29 +08:00
parent c70c3ff6a5
commit d6b0e45c7b
15 changed files with 1508 additions and 1190 deletions
@@ -141,20 +141,19 @@ export function hasKuaishouCloudDefaultRoleSnapshot(flowLike: unknown) {
return Boolean(flow.role.defaultName || flow.role.defaultRid)
}
/**
* 是否已有可展示的绑定角色信息(诊断用)。
*
* 注意:履约主闸已改为 claimIdentity.expectedUid 匹配;
* 本函数不再要求「当前角色必须不同于虚拟机默认角色」。
*/
export function hasKuaishouCloudCustomerRole(flowLike: unknown) {
const flow = normalizeKuaishouCloudFlow(flowLike)
if (!flow.binding.vnPhone || !flow.binding.roleName || !flow.binding.roleId) {
if (!flow.binding.vnPhone) {
return false
}
if (!hasKuaishouCloudDefaultRoleSnapshot(flow)) {
return false
}
return !isSameKuaishouCloudRoleIdentity(
{ name: flow.binding.roleName, rid: flow.binding.roleId },
{ name: flow.role.defaultName, rid: flow.role.defaultRid },
)
return Boolean(flow.binding.roleName || flow.binding.roleId)
}
export function isSameKuaishouCloudRoleIdentity(