Repository navigation
test(ci): repair disposable fixtures and stale contract assertions - #6820
Conversation
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
…untime-fixtures-20261018 Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
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 · reasoning_effort=max
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
动机
维护者需要依靠测试判断真实问题,既不能把父测试写入误算给嵌套 pytest,也不能在失败后留下仍有效的采集许可,更不能把过期断言当成生产回归。
原先嵌套会话继承调用者的默认目录,观察断言失败又可能留下有效采集代际;另外两处测试分别漏列了已使用规范摘要的模块,并要求已准入的回执接管后来出现的工作。当前只修正测试归属、清理和这两条契约断言,保留真实传输与原有时限。
独立四个完整 Python 模块通过 75 项;两套完整 TypeScript 测试在实际基线失败 2 项、当前 39 项全过。让真实重规划 owner 错误接管新工作后,新断言会失败,证明确实保护了原回执边界。
本次不改变生产调度、重规划、采集协议、8 秒观察界限、CI 资源或托管验收条件;不宣称原 hosted 超时或完整六片资格已经解决。
本机 Python 3.13 的独立检查支持这批测试修复;原 hosted 超时、默认路径实际写入者、跨平台与完整六片/JUnit/覆盖率资格仍由原有工作验证,当前没有查询 CI。
改动思路
保留真实边界,修正测试如何拥有和检查它。嵌套 pytest 有自己的 HOME/USERPROFILE,启动时的默认路径 census 才能区分自身写入和调用者写入。采集 fixture 继续启动真实 detached Python/TypeScript 传输,只把原本丢弃的 stderr 保存为合成诊断;失败和成功都经同一个 finally 撤销代际并回收自身子进程。
重规划测试的两条断言分别保护不同入口:已有回执没有选中 obligation 时不能接管后来 frontier,新的非 guard 读取仍能看见当前 frontier。这不是把生产改成测试所需的行为;实际基线的 typed owner 已实现该区别。本次同域改进是复用一个已有文件内 fixture 和成对断言,没有新增框架、状态 owner、确认流程或生产兼容分支。
具体改动
完整五份测试文件 +159/-37。独立依据为 55d6337485d4924f1cbb8b41e51a8c02687c332a 的 docs/development/good-smokes.md,当前 PR 说明及不可变生产 owner:
- Start With The Contract:从原回执身份、默认目录归属和规范摘要使用者推导 oracle,而非复制当前输出。
- Review Checklist:使用真实 detached 传输、嵌套 pytest、失败清理和精确 namespace/PID 反例,合成数据不包含私有运行状态。
- Prefer Semantic Pressure:新增 guarded-null 与 fresh-current 的相反方向;真实 owner 临时错误接管新 frontier 会被新断言检出。
关键代码讲解
usage_transport 集中原有 opt-in、stderr 诊断与 finally。原 detach 参数、cwd、stdin 和命令入口保持;撤销由原 consent lock 围住后代,等待或回收第一跳不会被误写成已经杀死所有 detached Node。
nested_pytest_environment 给嵌套导入期的 census 一个独立目录。新 caller/nested 两例验证“仅自己的新默认写入导致失败”,原 source/copied、成功/失败、all/none retention 及 foreign/wrong PID 覆盖保留。
replan_semantics 测试 对应 unchanged preserveReceiptBoundObligation 的实际分支;规范摘要测试只把已调用 canonical digest 的 checkpoint_retention.ts 加入消费者清单,不新增例外。最后移除 checkpoint Python 测试原本未用的 Path import。
对主干的风险
独立运行四个完整 Python 模块 test_usage_goal、test_managed_effect_runtime_fixture、test_usage_ping 和 test_checkpoint_retention:两 worker、coverage、75 passed、0 skipped,46.53s,另有 7 条未关闭 SQLite connection 的 ResourceWarning,保留为警告而非写成无诊断。真实观察、长 header、相对路径、真实 child exit7/stderr、故意失败后的撤销/迟到派发、runtime 清理和默认目录归属都在本次完整运行里。
两套完整 TS 模块在实际基线 55d6337485d4924f1cbb8b41e51a8c02687c332a 37/39:一个漏列 checkpoint_retention 消费者,一个旧断言期望 later frontier 而实际为 null;当前39/39。进一步从真实生产 owner 制作仅内存/忽略目录 mutation,把 guarded selected=null 也改成 current,新消费测试准确因 object≠null 失败。它证明修正不是弱化原身份约束。没有修改生产文件或活动 Goal/lease。
完整配置的 Ruff、控制面 TS 类型检查通过;标准 premerge 五项直接检查、三项选中检查通过,无 manual hold。整个 loopx/apps/packages/scripts/docs 相对实际基线没有变化,原 8 秒、CI 两 worker/分片/coverage 条件没有调整。初始执行写错了两个测试入口,实际结果是零收集/exit5,已保留后更正为存在的模块;没有把这两次脚手架错误当成 PR 失败或通过。每个 validator 独立收集退出码和输出。
本轮不查询、轮询或等待 hosted CI。作者的旧自然日志及跨平台/全量资格仍是另外的验收,当前本机通过不能证明原 hosted 超时已经根治,也不是已安装运行时或性能收益证明。相邻 #6825 与本提案只重叠 import 清理,#6826 保护另一条真实投影旅程;可分别回退,不需要扩展本 PR 的运行时范围。
我的整体评价
APPROVE,精确 head 6227601ca442b6f5808710ea4de0d4077094d7fd。当前差异没有新增阻塞发现。修复了可复现的旧测试契约错位,新增失败清理与归属验证仍走真实路径,原重要断言和资源边界都保留。测试资格与生产/托管整体交付分开,批准不授予合并或安装权限;需要按当前 head 的原生 closeout/readiness 结果处理合并。
English verdict: APPROVE — 6227601. Independent complete Python75 and TS39 pass; the actual base reproduces both stale TS failures, and a real-owner mutation is rejected by the guarded receipt assertion. Full Ruff/types/premerge pass. Original hosted timeout, cross-platform and full-shard qualification remain open; no production behavior or timing/resource gate changes.
Nested pytest inherits the caller's default-home routes, and failed usage-observer assertions can leave a valid collection generation. Natural CI also exposed two stale contract fixtures: the checkpoint-retention digest consumer was missing from the pinned inventory, and receipt replay expected a later frontier to be adopted without a selected obligation.
This test-only proposal isolates nested homes, revokes consent and reaps owned children on failure, retains real detached transport and its diagnostics, removes the unused checkpoint-test import, and aligns the two contract fixtures. A guarded replay with no selected obligation stays empty; a fresh unguarded read still sees the current frontier. Production behavior, the existing 8-second observation bound and CI resource settings are unchanged.
Validation at
6227601ca442b6f5808710ea4de0d4077094d7fd, integrated with targetmainsnapshot55d6337485d4924f1cbb8b41e51a8c02687c332a:cqr_ffed6faee9e00a3f7464verifies. Standard premerge passed: five direct checks and three selected catalog smokes, no failures or manual holds.The original natural CI failure remains historical failure; its complete log now identifies the two fixture mismatches above. This new head still needs independent review and natural hosted CI. The original hosted timeout/default-route writer, Linux/Windows and complete six-shard qualification remain open.
嵌套 pytest 的默认目录继承与观察测试失败后的采集清理不完整,会造成归属误判或遗留采集。自然 CI 还暴露两处过期测试:检查点保留模块已使用规范摘要校验,却未列入固定消费者清单;回执重入测试仍期待在未绑定 obligation 时接管后来出现的 frontier。
本提案只改五份测试文件:隔离子会话目录、失败时撤销采集并回收自身子进程、保留真实传输与诊断、移除未使用 import,并验证“受保护的旧回执不接管新 frontier,新的未绑定读取仍看见当前 frontier”。生产语义、原 8 秒界限及 CI 资源不变。
上述精确 head:四个完整 Python 模块以两个 worker 和覆盖率通过 75 项、0 跳过;两个完整 TS 模块通过 39 项、0 失败、0 跳过。旧断言在修复前复现;让真实 owner 错误接管新 frontier 的临时 mutation 被新断言检出。完整 Ruff、类型检查、公共边界、DCO、双语 diff、精确 CQR 与标准 premerge 均通过。相邻重构已体现在既有场景的两条互补断言,无新框架或兼容层。
旧自然运行保留失败,完整日志的原因现已明确;新 head 仍待独立评审及自然托管验收。原超时及默认路径实际写入者、Linux/Windows、六片并集/JUnit/覆盖率等完整资格尚未关闭。