Repository navigation
test(chat): isolate report fixtures from inherited source bootstrap - #7738
Conversation
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
songoow
left a comment
There was a problem hiding this comment.
Reviewer: model_agent — GPT-6 Astra Pro — OpenAI — self_reported
动机 / Motivation
维护 Chat report 恢复回归的开发者与 CI,需要 fixture 中的“子进程没有安装 LoopX”条件与真正执行的 validator 一致。
基线用 python -I 探测缺安装,但实际普通 child 会继承源码 PYTHONPATH,导致应当 validation_failed 的原始失败变为 validated_completion。本 PR 在现有 monkeypatch 作用域清除该变量,并用同一普通解释器模式探测。
在继承源码 PYTHONPATH 的环境中,base 的两个 File/SQLite 原报告恢复案例实际失败;head 的三个既有 family 共24例通过,继续保留原始失败、冻结报告恢复、授权和一次性效果断言。
这是现有测试 fixture 与开发文档修复,生产代码、依赖和用户流程没有变更;不能把测试通过称为产品新能力、完整 C1交付或真实模型资格。当前 Windows CI 失败尚缺要求的归因,因此暂不批准。
改动思路 / Approach
修复的是负例前提不真实:独立模式 -I 会忽略 PYTHONPATH,而实际历史 validator 用普通解释器。两个进程的导入环境不同,使“子进程没有 LoopX”的探测成立、实际命令却成功。保留同一个临时 venv,在既有 monkeypatch 作用域中去掉继承源码路径,并让探测也用普通模式,才真正测试原来的缺安装失败。
这里没有新增 smoke 或另一份报告恢复流程。原 fixture 仍服务三个已有 family;原 validator、冻结报告、授权、journal 与一次性效果断言都保留。对相邻 --without-pip/PYTHONPATH fixtures 的检索显示 stdio SDK、账户/bootstrap 场景有不同职责,不应为了共享两行清理代码再引入全局环境 manager。对本批同作者 PR 的有界扫描也未发现本项属于重复同形 smoke;没有升级贡献限制的依据。
具体改动 / Changes
关键代码讲解
-
embedded_report_python:在创建未安装 LoopX 的 venv 前,以 monkeypatch.delenv 清除 PYTHONPATH;probe 去掉 -I,和真正 validator 的普通解释器模式一致。清理随原 test/monkeypatch scope 恢复,不改生产 bootstrap。
-
test_original_frozen_report_recovers_validation_without_repeating_model_or_business:这个已有 consumer 继续执行真实历史失败命令,要求 validation_failed、保留原 journal,再验证恢复时不重复模型/business调用,pause/tamper保持拒绝,最终 publication/settlement一次性。补丁没有把这些断言改成接受成功或跳过。
独立规范基准:docs/development/testing-and-quality.md,修订 186582b 的 Local Validation Environment,以及改动前 fixture 本身的“真实 child 无 LoopX bootstrap”合同;以下标签定位原要求,不虚构新 RFC 编号。
| Criterion | 当前结论 | 实现/证据 |
|---|---|---|
| Local Validation Environment | implemented | probe 和实际 ordinary child 的解释器/环境一致;源 PYTHONPATH 注入反事实 |
| Existing missing-install fixture contract | implemented | 保留真实失败、冻结恢复、授权与一次性效果,三个原有 family 共24例 |
实际验证 / Validation
本轮 root reviewer 在 exact head 以 PYTHONPATH=$PWD 运行三个 family:embedded_host_validates_report、original_frozen_report_recovers_validation、partial_read_coverage_is_not,共 24 passed,124 deselected(179.75秒)。我独立核对源代码与原始日志,并补跑 changed-file Ruff、git diff --check,均通过。作者声明的另一组无注入测试/48例及完整 premerge 没有计成本轮执行。
不可变 base186582 的同一源注入环境中,原报告恢复 [None-file] 与 [None-sqlite] 两个实际案例都得到 validated_completion,而原断言需要 validation_failed,因而2例失败。head 的对应案例在上述24例中通过。这是旧fixture缺陷的真实反事实,不是伪造journal或接受两种结果;也没有改任何生产验证/结算逻辑。
对主干的风险 / Risks
只有测试 fixture 与双语开发说明变化,生产代码和依赖没有 diff。最大的潜在风险是清理环境太宽,或让真实负例被替换成 mock/skip;这里利用已有 monkeypatch 生命周期,普通 child 仍实际运行,三类原有失败、暂停/篡改、范围变化和恢复断言仍在。未发现阻断性 fixture 或代码缺陷;修复的直接价值是减少环境诱发的假失败并保持恢复回归可信,而非给产品新增能力。
当前验证缺口
当前 Windows job123965632006 的 test_locator_publication_failure_surfaces_safe_typed_startup_diagnostic[live_lock-False-mutation_lock_timeout] 失败:实际 runtime_startup_timeout,不是期望的 mutation_lock_timeout;该段汇总 1 failed、418 passed、20 skipped。已经定位日志,但没有本轮同命令 immutable base/head 的同签名归因。不能仅因补丁是 tests/docs 或文件不相邻就把它降级为历史噪声。
按当前 verdict_policy,未归因的 current failure 阻止批准。最小动作是补对应基线/候选归因,或独立确定外部/环境原因并取得当前受影响合同资格;若证明代码回归,再修相关代码。这里不要求为未知原因改无关代码,也不允许改断言或放宽时限把失败变绿。
我的整体评价 / Verdict
REQUEST_CHANGES:未发现阻断性代码 finding,现有 fixture 修复有实际价值;当前 required CI 失败尚缺政策要求的归因。 审查绑定 exact head 107c41f。
长期报告恢复、原始授权和一次性效果的产品行为保持,改动让这些已有保护在源码环境注入下仍可验证。用户可见流程没有变更,视觉审查不适用;可维护性的改善来自修好共享 fixture,而不是增加新测试数量。
本轮使用合成报告、真实 local File/SQLite 与实际 child interpreter,模型/消息 transport 仍为既有受控 fixture。它不证明 live model采用、真实外部发送或完整 C1/#7430成果/成本资格;也没有拿这项有界修复的通过掩盖当前 Windows 失败。
English verdict: REQUEST_CHANGES — exact head 107c41f; the existing-fixture repair is supported and no blocking code defect was found, but current required Windows failure attribution is missing.
Goal and delivered outcome
The report recovery fixture models a child interpreter without LoopX. An inherited source-checkout
PYTHONPATHlet the ordinary legacy validator import LoopX even though the fixture'spython -Iprobe could not. The test then observed successful completion where its intended missing-install failure was required.Clear that variable within the existing fixture's monkeypatch scope and probe imports in the same ordinary interpreter mode. Retain the original validation, frozen-report recovery, authorization and once-only settlement assertions. Add matching English/Chinese environment guidance.
Author declaration
Written by: model_agent — OpenAI Codex (GPT-6 family).
Implemented against the existing
embedded_report_pythonmissing-install contract and local validation environment guidance at the base revision.Scope and continuation
Complete within this fixture/docs scope. This independently reviewable repair supports C1 integration #7430, whose contract cutover and outcome/cost qualification remain open. Production behavior and dependencies have no diff in this proposal.
Validation
Tested head:
107c41f5d4569cc3ad4c1bee33a9cb9251a24af4; immutable base:186582b30c306559398a653e964a33bd6e43f135. Run state:finished; input class:synthetic.PYTHONPATH; both original failed observations are retained. Head passes those cases in both environments.tests/test_native_steward_reports.py: 24 cases without source injection and 24 with it, 48 passed. Covers the missing installation, native recovery, pause/tamper, partial coverage, registry changes and once-only result/settlement.Validation covers the changed fixture and its real local File/SQLite report consumers. The complete repository test suite and hosted CI are outside this local result; no live model experiment was used.
UI impact:
none(test fixture and development guidance only). Shared-authority fixture impact: N/A; no runtime/provider contract change.