Repository navigation
test(chat): restore canonical project context qualification - #7189
Conversation
Signed-off-by: aihop <4408344+hhyykk@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
APPROVE — reviewed 811549cfdefb82c205e3c8aee4cd3e46bfde6209 against immutable 0d55a3d8a22f3dece6a135aa817ed5ec04a26a0a. 这是原有测试资格修复,不改变生产 authority 行为。
动机
维护项目会话隔离、私有工具授权和协作回传测试的贡献者与维护者。 基线六项测试中的两项因 Todo 来源未迁移而失败;当前夹具先建立真实 File/SQLite canonical 来源,再清空旧 Markdown 展示,原有协作断言继续执行,十一项全部通过。 原测试恢复了实际 canonical 数据读取、跨项目隔离、外部输入权限拒绝和重启后仅一次回传的覆盖,并明确验证未迁移 Markdown 仍被拒绝且不被改写。
旧夹具使测试在取数准备阶段失败,后续的隔离与回传断言无法形成有效回归保护;绕过拒绝或放宽断言会隐藏真实边界。 本次只修测试资格,不改变生产 reader、权限、存储协议或回退策略;不宣称完整 suite、安装版、模型效果或长程收益通过。 不做修复会让原有隔离断言持续在准备阶段被挡住;通过恢复旧回退或删除断言换取绿色会损害真实约束。
改动思路
沿用同一测试模块和共享 canonical fixture。先用原合成文本作为初始化输入,再由真实 Node owner 建立 File/SQLite authority 与 fence,最后清空 Markdown 的 Todo 展示。这样正例必须从 canonical provider 得到数据,无法仅靠残留文本通过;另用显式 project=None 保留未迁移场景,确认产品仍拒绝把 Markdown 当作来源。
没有新增第二份 provider 初始化器,没有 mock 掉决策,也没有改动 reader 的回退或权限。原有四个使用 project 夹具的场景全部保留并在两种后端执行,停止相关的两项独立测试保持原样。这个范围足以恢复已损坏的资格链,无需把测试修复扩成生产协议改造。
具体改动
关键代码讲解
project增加 File/SQLite 参数,复用isolate_sqlite_runtime绑定当前进程与子进程的临时根;为 research 与 other 两个合成项目调用原initialize_canonical_source_fixture,随后empty_todo_display。初始化只发生在一次性测试目录,未读取或改写活动 Goal。test_project_evidence_scopes_before_reads_and_rejects_remote_and_other_goal除原来的先限 scope、无其他项目泄漏和拒绝远端外,再断言 source 为 read、unknown 为 false,且只有预期的一条 title。空展示与真实 provider 形成独立来源反例。test_project_todo_read_refuses_unmigrated_markdown显式跳过 canonical 初始化,实际读取返回 unavailable/unknown、matched=None、rows=[],Markdown 字节保持不变。它保护失败关闭规则,而不是替老夹具找回退。- 原嵌套 CLI handoff/重开 store 仅回传一次、legacy Session 受限恢复、web→Lark→web 私有工具权限断言均未删改;合成模型保留真实本地 store/CLI 路由,外部 transport 被禁止调用。
单文件 +29/-2:共享 helper 导入、夹具参数与初始化、两条更强正例断言、一项明确负例。依据修改前 overall roadmap 的 Trustworthy validation · S10/S12,spec_revision 0d55a3d8a22f3dece6a135aa817ed5ec04a26a0a:canonical-source-project-read implemented,恢复真实 canonical consumer;project-scope-and-return implemented,保留隔离/权限/重启回传义务;unmigrated-refusal implemented,来源缺失仍拒绝且不改写;complete-candidate-qualification deferred,完整 suite 与当前范围 CQR 仍需独立完成。
对主干的风险
最强风险是测试“通过了,却不再验证实际权威或原有权限”。因此独立比较了完整旧测试与共享 fixture,而不是只采用作者的统计:
- 同一原模块命令在不可变0d55基线得到 2 failed /4 passed;两个失败都是 Todo 非 canonical,导致预期内容读取和首个 web turn 未完成。相同失败也在未改此模块的 #7187 复现,完整归一化错误细节一致;历史失败作为失败保留。
- 当前精确提交上原模块 11 passed,是四个夹具消费者分别在 File/SQLite 执行、两项原 stop 测试与一项 unmigrated 拒绝;相关 manager inspection/project context 再 61 passed。没有删除原断言、跳过失败或放宽超时。
- 正例先清空展示,再检查 canonical source/read/not-unknown/精确行;负例保留未迁移 Markdown,仍 unavailable/unknown/None/空行且原文逐字节不变。原其他 Goal、远端、外部输入私有工具拒绝以及后续 web 恢复继续执行;nested CLI 与重开 store 的仅一次回传也仍执行。
- 标准 premerge 5个 direct 检查通过,0个 catalog/risk 选择,0 direct/run failure;实际工作流规定范围的 Ruff 通过,配置内17项 mypy 源码与已通过版本逐字一致。额外全仓 Ruff 扫描得到 98项错误,完整结构化结果在基线和两个提交上一致,均不在这个测试修复的因果路径;它不是本 PR 修复或全仓 lint 通过的声明。
原生 premerge 汇总仍 exit1 / quality_stale_receipt,当前 base/diff 的 CQR 必须重做;完整必需 suite 也未执行。这个持有项没有因为局部测试通过而被取消。没有查询、等待或调度 CI,没有访问活动 Goal、真实模型或发送外部消息。
现有覆盖与同作者批次已检查:完整34个开放提案和最近20项 hhyykk 提案中,#7187 验证 HTTP 源码扫描,本 PR 恢复原有协作 consumer,较早 canonical fixture 修复面向其他消费者;当前没有重复造 smoke 或经警告后重复违反的证据。共享 helper 和原模块是合适落点,不建议另建一套初始化/断言工具。
我的整体评价
对本次限定任务是 goal_achieved:已复现的夹具缺口修复,canonical 来源和原协作隔离断言都通过真实受影响路径。long_horizon preserved:原持久化回传/恢复义务得到保护,但测试资格不等于实测长程收益;user_experience preserved:生产入口、配置、导航、授权和确认轮次均不变。
只修改现有项目协作测试夹具与断言;完整 diff 和生产消费者已检查,没有生产页面、Lark 文案或 CLI 行为改动,截图不适用。安装版与真实模型行为未在本测试 PR 中重新资格验证。 没有发现本提交新增的代码级阻塞;当前范围 CQR 和完整候选资格继续由维护者完成,评审批准不等于合并许可。
English verdict: APPROVE at 811549c. The existing project coordination suite is restored using shared real File/SQLite canonical fixtures, with stale Markdown display removed and explicit unmigrated-source refusal retained. Independently reproduced baseline2fail/4pass becomes11passes at this head, plus61related passes, without weakening original scope/private-tool/return-once assertions. Full-suite and stale exact-scope CQR qualification remain separate holds; no production behavior, hosted CI or merge is implied.
Goal And Delivered Outcome
The project Chat fixture still supplied Markdown-only Todos after ordinary reads began requiring canonical authority. On main, two tests received
source.status=unavailableand failed before completing their evidence-read and private-handler isolation checks.Reuse
initialize_canonical_source_fixtureinstead of changing production read rules. Run the four fixture consumers against real File and SQLite stores. Empty the Markdown Todo display after initialization, so successful reads must come from canonical authority. Retain an explicitly unmigrated case that must return unknown/unavailable with no rows.Outcome basis:
docs/architecture/rfcs/loopx-overall-roadmap-v0.md, “Current priorities after research and acceptance integration” → “Trustworthy validation · S10/S12,” at main0d55a3d8a22f3dece6a135aa817ed5ec04a26a0a. Intended base:main.Author Declaration
Scope And Continuation
Complete within this test-repair scope: one test file, no production changes. This restores regression protection; it does not claim new product behavior, installed adoption or model benefit.
Checked all 32 initially open PRs and refreshed their heads; also checked #7188, opened during validation. None changes this file. #7183 repairs different quota consumers; #7187 changes HTTP POST runtime scoping; neither is duplicated.
Validation
811549cfd(identical source tested before commit).uv run --extra test python -m pytest -q tests/test_chat_project_coordination.pyuv run --extra test python -m pytest -q tests/test_chat_manager_inspection.py tests/test_chat_project_context.pyFull repository CI, PostgreSQL, installed App/Lark and real-model evaluation were not run. This does not promote a provider or qualify the complete conversation journey.
Presentation And Fixture Impact
UI impact: none. The existing synthetic fixture now initializes canonical File/SQLite authority and retains its original scope/return assertions. No shared-authority schema, provider route or production compatibility projection changes.
Boundary Checklist