Skip to content

feat(cli): compare verified configuration backup snapshots - #9519

Merged
huangruiteng merged 3 commits into
loopx-project:mainfrom
steven-kid:roadmap-auto/20261127-configuration-backup-compare
Nov 27, 2026
Merged

huangruiteng merged 3 commits into
loopx-project:mainfrom
steven-kid:roadmap-auto/20261127-configuration-backup-compare

Conversation

@steven-kid

@steven-kid steven-kid commented Nov 27, 2026 •

Copy link
Copy Markdown
Collaborator

Operators can compare two saved configuration backups before choosing an isolated recovery checkpoint, through both configuration-backup compare --before FILE --after FILE and the existing Settings configuration-backup panel.

The TypeScript configuration owner verifies both envelopes and hashes before comparing complete stored values. Reports preserve missing/null/false/zero distinctions, ordered arrays, Goal identity and selected-cohort semantics. Python and the App transport/render that result; comparison neither follows source paths nor changes live settings. This advances the Accepted complete-state recovery inspection workflow, without activation or broader permissions.

The review follow-up fixes two independently reproduced gaps:

  • Native exports of about 4.5 MB each previously verified independently but failed comparison at the 8 MiB request frame. Comparison now uses the existing authenticated private-snapshot transport, retaining the global 8 MiB frame and 64 MiB private transport ceilings. Combined serialized parameters are bounded at 64 MiB; complete comparison results at 56 MiB reserve response-envelope headroom. Oversized results fail without partial differences. Existing export/verify/restore transport behavior is unchanged; no runtime arbitrary-path parameter was added.
  • Settings accepts two files and displays errors, hashes, Goal cohorts and expandable complete differences. Selecting before/after invokes the existing recovery preview; isolated restore still requires a separate explicit action. Replacing either file invalidates the reviewed candidate, and late responses after changing Settings scope cannot revive old comparison/recovery state.

Validation on the incremental change from 9a5d2900f7fbd577822967bc05404ddf25392cdd:

  • python -m pytest -q tests/test_configuration_backup_transport.py tests/test_configuration_backup.py: 31 passed. Real native export/verify/compare compatibility covers a sparse change and a complete approximately 9 MB response, with source/input bytes unchanged. Corrupt response-digest readback raises ambiguity once, does not replay, and removes private temporary files. The aggregate request refusal is exercised at a reduced fixture boundary.
  • node --no-warnings --experimental-strip-types --test tests/control_plane_ts/configuration_backup.test.ts: 9 passed. The 56 MiB rejection is checked through the real owner with a byte-count boundary substitute, not a physically oversized allocation.
  • python -m pytest -q tests/presentation/test_configuration_backup_compare_api.py: 1 passed after final typing fix, with the real HTTP server and owner.
  • Control-plane typecheck, changed-Python Ruff, diff checks, dashboard build:chat and CSS checks: passed.
  • Packaged browser configuration-backup scenario: passed. Chinese/English, keyboard, 390px layout, invalid JSON/digest, unavailable-response retry, delayed comparison/preview during scope replacement, input replacement, and explicit isolated restore with exact checkpoint readback. Configuration backup routes use the real disposable backend; surrounding workspace state is synthetic fixture data. Live registry and machine configuration bytes remain unchanged.
  • Standard incremental premerge: direct checks 4/4, compilation, catalog 7/7, risk smokes 8/8 and text public-boundary scan 1/1 passed. It retains manual_review_required for the guide's PNG; binary media is outside text-scan coverage. The image was visually inspected against its synthetic fixture and contains only IHDR/IDAT/IEND chunks, with no text/EXIF metadata. This is not an automatic privacy pass or merge authorization.

Historical kernel-contracts attribution: exact CI merge 95be4caf1f234627e563fc31a33c7972d52a1cc9 and its base 126090271fe5048f761d4bc24bab0499f4f46dc9, using identical local Python 3.11.17 / mypy 1.20.2 environments, both report 3959 errors in 393 files. The final follow-up source reports the same diagnostic multiset after ignoring line shifts (zero additions/removals). The three CLI signatures cited in CI were unchanged. CI logs/full dependency freeze were inaccessible, so this is an exact-commit, matched-local-dependency comparison, not a claim of green CI.

