Repository navigation
refactor(public-safety): import the remaining identifier shapes from their owner - #6970
Conversation
…their owner
`deletion_service` still compiled the opaque body that `public_safe_text` owns, and `presentation` plus `benchmark_toolkit/integrity` compiled the compact `{0,127}` body. The guard's opaque declaration outlived loopx-project#5854, which merged on 2026-10-07.
Convert all three sites to the owner's object, clear the declaration, and add the missing compact-shape census so a future restatement fails.
Signed-off-by: Zhouyang66639 <236804849+Zhouyang66639@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 — 已核完整提交 4031b53。
维护者修改公共标识语法时,需要分别检查 Goal 删除、扩展展示和 benchmark 完整性三个消费者。此前三个模块仍各自编译相同表达式,修改公共定义后可能留下旧副本,增加后续维护时的遗漏成本。本次让这三个消费者直接使用已有语法对象,并补上重复定义检查。可观察结果是重复定义消失,现有输入、错误和业务处理结果保持一致。本次只收敛语法定义;删除权限、展示隐私规则和 benchmark 资格规则继续由原消费者负责。
改动思路
公共语法已有明确 owner,三个消费者继续拥有各自业务校验,因此直接导入比新建一层验证服务更合适。当前 PR 边界是三处表达式复用、过期例外清理和现有测试中的重复定义普查。
实际调用顺序仍是:删除入口先规范化并检查 Goal id,再检查停止状态和登记关系,最后由原删除服务写入;扩展展示先检查字段和标识,再核对 manifest、内容及 lineage;完整性归约先检查声明语法,再检查 authority、namespace 和 runner 条件。公共表达式只回答字符串形状是否合法,不授予删除、发布或执行权限。选择不修改可以继续运行,但公共语法的下一次调整仍需同步三个副本;只删除测试例外则不能消除这个维护缺口。这里采用已有 owner,未引入新模块、状态、配置或调用步骤。
具体改动
没有独立书面规格。本次判断基于不可变基线 c97f921 的 公共语法定义及其责任说明、已有消费者行为,以及 CONTRIBUTING 的具体维护成果路线。我先读这些基线,再检查补丁;没有把新增测试当作独立规格。
关键代码讲解
- 删除服务的导入和
_require_opaque_id:以OPAQUE_ID_PATTERN替代本地编译,保留 trim、字段名和异常。200 字符的语法上限、停止状态门、锁和恢复逻辑均未改动。 - 展示模块的导入 及
_identifier:复用COMPACT_TOKEN_PATTERN,仍由本模块检查 128 字符、声明的 surface、view schema 和内容。_evidence_reference的 HTTPS 与敏感字段限制保持独立。 - 完整性模块的导入 及
_validated_task_environment_access:复用同一 compact 对象,原 authorization id、authority、purpose、namespace 等拒绝规则没有移动到通用 owner;其他使用该对象的 protocol/channel/adjudication/runtime 声明也保留原业务限制。 - 现有 owner 测试:清空 opaque 例外,为 compact 增加整树字符串普查,并核对三个消费者持有 owner 对象。将当前两个普查施加于实际基线源码时均拒绝重复定义,当前源码则通过。此检查覆盖指定字面表达式,不是所有等价正则写法的语义检测。
完整差异为 4 个文件、+33/-11,其中生产代码 +6/-5,测试 +27/-6。三个生产改动均为复用现有对象;owner 的表达式和 flags 与基线一致。最新 main 的上述 owner 和三个消费者也未发生额外变化。
对主干的风险
主要风险是把“语法相同”误当作“整个消费者结果相同”。为此我对基线和当前头分别执行了同一组实际 API:每版 21 个边界输入,外加 6 个完整展示投影、7 个完整性归约及 3 个删除场景。比较了完整展示/完整性结果与异常;删除使用隔离的合成登记及真实文件写入,比较业务字段和最终登记、数据状态,保留原始路径、指纹及备份差异。
128/129 与 200/201 字符、空值、前导符号、空白、Unicode 和分隔符没有产生差异。停止 Goal 可删除登记且数据保留;活动 Goal 和穿越输入在写入前拒绝。未声明 surface、禁止的 token 字段、错误 authority、越出 namespace 及缺少 runner 条件也保持原拒绝结果。测试中的 runner 声明是合成输入,仅用于归约语义比较,不证明真实运行隔离或 benchmark 得分资格。
独立本地结果:聚焦组 623 passed、7 skipped;扩展发布/读取生命周期与 benchmark toolkit 组 190 passed。原生 standard premerge 完成 6 项直接检查和 14 项选中 smoke,零失败,但整体返回 manual_review_required,benchmark 敏感路径仍需人工合并审核,不能写成合并门已通过。没有查询或等待 CI,也未重跑作者报告的完整 architecture suite;Windows 和新的安装包未另行验证。首次自建 probe 对未列入禁止词集的 password 字段作了错误预期,已保留失败并改用基线明确禁止的 token 控制,产品源码及标准未改动。
语义与 CI 对齐
该改动复用现有共享语法;两个例外表只属于测试,没有新增公共词表、配置或持久化字段。测试普查执行时会硬性拒绝不符的源码分布,不能称作仅供参考的建议;它也不改变运行时授权。风险选择器、语义词表 smoke 和双语 RFC 差异检查均已实际执行,人工合并要求保持有效。
我的整体评价
这是一项完整、有实际消费者的维护收敛。长程工作路径判断为 preserved:原停止门、登记写入和恢复责任、投影 lineage 及完整性资格边界都保留;没有新增同步状态或反复操作。用户体验判断为 preserved:同一输入返回相同结果或可行动错误,已有请求和权限下新增必要交互为零。可证明的是当前边界的行为保持和重复定义消除;尚未测量后续维护时间或长期净收益。
本次已在相邻 owner 内完成有界简化,无需再增加服务、参数或迁移层。公共语法 owner 与业务策略分工清楚,保留既有导入名称和序列化格式即可;未发现需要阻断本提交的正确性问题。批准适用于该精确头,人工合并审核及仓库合并资格仍独立保留。
English verdict: APPROVE 4031b53. The three consumers reuse the existing identifier-shape owner with unchanged behavior in paired production-API controls. Independent local validation: 623 passed/7 skipped plus 190 passed; 6 direct and 14 selected premerge checks passed. The benchmark-sensitive manual merge hold remains. CI was not consulted; no live benchmark execution or merge was performed.
Goal And Delivered Outcome
Outcome basis / optional anchor: the declaration in
tests/control_plane/test_compact_identifier_shape_owner.pyand the same-shape copies it did not cover; same conversion pattern as the merged periodic-report slug PR refactor(periodic-report): import the public-safe slug shape from its owner #6922.Goal/source and gap: the guard declared
deletion_service.pyas an open opaque site "being restructured in fix(goals): fence deletion against canonical writes #5854"; fix(goals): fence deletion against canonical writes #5854 merged on 2026-10-07, so the declaration went stale.presentation.py:48andintegrity.py:159still compiled the compact{0,127}body thatpublic_safe_text.py:345owns, and the compact shape had no tree census (only the opaque body did).Observable before → after, with the validation row that proves it: three private compilations become imports of the owner's object;
OPEN_OPAQUE_SITESis empty; a new compact census fails on any future restatement. Behavior is unchanged because each call site uses the same compiled object.Issue/task and intended base: Related to fix(goals): fence deletion against canonical writes #5854 (merged), refactor(periodic-report): import the public-safe slug shape from its owner #6922 (same conversion pattern), [Bug]: main's Python digest-owner guard fails - goal_source.py and checkpoint_retention.py restate the bare SHA-256 shape #6841 (digest-owner guard); base
c97f921e2.Author Declaration
Implemented against
loopx/public_safe_text.py, and CONTRIBUTING's maintenance-outcome route are the basis.loopx/control_plane/goals/deletion_service.pytest_the_opaque_id_body_is_compiled_only_by_the_owner_and_declared_sitesloopx/extensions/presentation.py,loopx/capabilities/benchmark_toolkit/integrity.pytest_each_contract_holds_the_owners_object_and_reports_its_own_fieldtests/control_plane/test_compact_identifier_shape_owner.pytest_the_compact_token_body_is_compiled_only_by_the_owner_and_declared_sitestests/architecturesuite on base and head (identical failure set),ruff, andgit diff --check. I did not run the Windows lane or the full repository suite.Scope And Continuation
Validation
4031b533054e25c17b5c640fc49973d38458d406python -m pytest -q tests/control_plane/test_compact_identifier_shape_owner.pypython -m pytest -q tests/control_plane/test_goal_activation.py tests/control_plane/test_shadow_native_todo_update_e2e.py tests/control_plane/test_project_registry_m0_contract.py tests/architecture/test_content_digest_single_owner.py tests/presentation tests/capabilities/test_benchmark_study_projection.py tests/capabilities/test_benchmark_behavior_finding.py tests/capabilities/test_benchmark_four_arm_contract.pypython -m pytest -q --tb=no tests/architectureon both treesruff check <changed files>git diff --check