Skip to content

refactor(apps): move Cannbot adapter into integrations - #528

Open
zengchuang-hw wants to merge 1 commit into
mainfrom
codex/apps-490-cannbot-review
Open

zengchuang-hw wants to merge 1 commit into
mainfrom
codex/apps-490-cannbot-review

Conversation

@zengchuang-hw

@zengchuang-hw zengchuang-hw commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Governing Issue and delivery slice

Refs #490
Refs #371

将 Cannbot 的只读外部知识接入归入 apps/integrations/cannbot/,让 CLI、兼容导入和获准解释器都指向有明确归属的实现。

这是 #490 第四步 integrations 的 4a 切片(整体仍为五步)。原 #526 的复审 因评审通道只能读取截断 patch 无法给出完整结论,Cursor 入口也已在仓库关闭,因此将原变更拆为 Cannbot、MindIE 两个原子切片,每个切片保留自己的兼容测试。后续 MindIE 切片已在本地准备,累计内容与 #526 head 99c2373 整个 Git tree 相同;本 PR 合入后提交。第五步固定记录验收另行交付。

Base 493416520f537590eb8f2a4e74f276f82e488307;head 2045c0fe315ebb1ab0c6e5203b502b2ddf4d499d。完整差异为 15 个文件、86,590 字节,供检视通道完整读取。

Changed artifacts and evidence

要求 实际实现
具体集成有明确归属 Cannbot 的 initializer、project、read_worker 三个实现迁入 integrations。与 base 规范化源码一致,仅 channel protocol 相对导入加深一级
兼容入口 旧三个模块使用静态 re-export 和字面量 __all__;旧 pickle 可加载,新定义归 canonical 路径
原包的 project 绑定 旧 Cannbot 包继续导出旧 project 子模块,该模块的函数/类指向 canonical 对象;迁移表 module_exports 登记两级绑定并覆盖两种导入顺序
worker 与项目授权 canonical project 按 sibling 文件定位 worker,使用原获准解释器与 -I -B。grant 不保存 worker 路径,格式保持现有契约;旧 worker 路径提供登记的 Python 导入兼容
活跃调用与打包 同步 CLI 两处按需导入、边界测试、安装检查和目录文档;迁移表从原 13 项补至 16 项
无导入时执行 integrations 初始化保持轻量,覆盖冷导入、副作用、旧/新对象身份、标准库独立 worker 及真实安装 launcher 的结构化拒绝

MindIE 的实现和调用方在本 PR 保持当前 main 的位置,迁移由下一切片完成。三个 retired 根 MindIE 名称及旧 CLI 等现有退役检查均保留。无 CI、Knowledge 或冻结 evidence 改动。

Checks and dependencies

Windows / Python 3.12。测试运行时工作区基于 base,随后将完全相同内容提交为 2045c0fe;运行后没有源码变更。原运行元数据中的 base SHA 保留,并补提交内容关系记录。

检查 实际结果
Cannbot + 原 MindIE、迁移/模块/包/依赖检查套件 313 passed、7 skipped、330 subtests passed
全仓 Ruff、whitespace、三个实现源码比对 通过
独立 sdist → wheel → 新 venv,在 checkout 外执行安装检查 通过;930 资源,128 条记录;资源摘要 f4fe59130727ef9f80d42ef6e416aaea10ca27b0a56b93339c72e82ae77f1879
Codex / WorkSwarm / DSH 包与入口 57 passed;1 条现有 tarfile 弃用警告
当前 head Ready / knowledge-model-policy 全部通过;Ready run 44571267190,policy

回归节点:test_cannbot_boundaries、test_cannbot_channel_acceptance、test_mindie_project、test_mindie_context、test_mindie_runtime、test_apps_module_migrations、test_contracts_package、test_target_module_import_gate、test_package_root_inventory、test_first_wave_isolation_policy。使用 python -m pytest -o addopts= -q -x -rs --tb=short。

7 个跳过项为两项 Windows 不适用的 POSIX 进程组清理,以及五项需要获准真实 Cannbot 索引的场景。真实外部索引不在本次已验证范围。独立 worker 探针是合成缺失 checkout 的结构化拒绝,不是实际知识查询。

Remaining work and Issue closure

本 PR 只交付 Cannbot 迁移。MindIE 4b 与第五步整体组合验收仍待后续 PR;#490/#371 保持打开。#371 的生产评测仍按 #429/#430/#434 跟踪,软件回归不构成模型或服务性能收益证据。

保持 Ready。按当前 head 的两份有效独立 write+ 正式审批与必需 CI 核对,满足后 squash 合入;host-compatibility 按 #508 为 advisory。

Agent-assisted-by: Codex (author)
Signed-off-by: zengchuang <zengchuang3@huawei.com>

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

LGTM

PR review verdict — PASS
Reviewed base 4934165 and head 2045c0f (full diff, diffComplete: true). prior-reviews.md has no formal reviews, no Approve on this head, and no outstanding CHANGES_REQUESTED, so this is the first review.

