Repository navigation
refactor(periodic_report): fold document schema and visibility vocabularies into one owner - #8832
Conversation
…laries into one owner adapters.py and audience.py each restated the document schema tag and the primary/supporting visibility pair that field_shapes.py owns. Import both decisions from the owner (adapters keeps DOCUMENT_SCHEMA importable for its four external readers), and extend the existing owner guard with census-by-value, identity, wiring and retired-local-name checks for the two new decisions. Signed-off-by: 2430468136 <130272264+2430468136@users.noreply.github.com>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
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
动机
影响周期报告生成、受众匹配、归档和 HTML/Markdown 渲染的使用者。同一份 v0 文档通过来源规范化、受众选择、旧导入与两个渲染器。三组有效策略、七个非法输入及两个渲染结果在基线和候选一致。本次验收覆盖本地合成与报告规划。外部发送和部署继续由既有授权流程管理。报告 adapter 与 audience 分别定义 document schema 和 item visibility,未来增删一个值需要两次同步。
改动思路
把文档 label 和 visibility 收到现有 field_shapes。用 adapters 的 schema re-export 支持已有四个调用方。本次验收覆盖本地合成与报告规划。外部发送和部署继续由既有授权流程管理。沿用既有 schema、成员资格与消费顺序。对照真实入口和已经发布的格式,并用隔离安装核对导入依赖。现有值域的 owner
具体改动
one-report-vocabulary已实现。field_shapes 持有文档标签与 visibility。两个真实规范化路径保持原输入、默认和拒绝。对应代码preserve-existing-readers已实现。bindings、archive、HTML 与 Markdown 继续通过 adapters 读取标签;隔离 wheel 的产物与基线逐字一致。对应代码same-audience-scope已实现。缺省、仅 supporting 及双 visibility 分别匹配 2、1、3 项,七个非法输入沿既有校验拒绝。对应代码
关键代码讲解
DOCUMENT_SCHEMA、ITEM_VISIBILITIES 持有已有 v0 标签和两种可见性。_normalize_item 规范化来源条目并验证其 visibility。normalize_periodic_report_audience_policy 按同一个已声明值域验证受众策略。实际消费路径
语义与 CI 对齐
架构基线 1842 通过、候选 1851 通过。两项同条件失败。报告链路两边均为 647 通过、9 项同标识及诊断失败,涉及旧 Goal activation、DSH 重放和 Goal Channel stop。词汇 drift 输出逐字一致。Ruff 与完整差异检查通过。实际比较基线 8ade78cddeb6bdcd947c0a81507393c4599c7652,对应 loopx/capabilities/periodic_report/README.md。基线规范
对主干的风险
受众计划依 typed owned_domains、item 规则与 visibility 选择符号身份,结果不扩大外部交付范围。来源和受众拒绝未知 visibility,受众与渲染器拒绝伪造的 v1。缺标记的 supporting 内容仍触发原错误。对照使用本地合成输入和隔离 wheel。实发 Lark 或部署不在这一轮的验收范围。基线与当前主干的合并树均已核对。现有输出、历史入口与失败情况在源码和独立安装路径分别读回。
我的整体评价
当前提交 762b50f8b2788afa7a1cb3bbc8eb27984ffd7283 通过独立代码评审。复用 field_shapes,保住 adapters 的兼容导入,按原产品入口核对两个消费者。三组有效策略、七个非法输入及两个渲染结果在基线和候选一致。局部闭集由一处维护,实际消费者的兼容与边界经过同条件对照。
English verdict: APPROVE | Exact head 762b50f8b2788afa7a1cb3bbc8eb27984ffd7283. Document, visibility, audience planning, and installed renderers match the baseline. The nine known report failures reproduce on both revisions.
Goal And Delivered Outcome
loopx/capabilities/periodic_report/field_shapes.pyis the declared owner of the capability's closed field vocabularies. Two decisions were still restated by consumers:adapters.pydefinedDOCUMENT_SCHEMAand_ITEM_VISIBILITIES, andaudience.pydefined_DOCUMENT_SCHEMAand_VISIBILITIES. One decision had three owners, so a renamed or value-drifted copy would let the validators disagree about the same payload fields undetected.field_shapes.py(DOCUMENT_SCHEMA,ITEM_VISIBILITIES), the consumers import the owner objects, and the extended owner guard fails if any second definition reappears anywhere in the package (see theunitandregression_parityrows).main.Author Declaration
Implemented against
field_shapes.DOCUMENT_SCHEMA;adapters/audienceimports;adaptersre-exporttests/architecture/test_periodic_report_field_shapes_owner.pyfield_shapes.ITEM_VISIBILITIES;adapters/audienceimportstests/architecture/test_periodic_report_field_shapes_owner.pytests/architecturesuite on both a pristine base worktree and the head worktree and compared failure sets; ran three mutations against the guard; ran ruff, the public-boundary scan, and the semantic-vocabulary drift smoke. Deliberately keptadapters.DOCUMENT_SCHEMAimportable as a plain re-export (four external readers: bindings, archive, and the HTML/Markdown renderers) and did not touch schema tags owned by other capabilities.Scope And Continuation
field_shapes.pyalready owned are unchanged.Validation
unitpassedpython -m pytest tests/architecture/test_periodic_report_field_shapes_owner.py— 34/34 passed; census-by-value for the schema string and the visibility set (including reordered copies), identity, wiring through the adapters and audience faces, re-export identity for the four external readers, retired local names, with positive and negative controls.regression_paritypassedtests/architecturebase 2 failed / 1842 passed, head 2 failed / 1851 passed; the 25-file periodic_report capability/presentation/extensions subset base 9 failed / 491 passed, head 9 failed / 491 passed. Failure sets byte-identical (pre-existingtest_content_digest_single_ownerandtest_posix_flag_portability, plus 9 pre-existing pending-intent / turn-replan / goal-channel-delivery cases); the +9 are exactly the new guard tests. Three mutations each caught: restored schema literal copy in audience → census + retired-names; reordered visibility copy in adapters → set census + retired-names; divergent visibility copy in audience (dropssupporting) → policy and document wiring + use-beyond-import + retired-names. Dependency-lock and top-level-module-budget invariants pass on head (7/7).staticpassedpython -m ruff checkclean on all four changed files.real_entrypointpassedloopx check --scan-path <changed files>reportspublic boundary scan clean: 4 files; the unrelated registry-goal error reproduces identically on the pristine base.integrationpassedpython examples/semantic-vocabulary-drift-smoke.pyreportsokwith byte-identical budget lines between base and head; the schema tag stays a single definition (moved) and the visibility pair is a new single-definition name, so no ratcheted collision budget moves.staticnot_runmypyis not installed in the local environment; no changed file is in the pinned mypy scope (pyproject.toml[tool.mypy]files) or the Todo CLI adapter gate, so the CI type gates are unaffected.adaptersitem normalization,audiencedocument and policy faces); the guard exercises both faces with in-set and out-of-set values and pins the four external re-export readers by identity. The fulltests/tree was not run locally — scope wastests/architecture(complete) plus the 25-file periodic_report capability/presentation/extensions subset; the pre-existing failures reproduce on the pristine base. No UI impact.Frontend / Visual Evidence
Type of Change
LoopX Area
Technical Direction
Shared-authority RFC fixture impact
Boundary Checklist
none.Signed-off-bytrailer (git commit -s).