Skip to content

fix(tests): spell the steward evidence sender as a def - #8084

Merged
loopx-agent merged 2 commits into
loopx-project:mainfrom
gcl-coder:ci/steward-evidence-lambda
Nov 5, 2026
Merged

loopx-agent merged 2 commits into
loopx-project:mainfrom
gcl-coder:ci/steward-evidence-lambda

Conversation

@gcl-coder

Copy link
Copy Markdown
Contributor

问题

main 上 kernel-static-checks 现在是红的,根因只有一条 ruff 报错:

E731 Do not assign a `lambda` expression, use a `def`
   --> tests/test_manager_context_roundtrip.py:289:5

E731 属于 ruff 默认的 E7 规则集,而 kernel-static-checks 的 ruff check tests loopx/canary loopx/control_plane loopx/domain_packs loopx/presentation 以退出码 1 结束。它挡住的不只是一个 job:checks 依赖 kernel-static-checks,pytest、stage2c-correctness-e2e、merge-gate 又都依赖 checks,所以从引入这一行的提交之后,每个 PR 都是九个红灯,其中五个是同一个根因的传导(test-shard 根本不会启动)。

证据

  • 这一行由 acecb5d6b fix(chat): retain partial handoff scope in steward evidence reads (#8056) 引入;
  • 在 bd79adc64 上执行 ruff check --select E4,E7,E9,F tests/test_manager_context_roundtrip.py(即 CI 实际使用的默认规则集)得到 1 个错误,就是这一行,没有其他;
  • 修复后同一条命令为 All checks passed!。

改动

sender 只返回一个固定回执字典,改成同作用域的 def 表达同一件事,不需要 lint 豁免:

-    sender = lambda *_: {"ok": True, "reply_verified": True}
+    def sender(*_):
+        return {"ok": True, "reply_verified": True}
+
     report(root, "research", "worker", rid, "conclusion", "An initial analysis is available.", remaining_work=remaining)

测试

  • ruff check --select E4,E7,E9,F tests/test_manager_context_roundtrip.py → All checks passed
  • 该用例需要拉起 TypeScript Effect 运行时,本机被宿主权限拦在 EffectRuntimeHostPermissionError,所以行为一致性以 CI 的 kernel-static-checks 与该文件的测试 lane 为准。

范围:一个测试文件,三行。

`tests/test_manager_context_roundtrip.py` assigned a lambda to `sender`,
which the `ruff check tests` step in `kernel-static-checks` rejects with
E731. The rule is in ruff's default E7 set, so the lane went red for every
pull request from that commit onward: `checks` depends on
`kernel-static-checks`, and `pytest`, `stage2c-correctness-e2e` and
`merge-gate` all depend on `checks`.

The queued-sender callback only returns one fixed receipt, so a nested def
says the same thing without the lint exemption. `ruff check --select
E4,E7,E9,F` on the file now passes.

Signed-off-by: ChengLong GU <88359731+gcl-coder@users.noreply.github.com>
@mergify

mergify Bot commented Nov 5, 2026

Copy link
Copy Markdown

This pull request has merge conflicts with main and cannot be merged
until they are resolved. Please rebase or merge the base branch, @gcl-coder.

Choose the remote for the base repository, not an out-of-date fork.
For a fork clone, first inspect git remote -v; upstream must point
to https://github.com/loopx-project/loopx.git. If it is absent, add it
with git remote add upstream https://github.com/loopx-project/loopx.git.
Then run:

git fetch upstream
git rebase upstream/main
# Resolve each conflict, git add the resolved files, then git rebase --continue.
git push --force-with-lease origin HEAD

For a same-repository clone whose origin points to
https://github.com/loopx-project/loopx.git, use origin instead of
upstream for fetch/rebase. If you prefer merging the base, use
git merge <base-remote>/main and push normally.

Keep the DCO Signed-off-by trailer on every commit when you rebase.
https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify Bot added the needs-rebase Mergify: the pull request has merge conflicts with its base branch label Nov 5, 2026
loopx-agent
loopx-agent previously approved these changes Nov 5, 2026

@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.

动机 / Motivation

运行本仓库静态检查并维护管家交接回归的贡献者。 既有测试把 sender 赋为 lambda,完整 Ruff 以 E731 失败;同一局部 def 保持回执和参数语义,使完整 Ruff 通过。 独立基线和 head 各99项交接测试通过,完整 lint 从唯一 E731 变为通过;没有更改产品代码。 不修复所有历史 CI、不改变交接权限或发送流程,也不新增 smoke、fixture、状态或页面。

独立审查完整 exact head 3eaea44e61b4e7203f981a4bf1b1b946cf6a6eb7,不可变 base 92294e7245cb3ad50119c6b817667410a4517c2f。这是已有测试的具体维护缺口,不以增加测试或 PR 数认定价值;没有把作者“所有红灯同一根因”的陈述当作已核验的远端 CI 事实。

改动思路 / Approach

保留原作用域和 *_ 参数,只用普通函数定义表达同一固定回执,比 lint 豁免、新 helper 或新增测试更小。生产 roundtrip._return_provider 直接调用 callable sender,并未依据函数名决策;原 partial/final/later-remainder 与权限断言全部保留。贡献者从既有命令到可用结果不增加配置、确认或信息重填。

具体改动 / Changes

一文件 +3/-1,没有产品代码、fixture、断言或 workflow 改动,唯一提交具备 DCO。spec_ref: CONTRIBUTING.md,spec_revision: 92294e7245cb3ad50119c6b817667410a4517c2f;按 Local Development 的 focused tests / 完整 Ruff 验证维护结果,按 What CI runs on a pull request 保留 required checks 与 merge authority 的独立边界,两项在本次范围均 implemented。

关键内容讲解

  • 局部 sender 与原回归:参数和回执字典未改,owner / original-audience 两种场景仍检查 partial 保留、final 结清、later remainder 重开、重启读回和权限变化。将此唯一 def 规范化回原 lambda 后,整个模块其余 AST 完全一致。
  • 真实 callback consumer:既有 typed return transaction 处理身份与状态,provider 分支只按 callable 协议调用 sender。改动没有增加发送权或改变重试/去重;完整模块用隔离真实 TS owner 验证,并未发送真实外部消息。

对主干的风险 / Risks

没有阻塞性的代码发现。 最强风险是假定“写法改变”暗中改变 callback 的签名、返回值或依赖函数名;已通过源调用方检查、完整 AST 对照及同一完整99项回归否定。完整 native queue 的同作者两项分别解决 portable IO 与既有 E731,不是新增同形 smoke;这里没有新增可被合并或删薄的测试。

独立检查 base head
完整 configured Ruff FAIL:唯一 E731 PASS,无规则豁免
完整 roundtrip 模块 PASS:99项 PASS:99项
configured mypy,无增量缓存 FAIL:208B no-any-return 相同完整208B失败
native standard premerge 未重复运行无改动基线 PASS:5 direct;catalog0项;无 manual hold
strict exact-scope CQR 无本次修复 receipt cqr_c5d0475cd0614a478c3b:fail,保留 mypy required 红灯

mypy 失败位于未改的 task_orchestration_admission.py:110;两端完整输出字节相同,失败文件、pyproject 与生产 return consumer 均相同,变更路径另有99项实际回归与 Ruff 正向证据。这支持代码批准,不把 required 检查改为通过,也不宣称 CI 全面恢复。当前源元数据显示与 main 有合并冲突,须由原作者在新头解决;此批准不能跨到之后的新提交。

我的整体评价 / Verdict

APPROVE 此准确头的一处维护改动。具体 E731 缺口 goal_achieved;长程交接语义 preserved,贡献者运行静态检查的体验 improved。只改变 tests/test_manager_context_roundtrip.py 的局部测试回调,没有渲染页面变化。 没有查询远端 CI;独立复现的既有 mypy 失败与当前合并冲突仍待各自 owner 处理。

它采用原测试和常规语言写法,没有新状态 vocabulary、兼容分支、产品入口或额外人工流程。已有类型失败、strict CQR、冲突和随后原生 merge-readiness 是分开的 hold;未合并、未替作者修改源码,也未用 admin bypass。

English verdict: APPROVE — 3eaea44: the in-place callback cleanup removes the reproduced Ruff violation and preserves the complete99-test behavior; existing type-check and merge-conflict holds remain separate.

@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.

Self-review after conflict repair — exact head 5331fd09d771ac6594ed9fac9695d3742b3932c6.

  • The sole conflict was duplicated formatting for the same sender callback: current main already contains the PR fix.
  • Resolved by accepting main formatting and committing the GitHub-generated merge; the target test file is byte-identical to current main.
  • ruff check --select E4,E7,E9,F tests/test_manager_context_roundtrip.py passes on the exact head worktree.
  • The merge commit is GitHub-authored/committed and is eligible for the repository DCO merge-commit verification path.

APPROVE. No semantic code delta remains after syncing; this is a merge-readiness repair for an already-reviewed fix.

@huangruiteng huangruiteng 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.

Independent approval of exact head 5331fd0 after conflict repair.

@loopx-agent
loopx-agent merged commit 22005a8 into loopx-project:main Nov 5, 2026
4 checks passed
@mergify mergify Bot removed the needs-rebase Mergify: the pull request has merge conflicts with its base branch label Nov 5, 2026
@loopx-agent

Copy link
Copy Markdown
Collaborator

更正我在上一条评审中的主干价值判断:该评审针对 3eaea44e61b4e7203f981a4bf1b1b946cf6a6eb7,证明了相对其原基线的 Ruff 修复和 99 项回归保持;补核真实主干后,#8072 的提交已在更早时刻包含同一 sender 的 def 修复。因此,原评审将这项改动描述为主干仍需要的新修复不准确,主干的这项收益应归于已有提交。

原准确头的代码验证记录保留,原评审当前状态为 DISMISSED。随后同步主干的 head 5331fd09d771ac6594ed9fac9695d3742b3932c6 已获维护者独立评审并合入,当前文件差异为零;原批准仅适用于原准确头。这条补充纠正历史说明,不追加一次新 head 的批准结论。

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.

3 participants