Repository navigation
test(windows): qualify native CLI output differentials - #6816
Conversation
Signed-off-by: BigDataDZ <76271875+BigDataDZ@users.noreply.github.com>
Signed-off-by: BigDataDZ <76271875+BigDataDZ@users.noreply.github.com>
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · gpt-6.1-sol · OpenAI · runtime_reported · reasoning_effort=max
动机
维护 CLI 输出回归门的开发者,需要让历史基线和候选版本在相同、可清理的测试目录中得到可比较结果。
旧夹具在 Windows 上依赖当前盘符根目录已有 tmp,可能在生成回执前失败;现在用宿主临时目录中的自有根目录,并让历史 probe 和嵌套场景共用同一实现。
独立执行真实 source differential 得到 base/head 各 96 项且测量与语义回执完全相同;目录碰撞、失败清理和错误解码反例也已核对。
原生 Windows 的作者测量尚未在本机独立重跑;完整 hosted CI 与安装态资格仍由既有原生验证通道负责。
本 PR 不改变生产提示正文、调度、权限或用户操作入口;本机模型和 POSIX 结果不证明原生 Windows、任意长路径、完整 CI 或产品延迟已验收。
改动思路
将物理 fixture 生命周期放进一个现有测试边界内的共享 helper,并同时供当前与历史 probe 使用;预算仍由既有 typed qualification owner 管理,不新增生产状态或决策源。
当前切片交付 source qualification 的目录、诊断及预算修复;真实 Windows 主机与完整 hosted qualification 保留为独立验收。
只改外层临时目录仍不够:历史测试模块中的嵌套场景还会调用旧的 root factory,隐式机器 runtime 也必须与两边的物理 root 一致。因此当前 differential 把同一 fixture helper 复制到临时运行环境,并在生成所有行前替换历史模块的那个局部 callback。新 helper 拒绝已有目录和 symlink,成功创建后才取得清理责任;失败和成功都清理自己的根目录。POSIX 的原目录拼写保留,Windows 分支使用宿主临时目录,不创建或修改盘符根目录。
字符上限属于源验证的回归预算。改短完整路由或删除决策义务来贴旧上限会损害被测对象;此处没有改生产正文,而是在既有 typed owner 中记录有限增量,并保留行数、语义、增长与其他模式的限制。增量有维护和检测灵敏度成本,需要与下述实际测量和平台边界一起理解。
具体改动
完整范围九个文件、+192/-36:共享 fixture helper;当前/历史 probe 接线;两层 subprocess 的 UTF-8 诊断和外层 timeout;少量既有字符常量;目录/诊断测试;现有 Windows workflow 的两个步骤;以及同一份接口合同的英文、中文说明。生产目录中唯一变化是 loopx/control_plane/testing/cli_output_budget.py,它的消费者是资格化工具,生产 CLI、提示正文和决策 owner 没有变更。
关键代码讲解
stable_budget_fixture_root以显式存在/symlink 检查和独占 mkdir 获取 fixture,finally清理已取得的目录。budget_fixture_path只按实际 OS 选择物理测试根,不增加持久状态或第二套 authority。_run_probe把两个源码版本的隐式 runtime 指向同一物理根;实际 child 仍使用指定 source-root,base 只关闭历史绝对尺寸断言,语义契约仍检查。- probe
main在当前和历史 callback 中共用复制的 helper,继续生成全部 default、variant、blocking-gate 和 multi-subagent 行,没有缩小样本或跳过旧场景。 CLI_OUTPUT_BUDGET_SPECS与现有 mode 表只调整指定字符上限。行数、per-Todo growth、语义 key、action-signature 与其他模式的预算保持原值。- wrapper
main用显式 UTF-8 解码保留失败诊断,外层600秒覆盖两个各240秒的 probe 和 checkout/cleanup;这不是产品延迟改善,子进程失败仍导致失败。
规范依据为改动前的 docs/reference/contracts/interface-budget-contract.md,spec_revision=a0fb547af9aac4e4d36f59fb05cb64eb56fd750f,并对照该版本 testing-and-quality 的 budget-failure decision guide 和 issue #6809。matched_public_fixture 已实现:实际不可变 base/head 各96行,保存的完整测量/语义回执相同;retain_semantic_guards 已实现,原 semantic-removal/growth 负例保留;complete_routes_and_cost 已实现,未删生产指令,指标分别报告。native_host_boundary 仍 deferred:作者的 Windows 数值不能冒充本机重跑,原生步骤承担后续平台验收。
下表的 Windows 字符数来自作者当前提交中的配对记录,未由本机独立复现;我独立的 POSIX96行测量在 base/head 完全相同(guided Markdown为3189/3190/3189,thin为5585,compact JSON/Markdown为12397/11046)。这些是字符与语义回执,不是原始含时钟 stdout 的逐字节相等声明。
| qualification surface | 旧→新字符上限 | 作者记录的嵌套 Windows 字符数 |
|---|---|---|
| guided Markdown,三个规模 | 3200→3400 | 3245/3246/3245 |
| thin Markdown,三个规模 | 5800→6200 | 5989 |
| compact JSON / Markdown | 13500/11750→14000/12200 | 13685/11854 |
对主干的风险
独立实际 differential 使用不可变 a0fb547af9aac4e4d36f59fb05cb64eb56fd750f,不是测量后移动的 main;96 base/96 candidate、candidate-only=0、review_required=0,完整 typed 回执相同。只观察并复制真实回执,没有向 checker 注入成功结果。原生 canary wrapper 也通过,且原较长路径、完整字段和增长断言仍执行。
目录反例把缺少盘符 tmp 的条件明确建模:旧 factory 在 yield 前 FileNotFoundError,head 的本机文件系统模型可创建并清理自有 native-temp 根。已有目录的 marker、broken symlink 均保留;抛异常后清理通过;POSIX 路径与旧公式相同。这些不是原生 Windows kernel 结果。诊断反例实际启动写出“恢复 🚀”并 exit1 的 child,在 cp1252 隐式解码模型下,base 先抛 UnicodeDecodeError 而丢失诊断,head 仍以可读 AssertionError 返回原失败信息。
完整受影响 pytest 是185 passed、1 failed:原 scheduler alias 的完整 payload 比较在两次调用跨秒时失败,没有将其删掉或写成全绿。独立共同探针对两种 alias 在 base/head 各跑 real-gap、fixed-clock-gap、wrong-selector 三种情况:真实间隔都在相同四个时间观察字段失败;同一观察时刻都完整相等;错误 selector 仍都失败。两个原测试和比较函数的 AST 未改,生产时钟路径也未改,归为 pre_existing_unrelated;已合入的 #6814 单独修这个测试时刻,不把该修复冒领为当前 head。
changed-file Ruff exit0,diff-scoped advisory 无支持的新词汇载体,范围限制保留。标准 premerge 的6项 direct 与12项 selected 执行均过;整个命令仍 exit1,因为 quality_stale_receipt,独立合并门尚未通过。未查询、触发或等待远端 CI,未用本机模型资格替代完整 native-host 结论。
语义与 CI 对齐
复用现有 OutputFormat、QualificationPolicy 和 budget dataclass;没有新通用状态词汇或 Python 决策权威。数值上限和 timeout 是实际测试强制条件,文档中的显式660秒命令是可选验证用法,均不授予业务额度或执行许可。历史失败、旧测量、原 semantic/growth 规则保持可区分;新增 Windows 两步分别执行边界测试和完整 differential,没有裁掉故障案例。
我的整体评价
APPROVE,绑定 98b5e7aea458981ba7694bfe073a7dfe593c61c8,结论是一个有用且有界的 source qualification 增量。long_horizon=preserved:既有运行时指令、结算和后续工作没有变化;user_experience=improved 指维护者现在能区分 fixture/locale 错误与真正输出回归,未宣称节省了模型、CI 或人工总成本。相关 refactor 已应用到同一个 fixture 生命周期;保留历史 callback 的局部适配有真实消费者,进一步迁移或框架化没有必要。原生 Windows 独立读回、完整 CI、现有 clock 测试修复的集成以及 change-quality 合并门继续分别跟踪;不据此称整体平台、产品效率或安装态验收完成。
English verdict: APPROVE — 98b5e7a. The source qualification slice is coherent: a pinned real96/96-row differential has identical typed receipts, owned-root/decoder counterfactuals distinguish the repaired paths, and185 tests pass with1 independently reproduced pre-existing clock-parity failure retained. Native execution checks pass; the stale quality-receipt merge hold and unverified native Windows/hosted qualification remain separate. No production instruction or authority change is claimed.
CI follow-through: #6817 proposes fixes for the three independently reproduced main-baseline test failures (Ruff import, canonical digest consumer registration, and explicit-empty receipt-guard expectation). This proposal's head is unchanged; full hosted CI remains a separate qualification.
Fixes #6809.
Native Windows CLI output qualification could pass from a checkout drive that happened to contain
/tmp, then fail in the real differential child on the native temporary drive. Both historical and candidate probes now use the current owned physical-root helper, including nested scenario callbacks and isolated machine runtime paths. POSIX retains its existing root spelling; existing directories are refused and owned fixtures are cleaned on failure.The real Windows path also exposed existing emitted-output ceilings. Matched base/candidate measurements preserve complete executable routes and decision instructions:
The table uses the full nested native canary layout; the direct native-root guided-start pair measures 3,203 / 3,204 / 3,203. All line, body, semantic and differential growth limits remain intact. The existing Python qualification owner is retained; no production prompt, runtime authority or user entrypoint changes. The English/Chinese reference contract records these measurements and distinguishes historical ceilings from current ones.
Probe readers preserve UTF-8 failure diagnostics. The validation wrapper allows both existing 240-second child probes plus checkout/cleanup; this is a driver timeout correction, not a product latency claim. Native Windows CI now exercises the fixture boundaries and the complete differential. The related refactor consolidates physical fixture ownership rather than adding another production decision owner.
Validation against main
a0fb547af9aac4e4d36f59fb05cb64eb56fd750f:The two existing full-envelope alias parity cases are timing-sensitive on this base and are excluded from the focused pytest run; #6814 owns that repair. This PR keeps the original full differential canary intact. Hosted Windows/Linux CI remains a separate qualification. The baseline already fails kernel static checks and TypeScript shard 1; those failures are outside this repair. Proposed for maintainer review and merge.