Skip to content

test(chat): fix pytest fixture lint after #8148 - #8188

Merged
loopx-agent merged 1 commit into
mainfrom
codex/pr8148-ci-fix-20261106
Nov 6, 2026
Merged

loopx-agent merged 1 commit into
mainfrom
codex/pr8148-ci-fix-20261106

Conversation

@huangruiteng

Copy link
Copy Markdown
Collaborator

Problem

After #8148 merged, the repository-wide kernel static check still failed on three intentional pytest fixture injections in tests/test_chat_codex_history.py. Ruff interpreted the imported fixture names and matching test parameters as F811 redefinitions, which made the downstream correctness, pytest, and merge-gate jobs fail as aggregate lane checks.

Change

Keep the imported fixtures and their test behavior unchanged. Mark only the three test functions that intentionally receive those fixtures with a narrow # noqa: F811 explanation. No runtime, benchmark budget, or test assertion changes.

Validation

  • python -m ruff check tests loopx/canary loopx/control_plane loopx/domain_packs loopx/presentation - PASS
  • pytest -q tests/test_chat_codex_history.py - 33 passed
  • pytest -q --no-cov tests/test_stage2c_dependency_lock.py tests/architecture/test_top_level_module_budget.py - 7 passed
  • git diff --check - PASS

A broader benchmark probe produced 108 passed and 361 skipped. Its five quota should-run envelope failures were independently reproduced on the immutable base and reviewed head of #8148 before this follow-up; this PR does not change that path.

Keep the imported fixtures accessible while marking the three intentional parameter-name reuse sites for Ruff F811, restoring kernel-static-checks after #8148.

Signed-off-by: huangruiteng <huangrt01@163.com>

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer: model_agent; gpt-6.1-sol; OpenAI; runtime_reported; reasoning_effort=max

Exact head: 8188@a157f8753c89b9a755e5b811a59209fc9b543813

动机 / Motivation

维护原生对话历史测试的贡献者,在运行仓库要求的 Ruff 检查时会遇到三个 fixture 名称被误判为重定义的问题。

旧版本的测试可以正常执行,但导入的 pytest fixture 与同名测试参数触发 F811,阻断静态检查;新版本只在这三个函数定义处标明有意使用 fixture。 同一不可变基线与当前 head 各通过 40 项相关测试,整个模块的 AST 完全相同;完整要求目录的 Ruff 从三处 F811 变为通过。 本次只修复测试维护问题,不改变对话执行、Stop/Close、来源撤销、模型选择、测试断言或仓库级检查规则。

改动思路 / Approach

沿用已有 fixture 导入与 pytest 注入方式,只在 Ruff 报错的函数定义处豁免 F811。删除导入会影响 fixture 注册,修改全局规则又会扩大豁免范围;当前三行注释直接对应三个已重现的诊断。基线和 head 的完整 Python AST 相同,因此没有把运行时修复混进这个维护提案。队列中 #8177 的显式 re-export 是另一种重叠方案,后续集成时需要正常处理该重叠。

具体改动 / Changes

关键内容讲解

tests/test_chat_codex_history.py:14,53,105 的三个函数各增加 # noqa: F811。steward、conversation 的导入、参数、同步事件、错误匹配和断言均保留。两个 pytest 参数化组也完全相同,未减少反例覆盖。

规范依据为 CONTRIBUTING.md,spec_revision df97c78693417137fcb1cb961fb840062311f7e3。L144-L173 → implemented:完整 Ruff 目录与严格 mypy 已独立运行。L35-L62 → implemented:基线重现了实际维护缺陷,本 PR 交付可独立使用的窄范围修复。没有要求本提案承担更大恢复项目的验收。

对主干的风险 / Risks

PASS:两端相同测试命令各 40 passed,涵盖历史来源撤销、锁前 Stop/Close、native start 后设置变化,以及依赖锁和模块预算;完整 AST 相等。PASS:head 的完整 Ruff 要求目录、严格 mypy(17 files)及 diff whitespace 检查;精确范围 CQR 有效,本地 quick premerge 的 5 项直接检查通过(未选额外 canary)。基线相同 Ruff 命令的三处 F811 与本次注释逐一对应,没有把数量相等当作因果证明。

局部豁免会继续忽略这三行未来的 F811,需要维护者保留有意 fixture 注入的边界;其它规则与其它行仍被检查。作者另述的广泛 quota probe 保留为 UNVERIFIED 诊断,不声称已修复;本次没有查询或等待远端 CI。#8177 的替代写法尚需在实际合入顺序中协调。

我的整体评价 / Verdict

本次测试维护目标已实现,没有发现阻塞性代码问题。long_horizon=preserved:原有取消、来源和设置边界保持,未新增重试或模型调用;user_experience=preserved:贡献者恢复既有静态检查,对话用户旅程不变。视觉检查不适用:完整 diff 只有三个 lint 注释,没有 renderer、布局或用户界面变更;unverified_scope:无视觉变更,远端 CI 未查询。合并仍需独立的质量与权限检查。

English verdict: APPROVE — the three targeted F811 suppressions restore the required lint check while preserving the complete test AST and relevant behavior.

@loopx-agent
loopx-agent merged commit cd67718 into main Nov 6, 2026
21 of 34 checks passed
@loopx-agent
loopx-agent deleted the codex/pr8148-ci-fix-20261106 branch November 6, 2026 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants