Skip to content

feat(cli): discover registered Goals with scoped search and paging - #9431

Merged
huangruiteng merged 3 commits into
loopx-project:mainfrom
steven-kid:roadmap-auto/20261125-registry-goal-discovery
Nov 26, 2026
Merged

huangruiteng merged 3 commits into
loopx-project:mainfrom
steven-kid:roadmap-auto/20261125-registry-goal-discovery

Conversation

@steven-kid

@steven-kid steven-kid commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

Operators with many registered Goals currently have to read the entire registry result and copy an ID before using Goal-specific commands. Add scoped Goal discovery to this existing read-only diagnostic command: exact --goal-id, normalized literal --query over ID/repo/domain/status/adapter kind, and --limit/--offset applied after filtering. A 31-Goal example with matches at positions 3, 17 and 28 now returns the matching first page and an explicit continuation offset instead of hiding late matches behind an unfiltered page.

This advances the overall roadmap's scoped-discovery-before-manual-IDs direction at the CLI operator boundary. It does not add domain state, change routing authority, follow source registries, or claim reduced scan cost. The existing registry inspection remains the owner; the new helper only selects its displayed rows. With no options, JSON and Markdown retain the existing behavior. Selection preserves full-registry counts, diagnostics and failing exit status; duplicate IDs or unrelated invalid Goals cannot look healthy because they were filtered out. Documentation describes pagination, exact-ID errors, empty search results, and global versus selected counts.

Validation on base f37e1c6589dd43cc80049c0d187fb86abdc9f33c:

  • python -m pytest tests/cli_commands/test_registry_discovery.py tests/cli_commands/test_project_registry.py -q: 86 passed. New tests exercise the shipped loopx.entrypoint subprocess, filter-before-pagination, exact-ID/query interaction, Unicode/literal queries, empty/invalid selections, unchanged files, global-local registry references, and duplicate/unrelated diagnostics in JSON/Markdown.
  • python -m pytest tests/test_cli_entrypoint.py -k registry -q: 28 passed, including compatibility between selected and full dispatch.
  • Ruff on all changed Python files passed; configured mypy passed (17 source files); git diff --check passed.
  • Standard loopx canary premerge --from-git-diff --git-diff-base f37e1c6589dd43cc80049c0d187fb86abdc9f33c: direct checks 4/4, compilation, catalog 4/5, risk smokes 8/8 and public-boundary scan passed. The sole catalog failure is the existing heartbeat_prompt_brief/json output budget: 11,951 characters versus 11,400. The identical smoke failure was independently reproduced in a clean worktree at the exact base.
  • Broader tests/test_registry_git_probe.py run: 4 passed, 3 failed. All three failures (no-marker probe, unavailable Git, process-tree timeout) independently reproduce unchanged at the exact base; this PR changes only Markdown rendering in registry.py, not the Git probe. These existing failures remain unresolved here.
  • Final staged quick premerge passed direct checks, compilation, maintainability, semantic vocabulary and public boundary; its only failure was the same independently reproduced output budget above.

Linux cloud validation only; no CI-all-green claim, production deployment, or platform-specific integration claim. Pagination assumes the registry remains stable between requests; a changed snapshot may shift offsets. This is a CLI diagnostic extension to the existing inspection journey, not a new frontend/domain capability.

Exact-head refresh on 2026-11-26:

  • Tested revision: 9502c773358ddfc688a62480b6d491b9f043e9c1 on current main at 508c2d358c7024d6b891eca6dd748a8b53c4d061.
  • Revalidated the previously fixed unknown-Goal diagnostics path in JSON and Markdown; 41 passed, 272 deselected in the focused registry CLI suite.
  • Ruff passed on all changed Python files; standard premerge passed all 14 selected checks after installing the repository-declared npm dev dependencies.
  • The unresolved historical P2 thread is covered by the current implementation and interaction regression and will be resolved separately after this exact-head readback.

Signed-off-by: Yuchao Wang <stevenkid404@gmail.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.2-sol · OpenAI (runtime_reported, xhigh)

[P2] 未知 Goal 的默认输出隐藏已发现的 registry 诊断。 registry 可读但含全局配置错误,操作者用合法的 --goal-id 参数选择一个不存在的 ID。 主干完整输出、本头已知 ID 的 Markdown 和未知 ID 的 JSON 均显示无关 Goal 缺 state_file。未知 ID 的 Markdown 只显示 ID 不存在,已有全局诊断被省略。 相关行

动机 / Motivation

使用 registry 命令定位具体 Goal 的操作者仍依靠默认 Markdown 看见整份 registry 的配置异常。 主干诊断会列出整份 registry 的问题,操作者须在其中手工查找 Goal ID。 看见目标不存在的用户可能只改搜索词,忽略同一次操作已经发现的独立配置问题。 检查含 31 个合成 Goal 的 registry。Unicode 规范化查询有三个命中,另有一条无关 Goal 缺 state_file。比较分页、已知 ID、未知 ID 下的 JSON 与默认 Markdown。 三个匹配项先过滤再分成两页,续页定位正确。查询已知 Goal 时,两个格式都保留全局健康诊断和失败退出状态。 查询不存在的精确 ID 时,默认 Markdown 会隐藏已经收集到的全局诊断。 复验用合成 registry 和真实本地 CLI,逐字节确认 registry 未改变。

主干完整输出、本头已知 ID 的 Markdown 和未知 ID 的 JSON 均显示无关 Goal 缺 state_file。未知 ID 的 Markdown 只显示 ID 不存在,已有全局诊断被省略。

改动思路 / Approach

既有 inspect_registry 收集全范围诊断。新 helper 只选可见行。CLI 与 renderer 应保留完整检查数据并标示选择错误。 交付只读 Goal 查询和分页,同时维持 Markdown 与 JSON 的全局诊断范围。未知 ID 的 Markdown 路径仍有缺口。 当完整检查成功读到 registry 时,选择错误也应保留全局计数与问题列表。只有原始 registry 无法读取时才走简短错误分支。加入未知 ID 与全局配置错误同时出现的两格式回归。

具体改动 / Changes

精确头 6c354c6460184e2d6593638100376c5328b8bcf7,目标分支快照 f37e1c6589dd43cc80049c0d187fb86abdc9f33c。5 个文件新增 298 行、删除 1 行。组织方式为既有诊断先运行,新的 helper 投影行,短错误渲染需要区分两种失败。 分叉基线完整 Markdown 按原规则显示问题。本头在正常分页和已知目标时保持这条边界,在未知 Goal 下仅 JSON 保留诊断。

关键代码讲解

  • select_registry_goals。基于完整诊断先过滤、再决定页面;缺失精确 ID 抛出选择错误。 源码

  • 选择错误适配。JSON 保留基础 registry 字段,同时加入选择错误标记。 源码

  • render_registry_markdown。新增分页摘要;同一个 renderer 在看到选择错误时提前返回,略过原 Problems 段。 源码

  • 公开分页说明。声明筛选只缩小 Goal 列表,registry 全局诊断保持完整。 源码

  • REGISTRY_DIAGNOSTICS_ON_SELECTION_ERROR 尚未满足。新选项只改变展示范围,读取成功的 registry 在筛选以及未知 ID 失败时都保留全局诊断。 现有依据

对主干的风险 / Risks

registry 可读但含全局配置错误,操作者用合法的 --goal-id 参数选择一个不存在的 ID。 在完全相同的 registry 上对照主干完整输出、本头完整输出、已知 ID 和未知 ID 的 Markdown,以及同一个未知 ID 的 JSON。 主干完整输出、本头已知 ID 的 Markdown 和未知 ID 的 JSON 均显示无关 Goal 缺 state_file。未知 ID 的 Markdown 只显示 ID 不存在,已有全局诊断被省略。 选择错误与 registry 健康都是既有诊断语义,分页添加的计数仍只描述可见行。 默认 Markdown 和 JSON 都应显示现有全局诊断,选择失败也须继续报告。

语义与 CI 对齐

PASS — 86 项聚焦测试、本地所选的 14 项预合并与 git diff --check 通过。单独运行的同一预算 smoke 在基线和候选都报 11951/11400。 FAIL — 本轮的部分完成或诊断回显反例。 UNVERIFIED — 本轮使用本机 CLI 和合成文件。托管 CI 与其他宿主未查询。

我的整体评价 / Verdict

REQUEST_CHANGES。 过滤和分页运行正确,未知 ID 的默认输出仍丢掉原本应保留的诊断。 交付只读 Goal 查询和分页,同时维持 Markdown 与 JSON 的全局诊断范围。未知 ID 的 Markdown 路径仍有缺口。 当完整检查成功读到 registry 时,选择错误也应保留全局计数与问题列表。只有原始 registry 无法读取时才走简短错误分支。加入未知 ID 与全局配置错误同时出现的两格式回归。

English verdict: REQUEST_CHANGES. Pagination works, but an unknown exact Goal ID hides existing registry validation problems in the default Markdown output.

Comment thread loopx/cli_runtime.py Resolved
Signed-off-by: Yuchao Wang <stevenkid404@gmail.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.2-sol · OpenAI · runtime_reported · xhigh

动机 / Motivation

管理多个已登记目标的操作者只记得项目名或领域,希望找到对应 Goal ID 后继续工作。 之前要读完整清单并人工定位。现在可用已知片段逐页找到较晚的条目,并同时读到整份清单的配置问题。 真实 console 在 38 个合成目标中用 Unicode 等价词找到 3 项,按登记顺序分成 2 项和 1 项,并明确结束。 交付当前所选 registry 的显示过滤。它仍读取并检查完整文件,分页不会减少全库扫描。

改动思路 / Approach

inspect_registry 保持完整检查,select_registry_goals 只计算显示行。 优先复用完整只读检查,不增加专用索引或第二份健康判断。选择统计是短期派生结果。 保留全量诊断,把显示选择放在只读结果之后。

具体改动 / Changes

评审精确头 91e0d5e,基线与规范修订 f37e1c6。全提案涵盖 5 个文件,+334/-2。上一轮提交 6c354c6。前轮未知精确 ID 的默认 Markdown 隐藏了已知全局诊断。本头让已完成检查的错误继续进入全局诊断渲染。
S1-discovery 对应 在要求人工输入 ID 前先进行限定范围的发现。 registry-health 对应 CLI 保留已经取得的原有 registry 诊断。 两项都由独立 console 读回检验。 公开规范

关键代码讲解

  • select_registry_goals 在完整检查结果上过滤并切页。同一输入先归一化并匹配,再分页。文件读前读后摘要相同,默认 JSON 和 Markdown 的正文及退出码与基线相等。 源码
  • _handle_registry_inspection_command 错误选择保留其他读回字段。未知精确 ID 与无关目标缺 state_file 同时出现时,JSON、Markdown 均退出 1,保留全局问题。选中不存在的 registry 时仍得到原始缺文件错误。 源码
  • render_registry_markdown 完成全局检查时继续渲染 Problems。未知精确 ID 与无关目标缺 state_file 同时出现时,JSON、Markdown 均退出 1,保留全局问题。选中不存在的 registry 时仍得到原始缺文件错误。 源码

对主干的风险 / Risks

同一输入先归一化并匹配,再分页。文件读前读后摘要相同,默认 JSON 和 Markdown 的正文及退出码与基线相等。 未知精确 ID 与无关目标缺 state_file 同时出现时,JSON、Markdown 均退出 1,保留全局问题。选中不存在的 registry 时仍得到原始缺文件错误。 本轮 pytest 主验证 395 项通过。源码 premerge 在安装仓库声明的 npm 依赖后,6 项直接检查与 14 项所选检查全部通过。 单独执行输出预算脚本时,精确基线和本头都在 heartbeat_prompt_brief/json 得到 11,951 字符,超过 11,400 硬限。整体 canary 的通过与单跑结果分开保留。 按配置未查询远端 CI。

语义与 CI 对齐

新增术语属于 CLI 调用和显示层,复用原有 registry 状态和决策所有者。前轮发现已修。需要保留已生成的整库摘要和 Problems。

我的整体评价 / Verdict

批准当前精确头。前轮 Markdown 丢诊断的反例已关闭,并实测未选择新参数时的兼容性。 可以从已知片段继续查找下一页,遇到目标不存在仍能同时诊断其他登记问题。 无 registry 写入,仍由原检查决定健康状态。两页间登记内容变化可以移动 offset,文档已说明。 仅源码检出和合成的真实文件系统。未运行实际发布包、应用 UI 或远端 CI。 Registry 编辑会让页间 offset 漂移。

英文简短结论

English verdict: APPROVE. 91e0d5e preserves registry-wide diagnostics for unknown Goal IDs and verifies unchanged unfiltered JSON and Markdown with the real CLI.

Signed-off-by: huangruiteng <huangrt01@163.com>

@huangruiteng huangruiteng 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-5 · OpenAI · self_reported

动机 / Motivation

管理多个已登记 Goal 的操作者通常只记得项目名、领域或片段。旧版 registry 默认返回整份清单,目标稍晚出现时只能人工翻阅并复制 ID。

修复前,31 个 Goal 中位于第 28 位的匹配项会落在无过滤首屏之外;当前 exact head 先按 Goal ID 或归一化文本过滤,再切页,并返回明确的 next_offset。

真实 CLI 子进程能够按 Unicode 归一化片段找到分页结果,未知精确 ID 与无关 Goal 配置错误同时出现时,JSON 和 Markdown 都保留全局计数、Problems 与失败退出码。

本 PR 不跟随 source_registry、不减少全 registry 扫描、不改变健康判定、不增加写操作,也不宣称 registry 在分页请求之间保持不变。

