Skip to content

state_projection: single-source the backlog-hygiene bullet grammar - #8667

Closed
psychologister wants to merge 1 commit into
loopx-project:mainfrom
psychologister:codex/state-projection-bullet-pattern-owner
Closed

psychologister wants to merge 1 commit into
loopx-project:mainfrom
psychologister:codex/state-projection-bullet-pattern-owner

Conversation

@psychologister

Copy link
Copy Markdown
Contributor

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

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 loopx-agent 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.

Reviewer: model_agent · gpt-6.1-sol · OpenAI · runtime_reported · reasoning_effort=max
Reviewed commit: 94d11ba07c06ee54cb4274d3c0244a98cde10f05

[P2] 这项改动已合入主干。 对当前 main 执行 git merge-tree,输出树与 main 自身完全一致;每个改动文件在核验的 main 的 Git blob 也与本 PR 相同。对应实现已由 #8638 合入。 见 已合入的 #8638。请将本 PR 标为 #8638 的重复提交;若原改动之外还有缺口,请从最新 main 提交可复现的新差异。

动机 / Motivation

查看目标下一步行动的人和读取积压提醒的自动化,都依赖状态文件里 Markdown 列表项的识别结果。 旧版在状态视图和积压检查中各维护一份相同的规则。若其中一份漏掉 2) 这样的编号,两个视图可能对同一行动作出不同判断;共用规则消除了这个维护点。 复用同一列表标记规则后,短横线、星号和带点或右括号的编号仍按原样被识别,缩进行仍归到上一项。 这份改动只收敛列表标记识别;标题、优先级、积压告警政策和文档格式保持原有含义。

改动思路 / Approach

保留状态模块的列表正则作为规则来源。状态投影原来就从该模块读取标题模式,这一次复用列表模式也沿用同一依赖方向。 状态投影先切出 Next Action 段落,再用共享规则识别项目起始行;缩进行拼接到当前项,无匹配的普通行沿用自己的处理。状态模块的 Operating Lessons 解析与积压告警维持原有入口,两个调用方只共享标记识别。 保留主干上已经共享的列表规则与两种回归检测;后续如有漏识别,应单独给出出错的状态输入和受影响的调用方。

具体改动 / Changes

收敛跟踪项 #4447 要求核对实际重定义。按已接受的 语义词表 RFC(版本 6f563c0e43a923e2e757b23027bad69ec5f9391a)评判:I1 的登记要求不适用于这个未登记的本地正则;这里沿用单一来源的设计。I6 的配套登记条件在本案不触发,输入的含义没有改动。3 个文件;生产 +5/-3,测试 +233/-1。相对于上述核验的 main,净差异为零。

关键代码讲解

  • _section_entries:改用共享正则剥掉列表起始标记,缩进拼接和普通文本处理仍由原函数负责。
  • active_state_next_action_entries:只查找 Next Action 段,并沿用条数和文字上限。相邻标题会结束当前段。
  • active_state_section_entries:状态侧把已有模式传给通用段落解析;积压提醒仍在该模块有自己的条件判断。

架构用例按正则字面值查找重定义,状态所有者测试登记实际导入方;它们守住这个精确规则,而不是把 Markdown 标题或任务优先级都交给同一个解析器。

对主干的风险 / Risks

如果状态解析和积压检查各自改写字符规则,编号项可能只出现在一个结果里,影响下一步和积压提示。本次在分叉基线、PR 提交和用于测试的主干对同一段 Markdown 比较了状态条目、积压提示和诊断,输出一致。标题识别、优先级和状态写入的规则无需调整。 加号、没有空格的短横线和冒号编号保留为普通文本,不误作列表;缺失段落返回空,Operating Lessons 不被串入 Next Action。

PASS:PR 提交和用于测试的主干 dd44cdc 各通过 47 项相关用例;原分叉基线通过 6 项现有入口用例。 PASS:在 核验的 main 上跑 git merge-tree --write-tree,两端树都是 771ec26f038bc63d0db9494a1e06237157d058b6,所有改动文件也分别与已合并版本逐个相同。这次只验证了相关本地用例和 Git 合并结果;未核验托管 CI,也未运行完整预合入套件。

语义与 CI 对齐

复用现有规则,没有新增或扩展词表,也没有将某种输入变成新的权限或执行义务。相应架构和行为测试在主干已存在,并在本轮本地通过。

我的整体评价 / Verdict

分叉以来是生产代码 +5/-3、测试 +233/-1。加入 importer 检查和按正则字面值查重有明确边界,这两项测试已随原 PR 进入主干;这次没有额外覆盖。 长期维护和调用体验都已由原合并保全。active_state_next_action_entries / build_active_state_structured_projection / backlog_hygiene_warning 未更改任何可视界面,核验范围为原有程序入口和输出。 请将本 PR 标为 #8638 的重复提交;若原改动之外还有缺口,请从最新 main 提交可复现的新差异。 若补交实质差异,再以新的精确提交和仍缺失的案例复审。

English verdict: REQUEST_CHANGES — This exact proposal adds no changes to the verified main revision; the implementation and its tests already shipped in #8638.

@NIU-123370 NIU-123370 closed this Nov 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants