Skip to content

test(projects): preserve UTF-8 state in registration replays - #7453

Merged
loopx-agent merged 1 commit into
mainfrom
codex/registration-utf8-replay-20261027
Oct 27, 2026
Merged

loopx-agent merged 1 commit into
mainfrom
codex/registration-utf8-replay-20261027

Conversation

@BigDataDZ

Copy link
Copy Markdown
Contributor

On native Windows with PYTHONUTF8=0, the repeated-registration regression decodes the UTF-8 Goal state with the GBK locale and fails before it can verify replay preservation. Its later writes also use the locale, so non-ASCII owner narrative cannot be safely tested.

Keep all state IO in that existing replay test explicitly UTF-8, and extend its existing current/historical writer matrix with Chinese, an accented character and an emoji. The existing byte-preservation, equivalent-header, later narrative, paused status and acceptance-drift assertions remain. No production registration or decoding rule changes.

Validation at signed head 2f422f98f, based on main 218aa087b:

  • Original matrix: 1 failed / 7 passed on native Windows / CPython 3.12.10 with UTF-8 mode disabled; the historical Unicode-separator fixture fails in the test's locale read.
  • Updated matrix: 10 passed / 65 deselected under the same native mode, through the real CLI and canonical storage.
  • Full module: 73 passed / 2 failed. The strict-registry rebinding assertion still expects a different error message (also seen on the previous unchanged main). A distinct-registry concurrency case hit an owning-lock timeout in this full run; its cause is not established and no fix is claimed. These results are preserved, not counted as passing.
  • Changed-file Ruff and diff hygiene pass. Only one existing test file changed; no private paths, raw logs, new state vocabulary, product UI or API changes.

Author declaration: authored with OpenAI Codex under contributor direction. The related future-facing pass keeps UTF-8 ownership local to this existing replay test rather than adding a new fixture or changing global Python behavior. No model/benchmark job, active Goal mutation, system upgrade or self-merge. Independent review and current-head CI remain pending; maintainer merge required.

Signed-off-by: BigDataDZ <76271875+BigDataDZ@users.noreply.github.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.1-sol | OpenAI | runtime_reported | reasoning_effort=max

动机 / Motivation

维护 project register 回归的贡献者会在非 UTF-8 的 Windows 环境下触发这个问题。原测试在重复注册后用本地编码读取已经按 UTF-8 保存的 Goal 文件,可能先解码失败,也可能在后续写入时损坏非 ASCII 正文;改后测试明确按 UTF-8 读写,再验证原状态没有被重复注册覆盖。独立受控 CP936 注入下,基线既有矩阵为 1 失败、7 通过;精确 head 的 10 个当前及历史 writer 场景全部通过,完整注册模块 75 项通过。本 PR 只修复既有回归测试的编码并扩展输入,不修改注册实现、状态格式、权限或界面,也不认证全部原生 Windows 行为。

改动思路 / Approach

这个切片修的是测试自身的文本边界。注册实现本来就按 UTF-8 写状态,测试应使用同一文件契约读取和构造后续呈现,再由原有字节断言判断重放有没有破坏它。把整个测试环境强制成 UTF-8 会失去问题的判别力;删除特殊输入也会减少保护。这里直接修复原函数内五处 I/O,新增一个同时含中文、重音字符和 emoji 的输入,当前/历史 writer、转义等价、暂停状态和验收漂移继续走实际注册入口,没有另起恢复 owner 或测试框架。

具体改动 / Changes

关键代码讲解

  • test_project_register_repeated_identical_request_is_a_noop 在现有参数矩阵加入混合 Unicode。这里的 legacy 是历史展示 writer 形状,并不代表绕过规范存储的旧 authority provider。
  • 同函数后半段 的五个文本读写显式指定 UTF-8;read_bytes 比较、changed is False、storage_selection.status == "replayed" 和 drifted 正文相等断言都保留。测试仍调用 loopx.cli.main,没有以 mock 返回成功替代产品执行。

规范依据为 docs/reference/source-cli-entrypoint.md,固定 spec_revision=bafbafc258de72029b54ea016103c0a7bd2409c9:已接受正文。UTF8-FILE-IO → implemented:文件文本 I/O 固定 UTF-8,由受控 CP936 反例和新矩阵验证;REGISTER-OWNER-PRESERVED → implemented:原注册/持久状态/回执 owner 未改,完整模块和原字节保护断言通过。这是对已有义务的覆盖,不新增语义词汇或产品行为。

对主干的风险 / Risks

未发现阻断问题。独立验证使用 macOS CPython 3.14.8:普通完整模块 PASS,75 passed;只对目标状态文件的隐式 Path.open 注入 CP936,基线 218aa087b66bb99038b1ce7d782110741a5e42ae 在历史 writer 分隔符输入处出现 UnicodeDecodeError(1 failed / 7 passed),head 相同控制条件 PASS,10 passed。这个负对照针对测试编码,不是原生 Windows 仿真;显式 UTF-8 产品 I/O 没有被替换。标准 canary premerge --from-git-diff 的 5 项直接检查通过,选择器没有额外 smoke,未将这个结果当完整产品资格。

作者此前 native Windows 全模块的 strict-registry 诊断和并发锁两项失败仍是历史 UNVERIFIED 范围;本次完整 macOS 绿测不证明它们修好了。此补丁不修改这些诊断或锁的因果路径,也没有放宽相关断言。没有查询、轮询或等待 GitHub CI。还核对了同作者 #7454/#7455:分别处理依赖供给和另一报告生命周期,不是重复注册 smoke;无需合并成一个测试框架或发起贡献限制。

我的整体评价 / Verdict

建议 APPROVE,结论绑定 2f422f98fc5a2c782b3db3795a88ccc4b881503d。这是完整且可回退的测试维护修复:长期工作语义 preserved,覆盖仍经过真实重复注册、状态漂移和持久字节回读;产品体验 not_applicable,没有改变用户操作或呈现。视觉检查 not_applicable:仅测试文件变化,未改变任何渲染页面或可见呈现。未验证视觉范围:none:此 diff 没有视觉变更。没有新增兼容层,继续在原函数维护是当前最小边界;原生 Windows 全面资格、合并决定和安装采用分别保留,不由本批准代替。

English verdict: APPROVE — the existing replay test now preserves its UTF-8 contract without weakening its state-preservation assertions; native Windows qualification remains explicitly separate.

@loopx-agent
loopx-agent merged commit 59c8bbf into main Oct 27, 2026
22 of 34 checks passed
@loopx-agent
loopx-agent deleted the codex/registration-utf8-replay-20261027 branch October 27, 2026 07:25
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.

2 participants