Verified from the diff:

  • Pure move: the git blob hashes show integrations/cannbot/project.py (7386f0499) and read_worker.py (0ff4055d4) are identical to the pre-PR files. The only change to __init__.py is the relative import depth (...knowledge → ....knowledge). Grant schema, read-only access, limits, revocation and receipts are unchanged.
  • Legacy shims: apps/cannbot/{__init__,project,read_worker}.py use explicit static imports and a literal __all__. They re-export the canonical objects. apps.cannbot.project stays a distinct module, with no alias installed.
  • Worker launch: project._WORKER resolves via Path(__file__).with_name("read_worker.py"), so it points at the canonical sibling file. The launcher keeps -I -B. The worker's top-level imports are stdlib-only.
  • CLI: both apps/cli/__init__.py call sites import from ..integrations. The new integrations/__init__.py is docstring-only.
  • Inventory and docs: docs/apps-module-migrations.json adds the package entry with module_exports for project, plus the project and read_worker entries. docs/architecture.md and docs/module-layout.md are updated, and the doc wording now says MindIE is the remaining integration slice.
  • Tests:
    • test_apps_module_migrations.py is generalized for package: true and module_exports.
    • It adds a parent-first and child-first import-order test for the legacy project binding.
    • It adds a standalone-worker AST and runpy test.
    • check_installed.py adds an installed-wheel launch probe, run from an unrelated cwd, that exercises the real worker subprocess.
    • test_cannbot_boundaries.py is repointed at the canonical modules.
    • The test_contracts_package.py change adds __file__ to the exec namespace, which fits Path(__file__) now being used at module import.

Non-blocking notes:

  • Private-helper patches against the legacy inferrsi.apps.cannbot.project path, such as _run or _WORKER, no longer reach the implementation. The docs state this. I only saw the test files in this diff, so a repo-wide grep for other legacy-path private patches is worth doing.
  • operation = "read" if system == "cannbot" else "call" in the launcher test is parametrized scaffolding for a MindIE follow-up. It is harmless now.

Not verified here: I did not execute pytest or check_installed.py, and I did not check CI status or wheel contents. Merge still needs the ruleset's other qualifying approval and green CI. This was a Dong-bot (authorized delegate) review.


Posted by Dong-bot, an automated agent acting on behalf of @Dong1017 (always-on-bot, model claude-sonnet-5-5).

Copy link
Copy Markdown
Contributor Author

已补充当前 2045c0fe315ebb1ab0c6e5203b502b2ddf4d499d 的仓库级扫描,响应检视中的非阻断建议:

  • 检查 src、tests、tools、plugins 和 docs 中 Python/Markdown/JSON 的旧 inferrsi.apps.cannbot 路径、旧 CLI 相对导入及旧 worker 文件引用。剩余匹配仅为迁移表的 4 个兼容身份字段,以及 test_apps_module_migrations.py 的旧包导入顺序探针。
  • 没有发现其他旧路径私有 helper patch。现有 _run、_card_bytes 和 worker 常量补丁都从 inferrsi.apps.integrations.cannbot 导入 canonical 模块;迁移套件的全树 active-consumer AST 检查也已通过。
  • 不改 head,保留当前审批。三个插件串行结果已补正文:57 passed,1 条原有 tarfile 弃用警告。当前 CI 安装/浏览器/引用及两宿主 advisory 已成功,两项 full-check 仍在运行。

Dong1017 已正式 Approve,首行 LGTM,当前仓库 permission=write,是首份有效独立批准。@david6666666 @amy-why-3459 请对本 head 独立检视并提交正式结论;满足第二份有效审批和必需 CI 后再 squash 合入。

Copy link
Copy Markdown
Contributor Author

@david6666666 @amy-why-3459 当前 head 2045c0fe315ebb1ab0c6e5203b502b2ddf4d499d 的 Ready CI 与 knowledge-model-policy 已全部通过;Dong 已完整读取差异并正式 Approve(首行 LGTM,write 权限已核实),当前有效审批 1/2。请其中一位完成独立检视并提交正式结论;可接受时 review 首个非空行单独写 LGTM。目前没有待处理的代码检视意见。第二份有效审批到位后即 squash 合入,再提交已准备好的 MindIE 切片。

Copy link
Copy Markdown
Contributor Author

@david6666666 @amy-why-3459 按请求方的持续推进安排再次跟进:截至 2026-11-19 18:09 UTC,当前 head 2045c0fe315ebb1ab0c6e5203b502b2ddf4d499d 自必需 CI 全绿后已超过 1 小时,没有新增正式审批。

最新核对:

  • Dong1017 正式 Approve,首行 LGTM,当前 permission=write,计 1/2;
  • Ready run 44571267190 全部成功,knowledge-model-policy 为 success;
  • 无 inline 未解决讨论,也无新增代码阻断;
  • 两位的检视请求仍待处理,当前 permission 分别为 admin / write。

请其中一位独立检视并记录正式结论;可接受时提交 Approve,首个非空行单独写 LGTM。有意见请直接指出,先处理问题。第二份有效审批到位即可 squash 合入;后续 MindIE 切片和最终固定记录验收已在独立本地分支准备,按依赖继续交付。目前不越过两份有效独立审批条件合入。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:harness Harness module: profile, A/B loop, quality gates, evidence reports kind:task Bounded delivery task with a delegated slice

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants