Repository navigation
test(runtime): retain safe IO causes for admitted drain failures - #6424
Conversation
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 | gpt-6.1-sol | OpenAI | runtime_reported | xhigh
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
动机
维护者定位已经接收的写入为何在排空过程中失败时,需要能区分文件缺失、权限拒绝和具体文件系统操作。真实 Windows CI 的 connected-shutdown 场景只报告了通用 IO 异常;原观测仅用于另一条退休测试。现在同一排空断言失败时,会从隔离副本读回经过过滤的错误码、syscall、数值 errno 和磁盘状态,原失败仍然抛出。本地真实目录替换故障证明诊断可以指向 EISDIR 和 read/open,原写入仍失败且未提交;四个健康排空组合保持全部断言并无额外输出,完整相关套件在两个 Python 版本上各通过 109 项。本 PR 不修改生产 IO、错误协议、排空规则、期限、权限或安装行为,不把本地目录故障当作真实 Windows 根因,也不宣称全仓库托管 CI 或发布容量合格。真实 Windows IO 的底层原因仍需从原生失败执行的观测确认;完整托管期限、原四分片和发布 runner 容量验收继续保留。
真实失败来自 main run 38455015944 的已接收写入排空场景。没有底层观测时,仅增加时间上限或猜测权限不足不能修复已证明的失败。这里交付的是可回读的失败诊断阶段;#6407、#6414 已合入的修复属于另外的因果路径。
改动思路
复用原有隔离副本、子进程 stderr 保留和过滤器,扩大到实际失败的 drain 调用者。生产源码文件没有修改;源代码只复制到测试临时目录,在副本的错误包装前记录系统字段。原始错误继续经过原来的类型化包装,Python 端仅在原断言或调用失败时读取有界事件,然后重新抛出同一失败。
相关重构把原退休测试的重复复制/捕获设置放进既有 helper,不创建通用诊断服务、协议或第二个运行时决策源。角色和默认权限不变;观测不能决定重试、接受写入、延长排空或删除 journal。健康场景增加安静输出断言,避免诊断变成每次执行的日志噪声。
具体改动
当前评审 head 为 e2e6993c732ddcfc34a6eea93cfdbeeec4eb3fb4,实际验证基线为 77627b6ed391cf0e82137d8231c241963967ca5b。该内部 fixture 观测没有独立书面规格;预期由原有已接收写入断言、现有错误包装 owner 和真实失败日志定义。S10/S12 提供观测与定位方向,不构成新的 Windows 或全量 CI 合格声明。
关键内容讲解
observe_copied_runtime 只复制当前完整运行时源文件并捕获这个副本的服务器 stderr,描述符由测试 finalizer 关闭。原 decode 退休测试和 drain 测试共用这一条设置路径;源码锚点漂移会直接报错,避免观测未知实现。
trace_events 复用现有本地事件/错误码集合,增加已识别 syscall 和数值 errno。字段按名称、类型及精确允许集合过滤,路径、令牌、message、stack 和未知字符串不会成为公开 fixture 输出。Node errno 是 libuv 数值,不能把它解释为 Windows WinError。
test_runtime_drains_admitted_write_before_exit 保留真实锁、错误认证、同 PID、监听关闭、journal 全文及退休检查;错误分支报告过滤后的事件和磁盘状态,再重新抛出原错误。真实目录替换反例通过同一测试/Node 写入路径证明错误仍然存在,诊断没有把失败变绿。
对主干的风险
主要风险是诊断改变被测语义或泄漏不安全内容。删除错误事件 producer 后,真实原因读回用例失败;去掉过滤后,五项隐私用例失败。初版观测读取一个会抛错的 syscall getter,固定预期的错误包装对照确实失败;最终把读取也纳入保护,原始和副本的三个完整 payload 都符合独立固定预期。Python 观测不可用时也继续抛出原永久 IO 异常,不以观测失败覆盖它。
完整 runtime integration、host-permission、scheduler-runtime 三模块在 Python 3.11.17、3.14.8 上各 109 passed、零 skipped,执行的是自己的实际 Node 服务器和隔离真实文件系统。Ruff、配置内 mypy19、advisory 后的实际完整 examples/semantic-vocabulary-drift-smoke.py、精确 CQR 及 canary 通过。canary 只有四个 direct、零 catalog-selected,实质覆盖来自上述完整套件与反例;不能把编译/质量回执当作诊断证据。一次入口路径输入错误已纠正,没有计作运行成功。
captured stderr 保留原有 first 16 KiB / last 64 events 边界,共享偏移读取可能与写入竞争;事件缺席不能证明未发生。Windows 的真实失败原因、共享/ACL 行为和托管完整期限尚未验证。生产权限、协议分类、期限与注册词表未变;新集合是既有 fixture 的局部过滤规则。评审配置不查询或等待 CI。整个变更可用一次提交撤回,无持久迁移。
我的整体评价
APPROVE,作为 justified_increment。 long_horizon 为 preserved:排空、原始错误与结果/退出检查仍由原 owner 决定,观测没有增加生产状态、重试或失效后的重复效果。user_experience 为 improved:贡献者仍执行同一测试,成功安静,失败可读且不泄露原始内容。
这不是重复 smoke:基线只有另一条退休观测,实际失败的调用者没有它;作者批次和相邻提案没有等价修复。两文件的机制与真实定位缺口相称,已应用相邻的设置复用。完整父任务继续 OPEN;这条自评是作者 COMMENTED 记录,不能当作独立批准、GitHub APPROVED、合并权限或已安装/原生 Windows 恢复证据。
English verdict: APPROVE — The existing copied-runtime observer now covers the actual admitted-write failure, preserves original failures/payloads, filters private fields and keeps healthy drains quiet. Both Python versions pass all 109 related tests. This bounded test-only stage does not establish native Windows root cause, full hosted CI qualification or merge authority.
Goal And Delivered Outcome
The real Windows lane of main run 38455015944 failed in
test_runtime_drains_admitted_write_before_exit[connected-shutdown]with a generic filesystem error. Its log cannot distinguish a missing file, permission denial or a failed filesystem operation. The existing copied-runtime observer served a different retirement test and did not observe the error before protocol sanitization.Reuse that fixture observer in the admitted-write drain test. On failure it can report an allowlisted original Node IO code, syscall and numeric libuv errno, with safe runtime/journal state. Healthy drains stay quiet, failed drains still fail, and observation errors cannot replace the original failure. Production modules and their public error payloads are unchanged.
Author Declaration
Written by: model_agent — OpenAI Codex, GPT-6 family.
Implemented against
The observed CI failure and the existing accepted-write fixture/error owner at immutable main
77627b6ed391cf0e82137d8231c241963967ca5bdefine this bounded repair. Roadmap S10/S12 calls for observable failure classification and cheaper localization. There is no new public diagnostic protocol or written specification specific to this test observer.Self-check: inspected the original failure, current runtime/error owner and neighboring PRs. #6356 changes host-dependent TypeScript test assertions, while #6413 changes Python atomic-write helpers; neither supplies this missing admitted-write observation. The original lock, drain, authentication, listener, PID, journal and timeout assertions remain.
Scope And Continuation
Complete within the copied-fixture observation stage. The actual Windows IO cause remains unknown until a native failing run supplies evidence; a successful local directory-failure probe is not its root cause. Full hosted Python deadline, original four-shard/capacity and release priority qualification remain open. Related fixture repairs #6407 and scanner repair #6414 have separately merged; they do not close this acceptance.
The bounded companion refactor shares the existing source-copy/FD-capture setup between retirement and drain callers, replacing duplicate setup without adding a module or production mechanism. Source anchors fail visibly if the copied implementation changes.
Validation
e2e6993c732ddcfc34a6eea93cfdbeeec4eb3fb4examples/semantic-vocabulary-drift-smoke.py, public/DCO/diff scansObservations are bounded to the first 16 KiB and last 64 accepted events. Shared stderr offsets may race writes, so absence of an event is not proof that it did not happen. Raw stderr, paths, tokens, message text, stack traces and unknown string values are not published by the fixture. Node errno is a libuv number, not a Windows WinError claim.
Frontend / Visual Evidence
UI impact: none. Existing repository test fixture only; no installed or caller capability changes.
Type of Change / LoopX Area
Test diagnostics and bounded setup reuse; S10/S12 reliability and contributor localization.
Shared-authority RFC fixture impact
N/A: no authority provider, persisted contract, runtime routing or production IO behavior changes.
Boundary Checklist