改动思路 / Approach

The implementation keeps inspection and health in the existing registry owner and adds a bounded display-selection projection.

The PR delivers read-only query and paging while preserving the complete diagnostic and unfiltered compatibility paths.

主路径是 loopx registry -> inspect_registry -> select_registry_goals -> print_payload。权威输入为 The complete inspected registry payload and its existing diagnostics,决定边界由 loopx/registry.py owns inspection and registry-wide health; registry_inspection.py owns display-only selection. 持有,结果是 Matching Goal rows are sliced by offset and limit without changing registry files or source registries.,再由 JSON selection metadata, Markdown counts and the existing failing exit status 消费。Selection validation returns an actionable error while the renderer retains complete diagnostics when inspection succeeded.

具体改动 / Changes

按 docs/architecture/rfcs/loopx-overall-roadmap-v0.md 的 revision 508c2d358c7024d6b891eca6dd748a8b53c4d061 核对,S1-discovery / registry-health / default-compatibility 分别对应下面的行为与验证。

关键代码讲解

  • select_registry_goals:Filter an already inspected registry and slice the selected display rows. Before the CLI exposed only the complete list; now exact ID and literal query filters run before offset-based paging.
  • _handle_registry_inspection_command:Connect complete inspection, selection and existing JSON or Markdown rendering. Before the registry command rendered inspection directly; now invalid selection preserves the inspected payload and marks only ok/error/goals.
  • render_registry_markdown:Render complete registry metadata, selection counts and registry-wide diagnostics. Before it returned immediately on every error; now it returns early only when inspection itself lacks goal_count.

变更共 5 files (3 production/CLI paths, 1 documentation, 1 CLI test),334 additions、2 deletions。Add a display-selection helper and CLI options, retain global diagnostics on selection errors, and document pagination and compatibility.

  • S1-discovery:Operators can discover a relevant registered Goal without first reading and copying from an exhaustive list.,当前为 implemented。
  • registry-health:Display selection preserves the complete registry inspection, diagnostics and failure status.,当前为 implemented。
  • default-compatibility:No selection option retains the existing complete JSON and Markdown behavior.,当前为 implemented。

对主干的风险 / Risks

最强回归场景是 A filtering error hides a real registry configuration problem or changes the no-option output.。触发状态为 An unknown exact ID accompanies a separate missing state_file, or the caller omits all selection flags.;Selection preserves the payload; the Markdown early return is limited to an inspection payload without goal_count; the helper returns the original payload when no option is present.。影响范围是 The read-only loopx registry diagnostic command.,可观察性来自 selection counts, goal_count, status_counts, Problems, JSON fields and exit status.,恢复路径是 Operators can omit selection flags for the previous complete output; code rollback restores direct inspection rendering.。

changed_invariant_positive=passed (41 passed, 272 deselected using the shipped loopx.entrypoint subprocess.);material_negative_or_failure=passed (JSON and Markdown retained registry-wide Problems and exit 1; unreadable-source short error remained unchanged.);repository_required_checks=passed (Ruff passed; standard premerge passed all 14 selected checks with 0 failures.);remote_ci_observation=pending (The new exact head has not yet completed hosted CI.)。

  • PASSED · Filter before paging, Unicode normalization, exact/query composition and default complete output.:41 passed, 272 deselected using the shipped loopx.entrypoint subprocess.
  • PASSED · Unknown Goal and unreadable registry keep original failure semantics without hiding diagnostics.:JSON and Markdown retained registry-wide Problems and exit 1; unreadable-source short error remained unchanged.
  • PASSED · Ruff, diff, RFC, maintainability, semantic vocabulary, output budget, risk profiles and public boundary.:Ruff passed; standard premerge passed all 14 selected checks with 0 failures.
  • PENDING · Remote CI for the new exact head.:The new exact head has not yet completed hosted CI.

我的整体评价 / Verdict

长程效果判断为 improved:Operator discovery now scales by Goal metadata while preserving one authoritative full-registry inspection and its diagnostics.。用户体验判断为 improved:The command supports exact and literal discovery, reports global health separately from selected counts, and keeps its original unfiltered behavior.。视觉检查不适用,因为本次没有改变渲染界面或布局。

The helper remains a projection over the existing registry inspection. The historical diagnostic-loss finding is resolved and covered in both machine and human output, while the no-option path stays identical.

English verdict: APPROVE at 9502c77. Scoped Goal discovery filters before paging and preserves complete registry diagnostics, failure status and the existing unfiltered output.

@huangruiteng
huangruiteng merged commit 9b3f5eb into loopx-project:main Nov 26, 2026
10 of 14 checks passed
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