Visual evidence for 88a3bc9964522a589f178afded2f3d8aa0560966: packaged browser App, synthetic data, 1512×982. The same canonical illustration is used in the operator guide. Hash/cohort detail and explicit recovery choices stay adjacent to changed values; the narrow layout stacks the two snapshots without horizontal overflow. No installed native App, Windows/macOS, production data, full repository test suite, merge or release qualification is claimed. Remote CI remains asynchronous and is not waited on or polled.

Configuration backup comparison in the packaged Settings App
Narrow recovery preview: the selected SHA-256 now wraps within its own code block. The packaged regression remains at 390 px through comparison, after/before selections, stale-state checks and explicit isolated restore. It verifies the exact digest text and every character's rendered rectangle, the settings panel and restore-button bounds; root scrollWidth alone is not an acceptance oracle. On the previous head, the panel extended to 476.81 px. After this local style fix, it stays at 14–361 px, the button at 30–345 px, and all digest characters at 30–339.61 px. The complete packaged scenario, dashboard build, CSS checks and diff checks passed. No Python or recovery authority behavior changed in this incremental fix.

Current narrow-screen evidence at 9ae1f11f8c47e54b1cdc7f8e5fb64e0664e3aec4: packaged browser, synthetic files, 390×844. The canonical image also illustrates digest review in the operator guide; it contains no text/EXIF PNG metadata. Standard premerge's automated checks passed, with the binary-image visual_evidence manual hold retained rather than represented as an automated privacy pass.

Complete selected digest and explicit isolated-restore action on a narrow screen

Independent completed Package Smoke attribution: exact base 06941016e224ccdc7c0298fd7a28acec65cf8a35 and preview 669173d68b6b176f4ebc3cd7805fc25ad1416844 both fail test_standard_installation_distinguishes_doctor_fingerprint_and_commands at the same helper assertion after the synthetic unowned-file fixture: doctor returns 1 while _run expects 0. Each commit's Core and three optional wheels were built separately and installed offline by the test, using matched Python 3.11.17 / pytest 9.2.0 / Node 24.19.0 and dependency versions. Both first pass the normal bare/issue-fix/standard/deep checks. This failure was reproduced once per commit, not inferred from unchanged source. No package/integrity code, global setting, or test expectation was modified. Shared chat-recovery and mypy failures remain separate, and remote CI is not claimed green.

Signed-off-by: Yuchao Wang <stevenkid404@gmail.com>

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh

Exact head: 9a5d2900f7fbd577822967bc05404ddf25392cdd

Request changes conclusion

[P2] 两份可校验的导出件合起来超过比较请求上限

原生 CLI 分别导出并校验约 4.5 MB 的前后快照,两份之间只改了一项布尔设置。比较退出 1,错误为 TypeScript Effect runtime request is oversized。请求同时发送两个完整信封,在到达比较 owner 前触发 8 MiB 帧上限。应复用有界私有传输,让比较能够处理现有导出支持的快照对,并覆盖完整结果的读回上限。 两个信封的传输 运行时帧限制

[P2] 配置备份设置缺少恢复前的比较步骤

操作员可以从 Settings 下载两份快照。回到同一面板后,只能选择一份文件并预检隔离恢复。请在已有面板接入只读双文件比较,沿用原权限,显示散列、范围、差异及无效输入错误。打包 App 应验证从比较结果到原隔离恢复入口的操作路径。 本轮交付范围 现有面板 前端交付约束

动机 / Motivation

操作员在升级或调整配置前后各导出一份快照。 现有校验只返回摘要。新入口可读出两份快照的实际差异,再选择要恢复的摘要。 恢复前应能检查两个已验证输入的差异与范围。 现有恢复仍创建隔离检查点,配置启用由原所有者办理。

改动思路 / Approach

保留 Python 的文件读取与呈现、TypeScript 的校验与比较决策。 设置界面和 CLI 可以复用同一比较结果与原备份权限。 原生校验之后才按身份比较 Goal,隔离恢复继续用所选摘要。 恢复组件契约

具体改动 / Changes

7 个文件,+248/-3。基线 44b6e2e47df370207580d83fb170711c06634f25。本轮核对新 CLI 入口、既有比较与恢复 owner 及已有设置页面的调用路径。目标基准为 126090271fe5048f761d4bc24bab0499f4f46dc9。 目标基准交付契约

  • BACKUP-FIDELITY。两份输入通过摘要校验后再对齐 Goal id。区分缺字段、null、false、0,并保留数组顺序。快速读取只比较显式提供的快照。 验证与差异
  • BACKUP-ROUNDTRIP。现有导出和校验每次处理一份。新桥接需要独立考虑两个完整输入及报告总量。 Python 桥接
  • SETTINGS-JOURNEY。现有配置面板仍只有下载与单文件预检或恢复。比较成果目前可从 CLI 读回。 CLI compare 入口

对主干的风险 / Risks

28 项 Python 配置备份用例、8 项 TypeScript 用例通过。基线的 4 项导出、校验、恢复和拒绝用例通过。独立对照中约 3.5 MB 的快照对返回唯一布尔差异。两档输入、源配置和恢复作用域均保持原样。Windows、完整容量曲线与真实安装环境仍待验证。

语义与 CI 对齐

当前目标的远端 CI 未查询。修订后应在真实 CLI 覆盖传输上限两侧,并在打包 App 复验无效输入及原恢复路径。

我的整体评价 / Verdict

TypeScript 继续拥有快照校验、值比较和恢复规则。求改范围是完整快照对的传输与现有恢复面板的审阅路径。已有导出、校验和隔离恢复的回归结果可保留。

English verdict: REQUEST_CHANGES on exact head 9a5d290. The comparison rejects a pair of valid native exports at the request-frame limit. The existing Settings recovery journey needs a read-only comparison step.



def compare_configuration_backups(before: dict[str, Any], after: dict[str, Any]) -> dict[str, Any]:
result: dict[str, Any] = effect_runtime_result("configuration.backup", {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[P2] 两份有效导出合并传输后无法比较。两个导出和独立校验都成功,但 compare 以 TypeScript Effect runtime request is oversized 退出 1。相同字段改动的两份约 3.5 MB 快照能返回唯一差异。两份完整输入合计超过默认 8 MiB 帧,比较 owner 未收到请求。 用原有有界私有传输处理两个完整快照,并让导出、校验与比较容量契约一致。完整差异的读回也要有明确边界。

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

已在提交 88a3bc9 修复,并独立复现了原 head 的失败:两份约 4.5 MB 的正常导出分别校验通过,但比较报 request is oversized。

现在比较复用原有有界私有快照传输,保留 8 MiB 帧与 64 MiB 私有传输限制;完整比较结果预检上限为 56 MiB,为响应信封留出空间。没有新增任意路径读取参数,export/verify/restore 原传输行为不变。超限不返回部分差异,读回摘要错误仍报告 ambiguity,不自动重试,临时文件会清理。

实际验证:配置备份与传输 pytest 31 项、TypeScript 9 项通过;正常导出的大快照对仅改布尔值,以及改大字段后约 9 MB 完整差异均通过且输入/源配置字节不变。56 MiB 拒绝分支使用真实 owner 的字节计数边界替身验证,未实际分配超限结果;摘要损坏与聚合输入上限拒绝也已覆盖。类型检查和相关项目自动检查通过,完整限制已写入指南。远端 CI 尚不能宣称全绿。

Comment thread docs/reference/configuration-backup.md Outdated
After review, use the existing `restore` command with the chosen snapshot's
reported digest and a new isolated destination, then inspect its readback.
Comparison does not replace that digest check or the normal configuration
editors. This is an operator CLI workflow; the Settings UI is unchanged.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[P2] 配置备份设置缺少比较入口。现有 UI 及 API 只提供下载和单文件验证/恢复。当前 PR 的新增入口仅在 CLI,无法在该面板完成双文件选取、错误反馈和差异读回。 在已有配置备份面板加入只读两文件比较,复用 TypeScript owner 和既有设置权限,读回散列、范围和差异,保留现有激活边界。

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

已在提交 88a3bc9 将双文件比较接入现有 Settings 配置备份面板,复用同一 TypeScript owner 和原权限。面板显示散列、Goal 范围、完整差异及错误;明确选择 before/after 后进入原恢复预检,再单独确认隔离恢复。更换文件会清除旧恢复候选,切换设置范围后的迟到响应也不会恢复旧状态。比较不写当前配置、不触发激活。

打包 App 的 configuration-backup 浏览器场景已通过:中英文、390px 窄屏无横向溢出、键盘、非法 JSON/错误摘要/503 后重试、迟到比较与预检响应、替换输入、真实隔离检查点精确读回,以及 registry/machine 配置字节不变。配置备份路由使用真实临时后端,其余工作区为合成 fixture;未验证安装版原生 App 或生产数据。真实 HTTP 回归、打包构建、CSS、类型检查及项目自动检查通过。

PR 正文和操作指南已加入同一合成示例截图。预检保留图片的 visual_evidence 人工复核标记,未将二进制图片称为自动隐私扫描通过。历史 mypy 的精确基线/预合并和修复后源码在相同本地依赖下均为 3959 项,归一化诊断无新增;CI 完整依赖快照无法取得,因此不宣称远端 CI 已绿。

…review

Signed-off-by: Yuchao Wang <stevenkid404@gmail.com>
@steven-kid
steven-kid requested a review from maxliux5 as a code owner November 27, 2026 10:11

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh

Exact head: 88a3bc9964522a589f178afded2f3d8aa0560966

[P2] 窄屏恢复预检会裁掉用于核对快照的摘要

在打包 App 的 390 像素视口,比较两份有效快照后,面板右沿为 376 像素。选择「核对比较后快照以恢复」后,新增的整段 SHA-256 把面板右沿推到约 507 像素,摘要延伸到 491 像素;父容器裁掉了超出视口的部分。页面根节点的 scrollWidth 仍为 390,现有测试在预检前就退出窄屏,因而漏掉了这一状态。我只在本地浏览器给摘要元素加换行样式,面板即回到 376 像素,摘要也落在可见范围内。请让预检摘要在容器内断行,或者提供能核对完整摘要的等效布局。回归应保持 390 像素直到预检完成,并断言摘要和恢复操作位于可视内容宽度内。 预检摘要 · 现有窄屏回归

动机 / Motivation

操作员在升级或修改设置前后导出两份备份,需要选定正确的恢复快照。旧入口只能分别校验;新提交先显示差异再预检,但在窄屏上无法完整查看用于核对所选快照的摘要。预期是在 CLI 和打包设置页核验两份备份的内容,并读回所选快照的隔离检查点。本轮未验证已安装原生 App、实际启用、平台矩阵或托管 CI。 基线恢复契约 §Configuration

改动思路 / Approach

CLI 和设置页复用 TypeScript 的摘要验证和差异计算。超过普通帧的快照对交给既有私有传输,比较保持只读,隔离恢复仍需单独确认。390 像素视口进入恢复预检后,新增摘要撑宽外层面板。让预检摘要在可用空间换行,并用实际预检后的面板边界验收。复杂的多 owner 恢复与启用属于后续阶段。 打包交付约束

具体改动 / Changes

目标基线为 126090271fe5048f761d4bc24bab0499f4f46dc9。模拟合并到该基线后的实际差异为 19 个文件,+725/-15,主线的 material frontier 重构和测试均保留。从现有导出得到的两份约 4.5 MB 快照可以完整比较,约 9 MB 的报告读回也通过。原设置面板已接入双文件比较,显示范围及具体数值。

  • 配置 owner 验证两份输入及输出大小,CLI 通过既有有界传输读回。 比较 owner
  • Settings 使用真实 HTTP owner。损坏摘要拒绝,更换文件清除旧预检。选择后快照得到同一摘要,再执行明确的隔离恢复,读回文件与选定备份一致。 设置入口

对主干的风险 / Risks

固定提交的 32 项 Python 与 9 项 TypeScript 用例通过,打包构建与 Ruff 通过。独立打包 App 通过真实本地服务完成坏摘要拒绝、修正后重试、预检与显式检查点恢复。源 registry、设备配置和两个备份文件在读回后保持相同。窄屏上确认摘要右侧裁切。文档截图是合成样例,仅含 PNG 像素相关区块。未运行托管 CI。

我的整体评价 / Verdict

上一轮的私有传输和缺少比较入口均已修复。窄屏预检会裁掉恢复前需要核对的摘要。保留完整摘要,补齐预检状态的窄屏断言后即可复核该点。未覆盖其他平台和长报告的全部显示边界。

English verdict: REQUEST_CHANGES. The bounded transport and Settings comparison work. At 390 px, the recovery preview clips the reviewed snapshot digest and its settings panel.

Signed-off-by: Yuchao Wang <stevenkid404@gmail.com>

Copy link
Copy Markdown
Collaborator Author

针对评审 6086725451,已在提交 9ae1f11 修复窄屏预检摘要裁切:仅给现有预检摘要增加局部换行和宽度约束,未改变恢复权限、旧状态失效或显式确认边界。

在 390px 打包 App 独立复现:旧版面板右沿到 476.81px,摘要被裁切。修复后 after、before、最终 selected-after 的面板均为 14–361px,恢复按钮为 30–345px,完整摘要字符为 30–339.61px。回归保持 390px 穿过比较、选择、预检及显式隔离恢复,逐字检查完整 SHA-256 与字符几何范围,并核对隔离检查点精确内容和源配置不变;不再只依赖 root scrollWidth。打包 configuration-backup 场景、build:chat、CSS 与 diff 检查通过。PR 正文及指南已加入合成窄屏预检截图;预检保留二进制图片人工复核标记,不称自动隐私检查通过。未验证安装版原生 App 或生产配置。

另将 CI 问题保持独立:Package Smoke 的精确 base 0694101 和 preview 669173d,在同版依赖及原安装模式下各运行一次,均在测试注入未登记文件后复现 doctor 返回 1、helper 期待 0 的相同失败;正常安装检查先行通过。未修改完整性检查或测试预期,未混改共享 chat-recovery/mypy,也不宣称 CI 全绿。

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh

Exact head: 9ae1f11f8c47e54b1cdc7f8e5fb64e0664e3aec4

动机 / Motivation

在选择隔离恢复检查点前,操作员需要比较两份已核验的设置快照,并确认选中的完整 SHA-256。上一提交在 390 px 裁掉了预检摘要。当前提交在两份快照的预检期间均保留完整值和可点击的恢复按钮,关闭原 P2。本次验证覆盖打包设置页与隔离恢复。原生 App 和更多平台的采用证据仍待独立验收。 上轮复评

改动思路 / Approach

CLI 和设置页继续复用 TypeScript 的完整性校验、差异计算以及已有的有界私有传输。按既有恢复契约 §Configuration,确认新比较操作只读,选择快照只预检,显式恢复才写隔离检查点。摘要换行属于原预检的展示责任,修复没有引入新权限、持久状态或额外的恢复入口。 既有恢复契约

具体改动 / Changes

对固定基线 126090271fe5048f761d4bc24bab0499f4f46dc9 模拟合并干净,净增量涉及 20 个文件,+764/-15。配置 owner 验证两份快照,按 Goal 身份匹配并保留缺失、null、false、零值与数组顺序。Python CLI 和 HTTP 适配层交给原 owner 处理大输入和完整结果,约 4.5 MB 的双输入及约 9 MB 的响应由真实 CLI 回归覆盖。 比较 owner 对照用例

相较 88a3bc9964522a589f178afded2f3d8aa0560966,五文件增量将选择摘要置于独立 code 块,长摘要在可用宽度内折行。浏览器回归保持 390 px 直到比较、前后预检、重新选择和隔离恢复完成,并实际测量字符和控制边界。使用说明配有合成窄屏图。 预检组件 布局 浏览器回归

对主干的风险 / Risks

390 px 的两份预检均逐字核对 SHA-256,面板在 14 至 376 px、摘要在 30 至 354 px、恢复按钮在 30 至 360 px。 在本地打包 App 上复验,坏摘要被真实 HTTP 拒绝,比较未创建检查点,替换文件清除已选预检。随后显式恢复并读回完全相同的快照,原 registry、设备配置和源备份字节一致。独立复跑 32 项 Python 与 9 项 TypeScript,Ruff、Chat bundle 构建及差异空白检查均通过。

两张文档截图只有 PNG 结构和像素区块,画面为合成快照。保留二进制视觉人工复核。已安装原生 App、Windows、其他视口和极限报告的界面表现尚未独立验证。

我的整体评价 / Verdict

同意当前提交。从配对浏览器记录看,上版在预检时把面板右沿推到约 507 px;新提交两份预检均回到 376 px,全部 73 个字符及恢复按钮都在 390 px 内。原大输入比较、错误拒绝及隔离恢复边界均获得独立验证。390 px 的预检直接显示完整摘要,无额外展开操作。已安装原生 App、Windows、其他视口和极限报告的界面表现尚未独立验证。批准绑定此提交,合并仍走原门禁。

English verdict: APPROVE at 9ae1f11f8c47e54b1cdc7f8e5fb64e0664e3aec4. Both digests and the restore action fit the 390 px preview. The packaged comparison, rejection and explicit isolated restore passed.

@huangruiteng
huangruiteng merged commit 20a700a into loopx-project:main Nov 27, 2026
41 of 49 checks passed
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.

3 participants