Repository navigation
feat(mobile): add encrypted, isolated connection profiles (Phase 2) - #12121
Conversation
|
Initialization regression fixed in Repeated runs on unchanged Final artifact checks:
The committed production-path regression checks the very first HTTP cookie and initial cookie/localStorage/IndexedDB/cache, then verifies retention on reconnect. Independent acceptance also passed rapid two-process restart with durabletrue but an absent provider name, cancellation during a real clear, stale browser-identity rotation, an explicitly simulated pending-name reservation, and concurrent durable deletion through a second real Activity vault. The latter is controlled persisted-deletion testing, not native Delete-dialog acceptance; the initial premature async-dialog assertion was a harness failure and was corrected without changing production code. No app-data wipe, arbitrary metadata-flush delay or provider-private mutation was used to hide the baseline. Debug APK SHA-256: 中文: |
acac9a3 to
92f6af0
Compare
|
Please do not rebase or force-push to an active PR as it invalidates existing review comments. Note for future reference, the bots always squash all changes into a single commit automatically as part of the integration. 中文请勿对活跃的 PR 执行 rebase 或 force-push,因为这会使已有的评审评论失效。另外,供日后参考:作为集成流程的一部分,机器人始终会自动将所有改动压缩(squash)为单个提交。 |


What this PR does
Initialization safety update (
acac9a3b3d): repeated tests found that WebView 124 can reuse stale localStorage for a fresh profile name after rapid process restart. The final implementation persists an initialization marker, checks the provider registry before creation, and completes profile-scoped browsing-data deletion before loading any page or credential. New/migrated/missing profiles require bothMULTI_PROFILEandDELETE_BROWSING_DATA; WebView 124 fails closed. Existing native credentials migrate intact, with a one-time browser-session/cache reset. Initialized known profiles retain state. Cancellation, concurrent deletion and stale Activity identities cannot authorize loading. Guard design (EN), 中文.Ready for review after #11722 merged. This connection-profile foundation is rebased onto
main(8b39d93a42), with heada765ac1ecf9acdc67afa51610c432a3359c3ad14. The comparison now contains its two Phase 2 commits and a YAML formatting follow-up; the already merged PWA/Android scaffold history is removed. The implementation files are byte-identical to the previously verifiedacac9a3b3drevision. This is the first focused Phase 2 slice, not completion of the entire mobile roadmap.Verification provenance: a separate September 18 comment records fresh checks on the rebased head. Earlier screenshots and additional interactive/adversarial scenarios below remain pre-rebase evidence for the identical implementation; they are not new runs. Upstream CI must complete, and maintainer approval is still required.
CI follow-up, September 18:
a765ac1ecfadds single quotes around the two emulator architecture values, fixing thequoted-stringsfailure in the mobile workflow. Pinned yamllint 1.35.1 passes, and the parsed YAML is unchanged. Native/H5 source files are unchanged from the tested head in the verification comment; upstream checks are rerunning for this additive commit.Adds native Add/Edit/Connect/Delete controls, an Android Keystore-backed encrypted vault with recoverable migration from the development profile, and isolated WebView storage for each connection. Changing an address or credential rotates browser identity; switching destroys the old view and cancels its dialogs. Lost keys or corrupt data show explicit recovery, and providers without isolated-profile support show an update message instead of sharing browser storage.
Why it's needed
The development shell currently requires editing private preferences and stores one credential in plaintext. Users need to manage multiple daemon connections without carrying authentication or workspace state between them. The daemon-served Web Shell remains the session UI; this introduces neither a separate chat implementation nor a new protocol.
Reviewer Test Plan
How to verify
MULTI_PROFILE: management remains usable, while Connect gives native update guidance. On a supported provider, stop and restart the local test server and use Retry; the selected connection should recover. Cancel a native JavaScript confirmation and confirm the page receives cancellation.Evidence (Before & After)
Before: the clean development APK only displays “No valid daemon profile.” After: native connection management and masked credential entry. Screenshots use synthetic data. A separate E2E comment records exact environments, observed behavior and limitations.
Tested on
Environment
Final
acac9a3b3d: JDK17, Gradle8.2.1, compileSDK34, AndroidX WebKit1.13.0. Debug/unsigned-release builds,21 JVM tests and lint passed (0 errors,6 existing notices). API36/WebView134:6 committed tests passed,1 old-provider-only skip. API35/WebView124:4 passed,3 unsupported-feature skips, including actual Connect failing closed without HTTP. Production-path tests inspect the first HTTP cookie and initial cookie/localStorage/IndexedDB/cache, then verify retention on reconnect. Independent rapid-restart and cancellation/stale-state checks also passed. Earlier95ff provider results below are historical and do not establish the new initialization guarantee. Native-only validation uses Gradle; no TypeScript files changed. Upstream workflows require maintainer authorization.Risk & Scope
MULTI_PROFILEand, for initialization,DELETE_BROWSING_DATA, in addition to WebView 111+. There is no shared-storage fallback. Obsolete browser identities are never reused; deletion may wait until the next cold launch when the provider allows it.Design: English / 简体中文, synchronized in this commit.
Linked Issues
Refs #11704. Builds on merged #11722. Follows the maintainer's native-shell / REST+SSE architecture and the Phase 2 proposal.
中文说明
改动内容
**初始化安全更新(
acac9a3b3d):**反复测试发现 WebView 124 在快速重启进程后可能将旧 localStorage 复用于新配置名称。最终实现持久化初始化标志,在创建前检查提供程序注册表,并在加载页面或凭据前完成配置级浏览数据清除。新建、迁移或提供程序中名称缺失的配置同时要求MULTI_PROFILE和DELETE_BROWSING_DATA,WebView 124 会拒绝不安全连接。原生凭据完整迁移,浏览器会话和缓存会清除一次;已初始化且名称仍存在的配置保留状态。取消、并发删除及过期 Activity 标识不能授权加载。上方链接提供完整英中初始化设计。#11722 已合并,本 PR 已准备好接受评审。 连接配置基础已变基到
main(8b39d93a42),当前提交为a765ac1ecf9acdc67afa51610c432a3359c3ad14。与 main 的差异包含本切片的两个 Phase 2 提交及一个 YAML 格式修正提交,已移除合并后的 PWA/Android 骨架历史。实现文件与此前验证的acac9a3b3d逐字节相同。这是首个聚焦的 Phase 2 切片,并非整个移动端路线图已完成。验证来源: 9 月 18 日的独立评论记录变基后提交的新验证。下方早先截图及额外交互/对抗场景仍是相同实现的变基前证据,不能视为本次重新执行。仍需上游 CI 完成及维护者评审通过。
9 月 18 日 CI 后续修正:
a765ac1ecf为两个模拟器架构值添加单引号,修复移动端 workflow 的quoted-strings错误。固定版本 yamllint 1.35.1 验证通过,YAML 解析结果不变。原生/H5 源码与验证评论中的已测试提交相同,上游检查正在针对这个追加提交重新运行。新增原生添加、编辑、连接、删除操作,基于 Android Keystore 的加密存储、可恢复的开发配置迁移,以及每个连接独立的 WebView 存储。修改地址或凭据会轮换浏览器身份;切换时销毁旧视图并取消其对话框。密钥丢失或数据损坏时提供明确恢复入口;不支持隔离配置的提供方显示更新提示,不回退到共享存储。
动机
目前开发外壳需要编辑私有偏好,并以明文保存单个凭据。用户需要管理多个 daemon 连接,同时避免认证和工作区状态串用。会话界面仍由 daemon 提供的 Web Shell 负责;本改动不增加另一套聊天界面或新协议。
评审测试计划
验证方法
MULTI_PROFILE的提供方:仍可管理配置,但连接会显示原生更新提示。在支持的提供方上停止并重新启动本地测试服务器,然后点击重试,确认恢复所选连接。取消原生 JavaScript 确认框,确认页面收到取消结果。前后对比证据
之前:全新开发 APK 只显示“No valid daemon profile”。之后:原生连接管理和遮蔽的凭据输入。上方截图均使用合成数据。独立 E2E 评论记录具体环境、观察结果和限制。
测试平台
环境
最终
acac9a3b3d:JDK17、Gradle8.2.1、compileSDK34、AndroidX WebKit1.13.0。调试及未签名发布构建、21项JVM测试和lint通过(0错误、6项既有提示)。API36/WebView134的已提交测试6项通过、1项仅适用旧提供程序而跳过;API35/WebView124为4项通过、3项因能力不支持跳过,其中真实Connect验证拒绝连接且不发HTTP。产品路径测试检查首个HTTP cookie及最初的cookie/localStorage/IndexedDB/cache,并验证重连保留。独立快速重启、取消及过期状态检查也通过。早期95ff提供程序结果仅为历史记录,不能证明新的初始化保证。本改动仅涉及原生端,采用Gradle验证,没有TypeScript改动;上游工作流需要维护者授权。风险与范围
MULTI_PROFILE,初始化时还必须支持DELETE_BROWSING_DATA,不提供共享存储回退。废弃身份永不复用;删除浏览器数据可能要等到下次冷启动且提供方允许时执行。设计:English / 简体中文,本提交保持同步。
关联议题
关联 #11704,基于已合并的 #11722。遵循维护者的原生外壳 / REST+SSE 架构及 Phase 2 提案。