Repository navigation
test(research): qualify local HTTP fixtures with native synthetic providers - #7364
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
动机
在 Windows 上运行研究 HTTP 生命周期验收的贡献者。原 fixture 的长路径与 POSIX 脚本妨碍原生执行;提案复用原生 launcher 和短临时目录,但 setup 在 yield 前失败时,已启动的 Node 无法由现有清理路径找到。本机完整 HTTP 22 项、工作流 549 项和标准 premerge 通过;受控临时目录分支重放独立暴露 setup 失败后的进程清理缺口。不修改研究产品运行时、模型或评分,不把合成 provider、目录删除或本机重放当作原生 Windows 全量资格。需要在首次可能启动 Effect runtime 的 setup 操作前注册同一目录的清理;十个 Windows 来源分析用例继续由现有 #7363 跟踪。
改动思路
复用现有原生 launcher 和鉴权清理 owner,机制放置合适;需补齐 setup 失败时的同目录 finalizer。当前边界为本地 HTTP fixture 与 Windows CI 入口;setup 资源回收应同批修复,来源长路径继续由 #7363 负责。与修改全局 Windows 长路径策略、缩短来源哈希或另造进程生命周期相比,现有 helper 足够,问题在于调用时序。
正向旅程仍经过真实 HTTP、注册来源、持久结果、真实 Node 与合成 provider,包含拒绝、取消、重试、缓存和引用读取。provider 可执行文件身份在 HTTP 前验证;两个修改合成脚本的旧用例重建原 launcher,避免 Windows .exe 与 .py 脱节。
具体改动
关键代码讲解
workspace为 Windows 分配短临时根,在所有主机把进程临时文件放进本 case 的process-tmp。register_pack已在第64行启动真实 Effect runtime,但真正的 stop 到第130行、yield 后的 finally 才执行。- 同文件第73行
write_provider使用既有write_python_host_fixture,保持所选解释器及真实进程边界;stdin、脚本和捕获 prompt 显式使用 UTF-8。缺少预期 executable 时当前 guard 拒绝;在独立私有控制中仅去掉 guard,实际调用了另一个自有合成 fallback,证明 guard 有效;没有调用真实模型。 source_analysis_workspace使用原 fixture 下的真实绝对路径与sys.executable,不删除十个 source case。新增 Windows CI 步骤只选择本地 HTTP 家族,设置PYTHONUTF8=0,未删除原 CI 通道。
规范:testing-and-quality.md,spec_revision 2acb4b519d8efeb938e97b03d630633245c20de3。Pull-Request Baseline implemented;Refactor Real-Path Gate 在 setup 失败回收处 not_met;Evidence Boundary implemented。这些是原规范标题定位符,预期也参照已有 tests/conftest.py::pytest_runtest_teardown 与鉴权清理 owner,不从新实现生成。
对主干的风险
[P2] 在 setup 可能启动 runtime 前注册清理
Windows 分支替换了 fixture 局部 tmp_path,但 item.funcargs['tmp_path'] 仍是 pytest 原目录。第64行已可能启动 Node;若随后 executable 身份检查或服务器 setup 失败,生成器尚未到 yield,第126–130行的 finally 不会运行。已注册的 temporary.cleanup 只删除目录;已有全局 teardown 在原目录搜索,也找不到新 runtime。
我对该分配分支做了受控 POSIX 重放,只转换 Windows 路径前缀,保留真实 register_pack、Node 与鉴权 ping:setup 失败、原 pytest 目录无 locator、替代目录已删后,原 Node 仍返回 ready。探针随后通过原鉴权 owner 停止自己的进程并验证退出。仅在首次注册前增加同目录 stop finalizer 的私有修复对照,使同一失败路径正确退出。这证明代码的清理时序缺口;它不是原生 Windows 文件删除或进程执行资格。
最小修复是在创建/选定进程 namespace 后、首次 register_pack 前注册 stop_disposable_effect_runtimes(tmp_path),让它按 finalizer 顺序先停止 runtime,再删除 TemporaryDirectory,并加入 setup-failure 回归;保留成功、取消和重试覆盖。无需改产品模块或依赖 #7363 才能修复。
其他独立结果:原 main 与 head 完整 HTTP 模块均22项通过;相同八组完整 HTTP 响应仅归一化 started_at_unix、analysis_wall_seconds 后一致,状态、错误正文、引用、缓存和权限都未被归一化。首次辅助对照错误假定另一个 owner 应返回404;实际契约要求拒绝,基线/head 均为409,修正脚本后比较完整正文,原脚本失败保留。工作流549项、必需 Ruff 与标准 premerge 均通过。没有查询或等待 CI。作者的12个 Windows 用例属于作者报告,十个 source case 的原生路径缺口继续公开保留在 #7363。
我的整体评价
REQUEST_CHANGES,精确 head af75cf56455f4f5438ed98b0463cfeed94b89207。整体改动比例合理,launcher、UTF-8 与现有 owner 复用有明确价值;缺口是新增目录在 setup 失败时失去回收归属。long_horizon=regression 仅指测试资源回收,未发现产品调度或权限变化。产品完整 HTTP 观测在所测 POSIX 输入下保留,修复候选只需提前注册既有 finalizer。
仅测试 fixture 与 CI 改动,产品页面及配置入口未变化;本轮不需要新增视觉证据。原生 Windows、来源长路径与安装态未独立验证。没有新增共享状态词汇、配置或协议,无需另起抽象或产品页面;绿测试不消除上述负向缺口,也不授予合并权限。
English verdict: REQUEST_CHANGES at af75cf5. Register authenticated same-root runtime cleanup before setup can fail: the Windows replacement root escapes the existing pytest-root teardown, and the only stop is after yield. A controlled POSIX branch replay leaves a real owned Node responsive after directory cleanup; an early-finalizer-only control drains it. All22 HTTP cases,549 workflow cases and premerge pass, but do not cover this failure. Native Windows execution is not independently claimed.
| parent = "\\\\?\\UNC\\" + parent[2:] if parent.startswith("\\\\") else "\\\\?\\" + parent | ||
| # Cleanup must still handle deeper source namespaces after a failure. | ||
| temporary = tempfile.TemporaryDirectory(prefix="lxra-", dir=parent) | ||
| request.addfinalizer(temporary.cleanup) |
There was a problem hiding this comment.
[P2] Register runtime cleanup before setup can fail. The Windows branch replaces the fixture-local tmp_path, but the global teardown still searches the original pytest tmp_path. register_pack already starts Node before the provider identity check; an exception before yield skips the only stop at line130, while this finalizer removes the new directory. In a controlled POSIX replay of that borrowed-root branch, the real owned Node still answered authenticated ping after registered cleanup; an early same-root stop finalizer drained it. Register the existing authenticated stop_disposable_effect_runtimes finalizer before register_pack, ordered before temporary.cleanup, and cover setup failure. This replay is not a claim of native Windows execution.
There was a problem hiding this comment.
Fixed at signed head 1e5df0b after integrating main be1dc37. The same-root authenticated stop finalizer is registered before register_pack and runs before TemporaryDirectory cleanup, including pre-yield failure. Native Windows regressions inject failure after registration and at provider identity selection: both fail with the old placement (directory still occupied) and pass with the fix, asserting the original owned PID exited. Fresh local HTTP family: 14 passed / 10 source cases deselected. Required Ruff and diff checks pass. The existing source read-count observer also uses physical samefile identity to retain its exact-count/source-change assertions across Windows path spellings. Source-scoped Windows qualification remains #7363; current-head CI and independent review remain pending.
…-http-fixture-20261026 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
动机
在 Windows 或其它平台运行本地研究 HTTP 生命周期验收的贡献者。 旧 fixture 在 setup 失败且尚未 yield 时可能留下 Node;当前在首次注册前挂上同目录的鉴权清理,先停止进程再删除临时目录。 独立借用目录分支重放中,注册后失败与 provider 身份失败均停止原 PID;只移除提前的 stop finalizer,两者都会留下仍存活的原 PID。 只改测试 fixture 与 Windows CI 入口,不修改研究产品、权限、持久协议或评分,不把本机分支重放当作原生 Windows 全量资格。
APPROVE,精确 head 1e5df0ba74a954c06ed4481ce901d34014632e09。 本次重新检查完整两文件,旧 setup 清理发现已有真实进程负例转正。来源命名空间的原生 Windows 长路径、UNC及全平台验证仍未完成。 现有#7363继续承接,不能用本地 HTTP 切片替代。
改动思路
原生合成 launcher、真实 HTTP/Node 和鉴权 cleanup 均复用已有 owner;生命周期缺口由提前注册同目录 finalizer 修复,无需新增进程管理抽象。 本 PR 同批覆盖本地 HTTP fixture 的正常/拒绝/恢复与 setup 失败清理;十项来源命名空间的原生 Windows 长路径继续由 #7363 承接。 全局 teardown 看到的原 pytest tmp_path 与 Windows 借用的短目录不同;只在 yield 后 finally 或仅删除目录都不够。提前注册原 stop helper 是最小修复。修改系统长路径策略、缩短源 hash 或新增生命周期服务均不必要。
正常旅程继续走真实注册、HTTP、SQLite、Node 与合成 provider,并检查取消、重试、缓存、引用和来源变化。provider 不存在或 which 指向其它文件时拒绝 setup;它没有因为 launcher 可发现就授权真实模型。
具体改动
规范 docs/development/testing-and-quality.md,spec_revision be1dc37a008be7017b64b622f653b6707df5c544;固定版本正文。Pull-Request Baseline、Refactor Real-Path Gate、Evidence Boundary 在此切片均 implemented:工作流/静态检查保留,真实入口和负例运行,原始私有材料不公开。此前规范与 finding 的清理义务没有通过重写要求缩小。
关键代码讲解
workspace选择 Windows 短临时根后,先注册目录 finalizer,再注册同根鉴权 stop,最后才 register_pack。pytest 后进先出,因此 setup 尚未 yield 就失败也先停止原 Node,再删除根。TMPDIR/TEMP/TMP及 tempfile缓存均限定到 case 的 process-tmp。write_provider复用 write_python_host_fixture 并验证 which 的实际文件身份;修改脚本的既有用例通过同一 helper 重建 launcher,UTF-8 stdin/提示读写明确,没有把 .exe 与 .py 分开修改。observed使用物理 samefile,保留真实来源读取次数和变化断言,而非放宽次数。新增两项 setup 失败用例记录真实 locator/PID,检查原进程退出,并在失败控制后清理自己的进程。
整份 +93/-14:fixture +86/-14、Windows工作流 +7/-0;没有产品代码、持久格式、权限或共享语义词汇修改。Windows步骤仅追加原本地HTTP家族;十项来源用例依然存在,未从全量非Windows模块删去。与上一af75的差异为提前清理、两项负例及路径拼写观测修复,整体launcher/隔离设计也重新判断。
对主干的风险
独立运行完整 HTTP 模块 24过,没有本机 deselect;工作流 549过,必需 Ruff 和标准预检 5直接+2选中通过。第一次误写不存在的 tests/test_ci_workflow_contract.py,属于审查命令错误,保留记录并改跑实际模块,不归因于PR。未查询、等待或轮询 hosted CI。
独立四格负例通过实际 fixture、register_pack、Node和鉴权停止执行:借用Windows短目录分支,仅把Windows路径前缀转换为本机路径;注册后抛错与provider身份失败都在yield前发生。当前两个原PID均退出;仅移除提前的stop finalizer,两个PID均仍存活,即使目录已删除。探针最后停止全部自己创建的负向进程并核实退出。这个控制证明清理时序,不证明原生Win32删除/CreateProcess行为。
同一八组HTTP输入在不可变be1旧fixture及当前fixture比较完整响应。所有产品文件在base/head逐字一致,基线fixture因此使用同一份真实backend;这不是两个候选provider相互自证。只归一化 started_at_unix、analysis_wall_seconds,两臂200/409/403/400/200/200/200/200及全部正文一致;拒绝信息、身份、状态、引用、缓存和权限没有被归一化。合成provider仅执行一次,重复读取与replay不额外调用;另行删除provider身份guard的控制只触达带标记的自有合成fallback,未运行真实模型。origin/main6e035相对be1的相关workflow/fixture/launcher/cleanup/research路径未变。
我的整体评价
无阻断 finding。交付是 justified_increment:可用的本地HTTP fixture与setup回收可以独立验收,原生来源Windows全量仍归#7363。long_horizon=improved仅指重复测试能回收自己的进程;user_experience=improved限于贡献者沿原命令执行、无需全局策略或新确认。原生合成 launcher、真实 HTTP/Node 和鉴权 cleanup 均复用已有 owner;生命周期缺口由提前注册同目录 finalizer 修复,无需新增进程管理抽象。 本 PR 同批覆盖本地 HTTP fixture 的正常/拒绝/恢复与 setup 失败清理;十项来源命名空间的原生 Windows 长路径继续由 #7363 承接。
代码规模与真实故障相称,提前复用原finalizer已是适用的局部收敛,无需新抽象。产品完全无变化,default_off_isolation为not_applicable;保留原权限/缓存/来源语义,机器检查与独立执行分别记录。visual_review=not_applicable:只有fixture与CI命令,没有页面或首屏改动。原生Windows、UNC、来源长路径、完整当前CI、正式App和模型收益未由本评审认证,作者14/10报告保持作者来源,不升级为本人的执行。旧讨论保留,不dismiss/resolve,不合并;批准和当前合并门另行读回。
English verdict: APPROVE at 1e5df0b. Whole two-file rereview independently verifies both pre-yield failure paths with real owned Node/PID cleanup; removing only the early stop reproduces both leaks.24 HTTP and549 workflow cases, required Ruff, standard premerge and eight complete baseline/head HTTP responses pass. The borrowed-root replay is macOS control-flow evidence, not native Windows qualification; source-scoped Windows paths remain issue7363. No production behavior or authority changed.
The local research HTTP fixture now uses the existing native synthetic-provider launcher and a bounded Windows temporary root, so contributors can run the lifecycle checks without a system policy change or real model execution. Provider identity and UTF-8 IO remain explicit; source-scoped Windows qualification remains tracked in #7363.
At current head
1e5df0ba7, authenticated same-root runtime cleanup is registered beforeregister_packcan start Node, with finalizer ordering that stops the runtime before deleting its directory. Two real-process regressions inject registration and provider-identity setup failures. Both fail on the previous cleanup placement on native Windows, and both pass after the repair, checking that the original owned PID exits. The source-read observer compares physical files withsamefile, preserving exact read-count and changed-source assertions across Windows path spellings.Validation on native Windows / CPython 3.12.10 from this checkout:
git diff --checkpass. Semantic advisory reports no supported product vocabulary carriers; test-only source is outside that probe's supported scope.PYTHONUTF8=0for the original 12 local cases. The fresh 14-case run used the current environment; no broader encoding qualification is claimed.Scope: tests and Windows CI entry only; no product frontend/Lark/CLI, authority, persisted state or source-verification behavior changes. Reused the existing launcher and cleanup owner; no new abstraction or shared vocabulary was needed. Integrated target main
be1dc37a008be7017b64b622f653b6707df5c544; all branch commits are signed off. No model or benchmark job, active Goal mutation, system upgrade or self-merge.