Repository navigation
state_projection: single-source the backlog-hygiene bullet grammar - #8638
Conversation
active_state_projection.BACKLOG_HYGIENE_BULLET_PATTERN is the compiled grammar for a Next Action / Operating Lessons bullet (^\s*(?:[-*]|\d+[.)])\s+(.+?)\s*$). state_projection restated the identical regex as its own BULLET_PATTERN and used it in _section_entries to split the Next Action section into entries. state_projection already imports SECTION_HEADING_PATTERN from that very owner module, so borrowing one more compiled pattern adds no import edge and cannot cycle. BULLET_PATTERN is retired and _section_entries now matches against the owner; the re import stays because PRIORITY_PATTERN and the Next Action executable/user-wait regexes still use it. The owner's SECTION_HEADING_PATTERN and the consumer's PRIORITY_PATTERN are different grammars and are left untouched. Two existing machines miss this copy. The by-name semantic inventory only catalogues UPPER_NAME carriers and would not pair two differently named bindings; the status-facade vocabulary-owners machine is also name-keyed, so a copy renamed to BULLET_PATTERN slips past it. That machine is extended here to record state_projection as an importer of the owner name, and a new guard keys on the compiled pattern literal -- a whole-tree census, identity for the consumer, retirement, the distinct neighbours, and behavioural parity through the public active_state_next_action_entries gate (marker stripping, non-bullet passthrough and continuation grouping), so a renamed restatement or a silent grammar change fails. Refs loopx-project#4447. Signed-off-by: psychologister <230141834+psychologister@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 · max
本次评审对应提交 94d11ba07c06ee54cb4274d3c0244a98cde10f05。
无阻塞发现。移除了 Next Action 的重复正则;实际 SQLite status 与 refresh 在相同输入上的输出保持一致。
动机 / Motivation
看 Goal 状态的维护者与修改 Markdown 投影的贡献者。状态读取用两份相同的 bullet 正则:Next Action 自己编译,积压提示走 status owner。只改一处时,两边可能对同一条工作给出不同解释。Next Action 改用同一个编译后的语法。真实 status 与 refresh 对同一 SQLite Goal 的输出保持一致;生产包少了一份直接编译的副本。验证源码 CLI、真实隔离 SQLite 与测试约束。没有产品 UI、线上 CI 或安装态改动;静态守卫只覆盖包内直接传入同一字面量的 compile 调用。
改动思路 / Approach
同域语法已经有一个 status owner。直接 import 依赖于已有 import edge,只有编译来源变化。保留 Next Action 的条目聚合与 backlog hints 各自的用途;不引入新的生产抽象。 现有依赖已指向 status owner;继续用该模块的编译对象,不增加依赖环。 现有语法 owner Next Action 导入
具体改动 / Changes
关键代码讲解
条目解析 保持续行、注释、普通文本及排序的原分支,只替换 .match 的来源。 新增守卫 检查包内直接编译同一 literal,facade 测试登记了 state_projection。三个文件均核对;真实 diff 基线是 ea67e68,当前 main 在三条路径上没有交叠。
以 ea67e68 的 docs/development/README.md 为准,按 工程范围 和 #4447 的同域减重复来判断。single_grammar_owner 对应保留一个编译来源,native_status_parity 对应真实状态与 refresh,narrow_scope 对应优先级、待办权威和提示义务保持原边界。
对主干的风险 / Risks
PASS。相同 SQLite Goal 的状态 CLI 在两版显示相同前三条,refresh 保留相同八条,含 Unicode 编号、续行和缺空格的普通文本。混合输入两版各给 7 条提示;只含 Operating Lessons 的有效提示两版均为 2 条。普通回顾不变为待办。两份输入原文均未改写。
语义与 CI 对齐
PASS。共同的 34 项在 base/head 都通过,head 含 guard 共 67 项,标准 premerge 通过。直接 literal 检查在 base 的消费方找到一处,head 零。该检查只覆盖直接传入字面量的 compile 形式;不将其当作通用语法来源分析。托管 CI 未查询。
我的整体评价 / Verdict
代码评审通过。此次已经合并同一词法 owner,保留两个实际消费者各自的输出。今后出现动态或别名复制的真实用例时,再决定是否扩展现有 guard。本次评审覆盖现有宿主与 CLI 行为。验证源码 CLI、真实隔离 SQLite 与测试约束。没有产品 UI、线上 CI 或安装态改动;静态守卫只覆盖包内直接传入同一字面量的 compile 调用。
English verdict: APPROVE. At 94d11ba, the shared grammar removes the duplicate compilation and preserves exact native status, backlog hints and refresh output for the matched SQLite cases.
active_state_projection.BACKLOG_HYGIENE_BULLET_PATTERN is the compiled grammar for
a Next Action / Operating Lessons bullet (^\s*(?:[-]|\d+[.)])\s+(.+?)\s$).
state_projection restated the identical regex as its own BULLET_PATTERN and used it
in _section_entries to split the Next Action section into entries. state_projection
already imports SECTION_HEADING_PATTERN from that very owner module, so borrowing
one more compiled pattern adds no import edge and cannot cycle. BULLET_PATTERN is
retired and _section_entries now matches against the owner; the re import stays
because PRIORITY_PATTERN and the Next Action executable/user-wait regexes still use
it. The owner's SECTION_HEADING_PATTERN and the consumer's PRIORITY_PATTERN are
different grammars and are left untouched.
Two existing machines miss this copy. The by-name semantic inventory only
catalogues UPPER_NAME carriers and would not pair two differently named bindings;
the status-facade vocabulary-owners machine is also name-keyed, so a copy renamed
to BULLET_PATTERN slips past it. That machine is extended here to record
state_projection as an importer of the owner name, and a new guard keys on the
compiled pattern literal -- a whole-tree census, identity for the consumer,
retirement, the distinct neighbours, and behavioural parity through the public
active_state_next_action_entries gate (marker stripping, non-bullet passthrough and
continuation grouping), so a renamed restatement or a silent grammar change fails.
Refs #4447.
Signed-off-by: psychologister 230141834+psychologister@users.noreply.github.com