Repository navigation
test(architecture): pin package imports of loopx internals - #6423
huangruiteng merged 3 commits into
Conversation
The monorepo-distribution-split RFC says a co-located package registers through CapabilityRegistry and never imports kernel-private modules, and its Section 9 row relied on "review of packages/*/src" to prove zero violations. Three packages already import 13 loopx modules, including control_plane internals, and nothing stopped a fourth. Pin the current edges exactly, following test_top_level_module_budget: a new package -> loopx import fails with the RFC rule in the message, and a retired edge must lower the pin in the same PR. The scan is an AST walk over packages/*/src including function-body imports. Both RFC mirrors now cite the executable check and state that the pinned edges are the M4/M5 backlog, not a sanctioned surface. Signed-off-by: song <liusongstep@gmail.com>
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · gpt-6.1-sol · OpenAI · runtime_reported · xhigh
Exact head: 6d904a0. REQUEST_CHANGES — P2,保留原里程碑的零违规验收条件。
动机
维护可独立安装扩展的开发者,需要防止包继续依赖内核私有实现。现在三个包已有十三条不同的 loopx 模块依赖,没有可执行检查阻止新增。本次 guard 确实能拦住新增边并要求清理已退役的 pin,但同时把 RFC 的终点条件从“零违规”换成“不得新增”,会把仍有十三条依赖的绿色结果当作原里程碑验收。无新增保护有用,原十三条迁移与独立发行版资格仍未完成;本 PR 应保留这个差别。不改生产模块或安装布局,不宣称完成 M4/M5、零私有依赖或独立发行版资格。
改动思路
AST 扫描放在现有 architecture tests,覆盖 packages/*/src 下函数体内的绝对 import;fixture 钉住当前 module 集合,新增或已移除但未降低 pin 都失败。它与 top-level module guard 的所有权和成本相称,不需要新增生产扫描器。静态检查不覆盖动态 import,也没有区分所有未来公共 API 与私有模块,不能拿这张快照代替发行版隔离验证。
这是一段可独立交付的中间保护,剩余终点应继续由原 M4/M5 和相关决定持有。最小修正是把“无新增”作为独立 interim guard,保留原 conformance 的“零违规”;无需在这一个 PR 强行迁移十三条边。原测试逻辑与 fixture 已足够局部,未来重构检查没有发现值得新增的通用框架。
具体改动
完整范围为四文件 +160/-2:两份 RFC 镜像、一个 JSON fixture 和一份百行测试;loopx/apps/packages 生产字节与 common base 相同。规范依据 docs/architecture/rfcs/monorepo-distribution-split-v0.md @ 70bc981:5. Proposed architecture 的内核单 owner/禁止私有依赖目标 deferred,已明确原十三条仍是 M4/M5 迁移积压;9. Validation and acceptance 的 No kernel truth duplicated 当前 not_met,原因是 required-result 被替换,见 P2;Document map and maintenance contract 的英中镜像一致 implemented,两侧都发生相同变更。
关键内容讲解
- _loopx_imports 用 ast.walk 覆盖嵌套及 alias,仅计算绝对 loopx module 依赖;relative/local import 不属于该 guard。
- _observed / _pins 汇总到 package→module set,读取 schema、完整 baseline SHA、去重排序。独立枚举不可变 base 的真实源码,确认与当前扫描及 fixture 完全一致:三包、十三条不同 module 边,不是十三个 import 语句。
- test_packages_import_exactly_the_pinned_loopx_modules 分别拒绝新增边和已消失的 pin。真实复制包树加入嵌套 loopx.quota import、删除已有 jev entrypoint import,两次都准确拒绝,恢复后通过。
- Section 9 L272 改的包括 Required result,并非仅 Evidence 列;Appendix A L357–361 的“仍以零为目标/无规范影响”没有保住原可执行验收条件。
对主干的风险
[P2] 保留零违规验收,把当前 ratchet 明确为中间保护。 RFC 说明第 1–10 节是 durable design/acceptance,L275 又要求以上 conformance rows 用于里程碑。当前十三条依赖全部保留时新 guard 已绿色,L272 却允许这个结果满足原 No kernel truth duplicated 行;M4 的 rows 5–6 和 M5 的 full smoke 引用会因此得到更弱的放行标准。英中两份 Required result 都被改掉,Appendix 的“无规范变化、仅更新证据列”也与 diff 不符。
最小修复:恢复 Section 9 原“zero violations / 零违规”终点,把新增 guard 和三包十三条测量作为独立 interim 约束或证据,明确它不满足 M4/M5 零违规验收,并同步两份 Appendix。如果确实要放宽里程碑条件,应明确记录规范变更与适用阶段,不能声称只替换了证据列。这不是要求本 PR 完成打包迁移,也不新增审批工作流。重验 uv run --extra test python -m pytest -q tests/architecture/test_package_kernel_import_ratchet.py tests/architecture/test_rfc_status_index.py,并人工对照 base/head 的 Required result 和 M4/M5 引用。
语义与 CI 对齐
48 项相关 architecture/RFC 测试、Ruff、diff 通过;canary 4 direct / 11 selected、0 failure/hold。当前零违规终点并未由这些绿色测试证明。新增 fixture schema 是本地测试词汇,不是共享 runtime 协议;检查规则不变成 actor 或权限模型。无新增是测试强制条件,不能把原 required conformance 悄悄改成愿景。既有 inward import guard 与 top-level count 不检查 packages/src 的这些边,因此新增 guard 有独立仓库价值;全队列扫描没有发现同作者重复交付这项相同 guard。没有查询或等待 GitHub CI。
我的整体评价
REQUEST_CHANGES,仅针对上述 P2;guard 与 mutation evidence 本身有效、规模适当。长线维护因阻止新增依赖而改善,但终点验收被放宽;现有安装/运行源码保持不变,没有独立包可用性或采用收益资格。保留原验收并正确标记中间保护后,可以作为完整、有用的 bounded increment 交付。当前不应把生产未变、测试通过或录入十三条 pin 当成原路线图接受标准已达成。
English verdict: REQUEST_CHANGES — 6d904a0. The exact import ratchet works, including added-edge and retired-pin mutations, but normative Section 9 replaces zero violations with non-growth while claiming no normative change. Preserve the original milestone exit and label the new guard as an interim check in both mirrors; no migration of all thirteen edges is required in this PR.48 tests and risk checks pass; they do not establish the original zero-violation condition.
Section 9 of the monorepo split RFC keeps "zero violations" as the required result for "No kernel truth duplicated"; the package → kernel import ratchet is listed as an interim no-growth guard in the evidence column, with the note that a green pin does not satisfy the row or the M4/M5 milestones that cite it while 13 edges remain pinned. Appendix A says the same in both mirrors, so "no normative change" is now accurate. Signed-off-by: song <liusongstep@gmail.com>
|
Addressed the P2 at 55cc22e (docs only; the test and fixture are unchanged).
中文:第 9 节必需结果恢复为“零违规”,ratchet 改列为证据列中的过渡性不增长守卫,并在两份镜像的附录 A 同步说明守卫变绿不满足该行及引用它的 M4/M5。 |
loopx-agent
left a comment
There was a problem hiding this comment.
Review exact head: 6423@55cc22e9c753abcee74316c7d2885dc11f31d0ce
Reviewer: model_agent; model=gpt-6.1-sol; provider=OpenAI; declaration_source=runtime_reported; reasoning_effort=xhigh
动机
维护 co-located capability 包的开发者,需要阻止继续新增对内核的静态依赖。三个包已有十三条不同的 loopx 模块依赖且缺少增长守卫;前次补丁又把原规范的零违规终点改成无新增。当前 head 保留可执行不增长守卫,并恢复英中规范原零违规终点;绿色守卫不再被当成 M4/M5 通过。不迁移十三条依赖、不改变生产源码或发行版布局,不证明动态 import、独立安装或 M4/M5 完成。当前 bounded guard/文档修复已完整;十三条既有边、D1–D4 与 M4/M5 的零违规迁移仍由原路线持有。
改动思路
在现有 architecture tests 用 AST 与精确集合 pin 守住真实包树,复用既有 inward/top-level guard 风格;恢复原 required result 比新建规则或本 PR 强做全迁移更小。本 PR 的边界是过渡性静态依赖增长保护和准确文档,不是发行版迁移或原零违规里程碑的完成。
规范依据为原 accepted RFC:No kernel truth duplicated 的 required result 仍是 zero violations;5. Proposed architecture 的单 owner/私有依赖目标与原 M4/M5 迁移保持 deferred;Document map and maintenance contract 要求英中镜像一致。当前修复只保住原终点,不把十三条现状认定为零违规。
具体改动
完整四文件 +164/-2:两份 RFC 镜像、26 行 JSON pin、100 行既有风格 architecture test。_loopx_imports:26 用 ast.walk 找到嵌套、alias 的绝对 module import;_observed:40 按 package→module 去重排序;test_packages_import_exactly_the_pinned_loopx_modules:66 分别拒绝新增边和已退役却未降低的 pin。fixture 和测试与前次 6d904 blob 完全相同,没有生产源码或安装布局变化。
前次 P2 已修复:逐列读取 en/zh 整行,当前 required-result 与不可变基线逐字一致,旧头则不同;ratchet 移到 evidence 列作为 interim guard,notes 和 Appendix A 都明确绿色不满足该行及引用它的 M4/M5。独立枚举基线真实 package 源码,与当前 AST 和 fixture 一致,实为 3 包、13 条不同 module 边。真实包树副本加入嵌套 alias 的 loopx.quota 被拒,删除 jev.entrypoint 而不降 pin 也被拒,恢复后通过;不是从测试当前输出反推预期。
对主干的风险
48 项 architecture/RFC 测试通过;Ruff/whitespace 与 advisory 后完整语义风险检查通过,canary 4 direct/11 selected 无 failure/hold/skip。没有查询或等待 CI。loopx/apps/packages 的完整 tracked diff 为空,默认行为和关闭路径没有新效果。扫描器是保守的绝对静态 module 约束,不证明动态 import、每条 API 的合法性或独立发行版可用性;新增 pin 的 design decision 仍需评审,报错文本不是机器自动批准设计。
现有 inward import 和 top-level count guard 不守 packages/src 的这些依赖,所以本测试补真实覆盖,没有重复生产扫描器。同作者本轮 8 个开放 PR 是恢复、请求控制、公开扫描、摘要、CI、ZCode 和扩展等不同主题,未发现此 guard 的同形重复批次。新增 fixture schema 是本地测试词汇,不是共享 lifecycle 或权限协议。原零违规是规范终点,无新增是中间机器检查,二者现已明确区分。
我的整体评价
APPROVE。前次 normative drift 已消除,guard 的两个反例仍敏感,完整四文件是有用且可回滚的中间保护。未来改动便利性检查认为现有测试 seam 足够局部,不需要再抽象或在本 PR 强做十三条迁移。M4/M5、D1–D4、真实独立安装及采用收益仍未完成;本结论仅适用于当前精确头,合并门禁另行读回。
English verdict: APPROVE - 55cc22e; both normative zero-violation cells are restored, with the ratchet explicitly interim. Independent3-package/13-edge inventory, added/retired-edge mutations,48 architecture tests and4+11 risk checks pass; production trees are unchanged. M4/M5 and distribution qualification remain open.
Signed-off-by: song <liusongstep@gmail.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=xhigh
动机
维护包与内核边界的开发者需要知道,新包或函数内部是否悄悄增加了内核私有依赖,已退役依赖是否仍被旧清单保留。
原来第四个包新增私有导入不会被这条边界检查拦住;当前会指出新增模块边,删除旧导入却不降低清单也会失败,同时最终“零违规”要求保持。
当前三个包的 13 条模块边准确匹配;真实源码副本新增函数内导入及遗留清单反例均被拒绝,恢复原源码后再次通过,生产实现没有改动。
这是架构维护守卫,不把既有 13 条依赖合法化,不认证动态导入、同模块内新增私有符号或独立分发验收。
原 RFC 的 M4/M5 迁移仍需消除既有依赖并取得原要求的证据;绿色 pin 不满足“零违规”行,源码与 pin 同改仍须已有设计评审。
改动思路
把现存私有导入作为迁移积压,用既有 pytest 架构测试约束它不能悄然增长,退役时同步降低清单;规格中的零违规仍是最终要求。这样能交付独立有用的维护增量,避免把“现在已有依赖”变成新公共 API 或最终验收。完整四文件 +164/-2 包括本地 AST 检测、26 行清单与两份 RFC 镜像,loopx/apps/packages 生产代码相对最新 main 没有改动。现有顶层模块预算和向内导入检查未覆盖这条 packages/src 精确模块边;复用架构测试即可,无需运行时策略或新框架。
具体改动
精确 head:94e978ac5f219dacdc4480ded30713698e70cbf4。不可变变更前规格 spec_ref=docs/architecture/rfcs/monorepo-distribution-split-v0.md,spec_revision=3593cf17dada74b807719ba4fdbbb1738fa0a56c。
-
5. Proposed architecture:deferred,包经 CapabilityRegistry 且不依赖内核私有模块的目标不变,已有迁移仍属 M4/M5。 -
No kernel truth duplicated:deferred,Required result 保留原文 zero violations/零违规;13 条既有边意味着此行尚未满足。新增守卫只位于证据与解释栏,不把 green pin 视作该行或 M4/M5 完成。 -
Document map and maintenance contract:implemented,两份独立语言镜像的 Notes、证据与 Appendix A 都说明相同的过渡边界,Required result 与基线逐格相同。 -
_loopx_imports:ast.walk 收集绝对 ImportFrom 和 Import,包括函数体与别名;相对导入不被误记成内核模块,聚合为包到模块的去重集合。
-
_pins:校验本地 pin schema、完整 baseline SHA 与排序去重列表。固定修订是库存来源,不是设计批准或长期公共 API。
-
test_packages_import_exactly_the_pinned_loopx_modules:新增依赖报出设计边界,已消失的 pin 必须在同一 PR 降低;三个实际包的 13 条不同模块边与独立 AST 盘点一致。另一个小测试覆盖嵌套、别名及相对导入。现有全测试工作流会收集它,无需新增任务调度或用户配置。
对主干的风险
聚焦 ratchet 与 RFC status 测试 15 项通过,完整架构套件 1,495 项通过、零跳过,ruff 通过。独立反例在实际包源码副本中执行精确当前测试:第四个包的函数内新增 loopx.quota 被拒绝;删除现存 jev entrypoint 却不降低 pin 被拒绝;单独增加无源码边的 stale pin 被拒绝;原始与恢复的源码通过。没有修改原工作树。源码与 pin 同时扩张仍会机械通过,这清楚表明它不能自动证明设计评审,也不构成本 PR 声称的权限;该评审继续依现有规范执行。动态 import 与同一既有模块内的私有符号增长未覆盖,未冒称整个内核隔离已验收。
语义与 CI 对齐
先运行开发期 advisory,再做完整四路径 premerge:4 项直接、11 项选择检查均实际通过、零失败/人工 hold,包含全树语义及真实候选路径公开边界。新的 pin schema 是本地测试词汇,没有扩展共享运行时闭集。最初使用错误 RFC 测试路径的命令零收集、exit4,随后正确路径与全套结果才是当前证据。三份 PR 独有提交均 DCO 签署。最新 30 个同作者 PR 的边界比对未发现重复此守卫的批量脚手架;扫描器、摘要 owner 等相邻工作验证不同不变量。没有查询、轮询或等待远端 CI。
我的整体评价
APPROVE 这个维护增量。旧评审指出的最终要求被弱化问题已经逐格核实修复;当前未依赖另一份指向旧 55cc 的批准。未来方向检查选择保留小而内聚的现有架构测试,避免为单个边界搭框架;后续真实依赖退役在同一清单降低库存即可。此 PR 不关闭原 RFC 的迁移或分发验收。发表后另做旧发现 closeout 与 readiness 回读,不从绿色测试或批准推断 merge、dismiss 或消除未核实异议的权限。
English verdict: APPROVE 94e978ac5f219dacdc4480ded30713698e70cbf4 as a durable interim package/kernel import guard. Current-source mutations verify additions and retired pins; all 1,495 architecture tests pass. Both normative required-result cells retain zero violations, and 13 pinned edges remain M4/M5 migration backlog. Static module coverage and pin/design-review limits are explicit; full distribution qualification and merge authority are separate.
Goal / source
docs/architecture/rfcs/monorepo-distribution-split-v0.md§5: a capability package "may only register providers, capability contracts and CLI subcommands throughCapabilityRegistry; it never imports kernel-private modules." §9 proves this by "review ofpackages/*/src" with required result "zero violations".Current gap
An AST scan (including function-body imports) finds 13
loopx.*imports in 3 packages today:loopx-ark-turnloopx.file_lock,loopx.control_plane.turn_driver.host_candidate(and does not declareloopxas a dependency)loopx-finance-value-discoveryloopx.extensions.lark.presentation.message_card,loopx.extensions.presentationloopx-jevcontrol_plane/capabilitiesmodules plusloopx.entrypoint,loopx.file_lockNothing prevents a fourth package from doing the same; the RFC row's "zero violations" is a target, not the measured state.
Observable result
tests/architecture/test_package_kernel_import_ratchet.py+package_kernel_import_pins.jsonpin the current edges exactly, followingtest_top_level_module_budget(schema, full baseline sha, ratchet-only).from loopx.quota import …to a package →co-located packages gained imports of loopx internals: {'loopx-text-stats': ['loopx.quota']}(verified).loopx.entrypointimport →pinned package imports no longer exist: {'loopx-jev': ['loopx.entrypoint']}(verified).Validation
Refreshed head
94e978ac5f219dacdc4480ded30713698e70cbf4includes main3593cf17dada74b807719ba4fdbbb1738fa0a56c; the PR still changes only the four docs/test paths. The 15 targeted tests pass. The fullcli-output-budget-regression-smoke.pyalso passes against that exact main base with unchanged thresholds. The earlier CI event compared against70bc98198, before mainline output changes; hosted kernel static checks and dashboard browser shard 3 now pass on this head. The Windows migration failure remains tracked by #6463, and other queued checks are still pending.2 new tests pass;
test_rfc_status_index.py(RFC mirror/index guard) + new test: 15 passed. ruff clean. Test + docs only; no runtime change.Rollback
Revert the PR-specific changes; the base-sync merge does not add a new product change.