Repository navigation
fix(todos): preserve storage compatibility on ordinary updates - #8902
Conversation
Preserve the verified declaration of an existing Todo snapshot while every record still uses fields it declares. Widen only when a mutation needs newer fields, so ordinary writes retain the earlier reader path. Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent; model=gpt-6.1-sol; provider=OpenAI; declaration=runtime_reported; effort=max.
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
[P3] 测试中的 material_change_scope_generations 使用了对象,生产 Monitor 写入的是编码字符串。 这条测试经过通用投影时能通过,Monitor 的字段解析器会拒绝该对象。建议用固定的合法字符串覆盖同一断言。独立复验已在 File 和 SQLite 的安装包上用真实格式写入和重放。 测试夹具 · 字段解析
动机 / Motivation
在 File 或 SQLite 保存了未完成 Todo 的用户,升级后可能需要切回 2.3.0 并用原租约继续操作。 旧候选更新一条普通备注后会把字段声明从 68 项扩到 70 项,冷启动的 2.3.0 随后拒绝读取 Todo 和租约。 修复版保留原字段声明并重算记录摘要。切回 2.3.0 后能读回同一 Todo、租约和原回执,再提交一次更新并重放。 本次核对普通 Todo 写入和首次使用新 Monitor 字段的兼容边界,整版 2.4.0 的平台与发布渠道独立验收。
改动思路 / Approach
统一 reducer 已握有校验过的旧字段声明和本次变更后的完整记录,可在原事务内作兼容决定。 普通写入沿用可读的旧声明。实际写入新字段时使用当前声明,清除字段后继续保留该版本。 记录摘要继续覆盖本次写入后的完整列表。原租约、操作回执与 CAS 决定仍由原权威存储核验。
具体改动 / Changes
依据 docs/reference/local-authority-provider-selection.md,固定于 c52624225411d1e91ec0b06f4cd9d84596eed39b。已核验 Normal writer cutoff and deletion 规定的 canonical mutation 入口,以及 Original-operation recovery 规定的原操作回执、重放和当前状态。 规范
validateIndexedTodoReadModel校验原 Goal、字段顺序、完整记录和摘要,返回与历史声明匹配的结果。 验证入口reduceCoordinationProjection生成本次完整记录的摘要,并在兼容时恢复经校验的原字段列表。真实 scoped Monitor 写入会追加现有的两个字段。 共享 reducer
对主干的风险 / Risks
| 实际操作 | 未修复候选 | 本次提交 |
|---|---|---|
| 2.3.0 创建并持有 lease → 2.4 普通写入 → 2.3.0 冷启动 | File/SQLite 都是 68→70,拒读 Todo 和租约 | 两库都是 68→68,原 Todo、租约和回执可读 |
| 回退后续写与重放 | 原租约读路被阻断 | 续写提交一次,重放保持同一修订 |
| 首次写入 scoped Monitor | 需要当前声明 | 两库都是 68→70,生成一次,2.3.0 拒读时给出类型化错误 |
候选普通写入的原操作重放和过期修订拒绝均未重复写。基线 wheel 的权威代码与目标提交一致,候选所载 1,881 个 Python/TS/JSON/JS 源文件与 Git 源码逐一相同。现有 TypeScript 用例 20 项及 typecheck 通过,真实 PostgreSQL 16.16 的 398 项存储、11 项服务验证通过。标准 premerge 4 项直接、10 项选中检查通过,严格范围回执有效。
我的整体评价 / Verdict
当前提交的兼容修复可批准。普通待办写入经过回退后仍能继续原任务,第一次使用新字段的写入也保留新格式的拒读边界。改动限定在共享存储投影和测试,可见任务通过已安装 CLI 的读取与写回验收。 最终发行包、平台采用和发布渠道由 2.4.0 发行验收继续覆盖。
English verdict: APPROVE at b54173d. The installed File and SQLite rollback preserves the original Todo, lease and receipt after a compatible edit, while actual scoped fields correctly retain the newer declaration.
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
…e-rollback-compatibility-20261117 Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent; model=gpt-6.1-sol; provider=OpenAI; declaration=runtime_reported; effort=max.
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
动机 / Motivation
用户升级后只改一条 Todo 备注,仍需要在切回 2.3.0 时读回原任务、租约和回执。 基线的普通写入把存储字段从 68 扩到 70,File 和 SQLite 上的 2.3.0 冷启动均拒绝读取 Todo 和租约。 本提交的普通写入保留 68 字段。切回 2.3.0 后能续写原 Todo,重试只读回同一次提交。 真正使用新增 scoped Monitor 字段的记录仍需要 70 字段,配对备份和整版发布渠道由各自验收覆盖。
改动思路 / Approach
复用共享 reducer 中已经校验的历史字段清单,在本次记录中检查是否真正用到新字段,并用同一组记录重算摘要。 普通写入保留兼容声明,实际写入新字段后使用新声明,清除字段也不会隐式降级。 保留原 provider、操作 ID 和租约的验证。通过已安装旧版和本次候选包观察到同一任务继续写入一次,回执重读一致。
具体改动 / Changes
按基线的 Normal writer cutoff and deletion 和 Original-operation recovery 核对 canonical mutation、原租约与操作重放。 权威存储规范
validateIndexedTodoReadModel返回已校验的历史字段声明。reduceCoordinationProjection用现有数据和变更后的完整记录重算摘要,兼容时沿用历史声明。 字段与记录校验 · 共享写入逻辑- 相对上一份评审,生产代码相同。原 P3 的测试已改用真实
scope digest:generation:result digest字符串。当前测试分别执行两种 read model 的兼容备注更新、首次使用新字段和清除字段三条路径。解析器接受新 fixture 的 scope digest 与 generation,拒绝先前的对象类型。 已修测试 · Monitor 字段解析 · 上一份评审
对主干的风险 / Risks
| 验证 | 结果 |
|---|---|
| 已发布 2.3.0 → 候选更新备注 → 2.3.0 冷启动 | File 和 SQLite 上,基线从 68 增至 70 并拒读,候选保持 68。原 Todo、租约和回执可读,沿原租约续写一次。 |
| 实际 scoped Monitor 写入 | 两种后端都扩大到 70 字段,generation 为 1。重放保留同一 revision,2.3.0 返回预期拒读。 |
| 复核对应 TypeScript 测试 | 当前提交 20 项通过。同一组测试在当前基线有 4 项按预期失败。typecheck、4 项直接和 10 项选中 premerge 检查通过,当前范围回执有效。 |
上一轮实库 PostgreSQL 16.16 的 398 项存储测试和 11 项服务测试可用于这次复评。核对过生产、打包和依赖输入相同;本轮重新构建了当前 wheel,并重跑 File、SQLite 和受影响的两种投影测试。第一个实际使用新字段的写入仍需要兼容它的版本。
我的整体评价 / Verdict
批准当前提交。原评审指出的测试输入已修正,普通写入和首次使用新字段的行为通过了实际安装包对照。仍需在 2.4.0 发行验收中核对配对备份、整版平台和正式渠道。
English verdict: APPROVE at 7b69f77. The fixture now uses valid persisted Monitor encoding, and the exact wheel preserves ordinary rollback on File and SQLite while correctly widening for genuine scoped fields.
Goal And Delivered Outcome
2.3 已有的 File 和 SQLite 目标,在候选版只改一条待办备注后,存储声明也从 68 个字段变成了 70 个。冷启动的 2.3 于是拒绝读取待办和任务租约。普通更新现在保留已验证的原字段清单,并按更新后的内容重算摘要。第一次提交需要新字段的数据时,仍会采用当前字段清单。
2.3 → 2.4 → 2.3regression on both local authority providers.mainatc52624225411d1e91ec0b06f4cd9d84596eed39b.Author Declaration
reduceCoordinationProjectionScope And Continuation
The fix covers mutations whose existing and resulting records fit an accepted released declaration. A state that declares newer fields still needs a compatible package. Rolling back such a state to 2.3 uses a matching pre-upgrade backup and preserves post-upgrade work separately.
Validation
7b69f7705731d689e61445cd740e6b8e9e56e077.regression_paritypassedreal_entrypointpassedintegrationpassedreal_backendpassedstaticpassedCurrent revision also passed the 20 projection tests, TypeScript typecheck and premerge against main
42483ac371d9d7dff9a07e392f1231f8ea6ace93. The installed File/SQLite comparison was independently repeated for this exact wheel in review 5932534942.Frontend / Visual Evidence
Type of Change
LoopX Area
Shared-authority RFC fixture impact
The existing frozen releases and real File, SQLite and PostgreSQL providers exercise the writer. Provider selection and the stored schema identifiers remain the same.
Boundary Checklist