fix(mobile): 通过热更恢复 SSO Canary 匿名 OTA - #3838
Conversation
Signed-off-by: guyong <guyong@xd.com>
|
| Filename | Overview |
|---|---|
| apps/mobile/src/update/otaRequestCoordinator.ts | 新增 OTA 请求头迁移与串行协调器,但 null updateId 处理使普通包内启动无法进入 OTA operation。 |
| apps/mobile/src/update/useStartupOtaGate.ts | 启动与 emergency recovery 改由协调器包装;协调器前置拒绝会被此处静默 fail-open。 |
| apps/mobile/src/update/resumeUpdateCheck.ts | 将回前台的 check/fetch 组合为可注入的单一协调事务,未发现独立缺陷。 |
| apps/mobile/src/update/manualUpdateCheck.ts | 手动检查支持协调客户端,并避免 fetch 未下载新 bundle 时无意义 reload。 |
| apps/mobile/app/settings.tsx | 自建渠道注入共享协调器,非自建渠道继续使用动态 consent 闸门。 |
Sequence Diagram
sequenceDiagram
participant Gate as 启动 OTA Gate
participant Coord as OTA 协调器
participant Expo as expo-updates
participant Store as AsyncStorage
Gate->>Coord: runSelfHostedOtaRequest(channel)
Coord->>Expo: 读取 updateId / runtimeVersion
alt "普通 embedded launch,updateId=null"
Coord-->>Gate: 抛出 current-update-id-unavailable
Gate-->>Gate: catch 后放行业务树
Note over Gate,Expo: check/fetch/reload 未执行
else updateId 可用或 emergency 合成 ID
Coord->>Store: 解析或写入 legacy 基线
Coord->>Expo: 应用 shared URL/headers
Gate->>Expo: check → fetch → reload/recovery
Coord->>Store: 成功下载不同 ID 后写 shared 基线
Coord->>Expo: 恢复最终基线配置
end
Prompt To Fix All With AI
### Issue 1
apps/mobile/src/update/otaRequestCoordinator.ts:376-377
**普通包内启动无法检查 OTA**
当自建客户端正常运行包内 bundle、`Updates.updateId` 为 `null` 且不处于 emergency launch 时,这里会把空 ID 传给协调器,导致 `resolveBaseline` 在执行 `runStartupOtaUpdate` 前抛错。新安装或仍运行包内 JS 的客户端因此会跳过启动 OTA,无法通过该入口取得后续更新。
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Reviews (1): Last reviewed commit: "fix(mobile): 通过热更恢复 SSO Canary 匿名 OTA" | Re-trigger Greptile
|
命中 UI 路径(apps/mobile/app/settings.tsx / apps/mobile/src/update/manualUpdateCheck.ts / apps/mobile/src/update/otaRequestCoordinator.ts 等)但 description 未附界面效果证据——建议补充改动后效果:截图/录屏,或改动后界面的 HTML 页面(```html 代码块、.html 附件或在线预览链接),便于确认界面符合 DESIGN.md 设计规范。 |
|
这条 PR 会改自建 OTA 的隐私闸门:未同意 analytics / 隐私政策时,也能用全设备共享 UUID 匿名检查热更,覆盖启动、回前台和设置页手动检查。 这是产品方向和更新链路架构的变化,需要维护者确认后再合。请在 PR 上 Approve;如果要改,请 Request Changes。 讨论 issue:#3839 |
Signed-off-by: guyong <guyong@xd.com>
|
自建 OTA 用共享 UUID 把 SSO Canary 匿名热更救回来,还没绕开非自建渠道的同意门,谢谢。 |
这次改了什么
摘要
本 PR 替代已关闭的 #3824,在不修改 Mobile 原生配置、不改变 runtime fingerprint 的前提下,为 #3359 增加一个纯 JS OTA bridge:
check → fetch → reload事务前临时把EAS-Client-ID覆盖为所有设备共用的固定 UUID,release / canary / beta 继续保留各自路由语义。acceptPrivacyConsent()。SSO + consent=false + Canary=true、超时晚到、并发串行、emergency launch 与原生配置守卫测试;补齐 U1→U2 跨冷启动、首次基线写入失败及排队期间账号 / channel 切换回归。变更类型
feat新功能fix缺陷修复refactor/perf重构或性能优化docs/test/chore文档、测试或工程维护范围
app.config.js/app.json、原生模块与依赖、服务端、TapDB consent、SSO 协议流程UI 变化
不涉及:
settings.tsx只调整更新检查的能力注入,没有修改布局、样式或 UI 文案。怎么验证的
自动验证
手工验证
不涉及:未生成新的签名 APK / IPA;本方案要求只发布现有 runtime 的 OTA。
未执行的验证
EAS-Client-ID均为共享 UUID。风险
风险分类
影响与回滚
consent=false的客户端不会发出首个 OTA 请求,尚未下载的 JS 无法解除旧闸门。它必须先同意一次隐私协议取得 bridge;卸载重装同一个旧整包也不能绕过。纯热更无法覆盖这部分设备。提交前检查
git commit -s,见 DCO)