Repository navigation
Conversation
…kdown When diagnose or upgrade-plan fails collection (for example on a corrupt registry), the JSON payload carries the failure reason in error, while render_diagnosis_markdown and render_upgrade_plan_markdown omitted it. Emit - error: <markdown_scalar(error)> right after - ok: when error is present in both renderers. Signed-off-by: Wang, Xiang-Han <[email protected]>
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh
动机 / Motivation
终端用户排查注册表故障时,需要 diagnose 和 upgrade-plan 显示收集失败的实际原因。旧 Markdown 只给通用提示,还须切换到 JSON 才能知道具体失败。候选在 Markdown 的 ok 字段后显示原有错误原因。变更范围是两个命令的失败展示,成功展示和退出码沿用已有契约。当前实现使 upgrade.py 增至 1,065 行,触发 1,062 行预算门禁。
改动思路 / Approach
保留原 handler 生成的错误载荷及退出状态。两个 Markdown renderer 在 error 非空时调用已有的 markdown_scalar。 沿用当前 presenter 层与标量格式化,避免增加处于预算上限的模块。 原命令继续持有读和状态判断逻辑。渲染错误不改变注册表、迁移权限或调度。 变更范围是两个命令的失败展示,成功展示和退出码沿用已有契约。
具体改动 / Changes
审阅提交 214d757,diff 基线 21c6ddf,3 个文件,+35/-1。两个 renderer 使用同一格式化 helper,新增测试沿正常 CLI 入口读取失败原因。目标分支快照为 1bdf851,调用路径与有效 diff 基线一致。diagnose 直接在 ok 后插入错误行,upgrade-plan 还拆开原 bullet 组,因而会多出三行。新测试先取 JSON 的原始 error,再调用同一实际 Markdown 入口查找该文本,没有给收集器预置返回值。 完整 diff 预算触发行
对主干的风险 / Risks
[P2] 保留 upgrade.py 的现有模块行数上限。 该模块在冻结基线为 1,062 行,当前提交增至 1,065 行,导致标准预合并门禁失败。请保留两处可见错误,把 upgrade.py 控制在现有预算内,并重跑 premerge。
实际 console script 在损坏注册表和未迁移 Goal 上保留退出 1 与原 JSON,只增加错误行。健康 Goal 的 diagnose 和空清单的 upgrade-plan 均退出 0,成功 Markdown 与基线逐字一致。 同输入对照可独立复现失败和成功分支。维护预算比对只新增 upgrade.py 的 1,065/1,062 违规,status.py 的 1,343/1,339 在两边一致。 121 项定向和邻近测试、另 5 项 diagnose 契约,以及 Ruff、编译和 diff 检查通过。标准 premerge 的 module_ceiling_colocation 失败。
我的整体评价 / Verdict
REQUEST_CHANGES。 用户可见修复已独立复现。请修复本次引入的标准模块门禁失败后再复核。 本次仅涉及 CLI 与构建输出,没有图形界面需要复核。运行范围为 macOS 和本地合成注册表。
English verdict: REQUEST_CHANGES at 214d757. Both CLI fixes work, but the patch increases upgrade.py from 1,062 to 1,065 lines and introduces a blocking local module-budget regression.
| "", | ||
| *_bullet_fields(payload, ("ok", "registry", "runtime_root", "cli_bin")), | ||
| *_bullet_fields(payload, ("ok",)), | ||
| *([f"- error: {markdown_scalar(payload.get('error'))}"] if payload.get("error") else []), |
There was a problem hiding this comment.
[P2] 保留现有模块行数上限。该提交使 upgrade.py 从 1,062 行增至 1,065 行,标准 premerge 新增 module_ceiling_colocation 失败。基线相同检查只报 status.py。保持错误行和退出码,将 upgrade.py 恢复到现有 1,062 行预算后重跑标准门禁。
…n layer Extract render_upgrade_plan_markdown and its Markdown field helpers from loopx/upgrade.py into loopx/presentation/renderers/upgrade_plan_markdown.py while re-exporting render_upgrade_plan_markdown from loopx.upgrade. This keeps loopx/upgrade.py within its 1,062-line frozen ceiling (959 lines) so module_ceiling_colocation passes while preserving both diagnose and upgrade-plan Markdown error output and existing success rendering parity. Signed-off-by: Wang, Xiang-Han <[email protected]>
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh
动机 / Motivation
使用 diagnose 和 upgrade-plan 排查本地安装及 Goal 状态的操作者。 采集失败的 JSON 有 error,默认 Markdown 只有 ok=False。旧候选显示错误但使 upgrade.py 从 1,062 增至 1,065 行。 真实 CLI 子进程读同一个损坏的合成 registry,两个命令在新提交以退出码 1 取得与 JSON 相同的失败理由。 两个现有终端命令的失败信息和成功输出,升级采集沿用原 owner。 本轮验证本地 macOS 源码入口、合成 registry 与渲染 payload。未执行安装升级,也未触发托管 CI。 上轮预算发现
改动思路 / Approach
将 upgrade-plan 的纯格式化从升级采集分出,并从原模块导出同一函数。两个渲染器沿已有 markdown_scalar 转换失败理由。 两个现有终端命令的失败信息和成功输出,升级采集沿用原 owner。 包含提示警告、安装清单、迁移和 deferred 状态的合成成功输入在两个渲染器均得到逐字相同的基线与新输出。
具体改动 / Changes
精确提交 964e97ef9d141a6c1786bf1385c1686e1b128ae6,基线 1bdf851e9447bc7c22ab29d10948a674bf4687c4。四文件 +221/-106;upgrade.py 从 1,062 减至 959 行。 与当前主干 086afeef45f35034eb4147062bc2e25df41a767f 合成时这四条路径与评审提交逐字一致。依据 docs/development/testing-and-quality.md 核对 错误读回、成功输出和模块预算。 预算规范
关键代码讲解
diagnose 对已有 error 插入一条 Markdown 行。upgrade-plan 复用同一 scalar,并从原 upgrade 模块保留对 Presentation renderer 的重导出。采集和渲染各只有一个 owner。 诊断 · 升级计划 renderer
对主干的风险 / Risks
基线两个命令均退出 1 且 JSON 有理由,Markdown 无错误行。新提交的合成换行和竖线仍整形在一条错误行里。 包含提示警告、安装清单、迁移和 deferred 状态的合成成功输入在两个渲染器均得到逐字相同的基线与新输出。 定向 127 项通过,标准预检和 module_ceiling_colocation 通过,有一项非阻塞维护性建议。 本轮验证本地 macOS 源码入口、合成 registry 与渲染 payload。未执行安装升级,也未触发托管 CI。
我的整体评价 / Verdict
批准。 两项错误显示正常,健康输出和既有导入保留。抽离后的模块重新通过现有上限,旧头的阻断项已在本次精确提交复验。批准范围涵盖这两个终端命令和兼容导出。
English verdict: APPROVE at 964e97e. Both commands surface the existing error in Markdown, healthy renderer output remains byte-identical, and extracting the upgrade-plan renderer resolves the prior module-budget failure.
Goal And Delivered Outcome
diagnoseorupgrade-plancannot collect (for example because the registry is not valid JSON), the payload isok: falsewith the exception text inerror. The Markdown renderers printok, the null fields, and a genericrecommended_action, but omiterror. The default Markdown output therefore reports that collection failed without stating why, while JSON carries the reason.loopx diagnose --goal-id Gandloopx upgrade-plan --goal-id Gomittederrorin Markdown output.- error: <markdown_scalar(error)>directly after- ok: Falsewhenevererroris present, leaving successful output unchanged (unitandreal_entrypointrows below).main.Author Declaration
Implemented against
errorfield (as fix(cli): preserve quota guard diagnostics in Markdown #9112 did forquota should-run).diagnosecollection's Markdown includes the JSONerrorloopx/presentation/renderers/diagnose_markdown.py::render_diagnosis_markdowntests/test_markdown_failure_reason.pyupgrade-plancollection's Markdown includes the JSONerrorloopx/upgrade.py::render_upgrade_plan_markdowntests/test_markdown_failure_reason.pypayload.get("error")is truthymainafter refactor(diagnose): modularize diagnosis projection and markdown renderer with zero AST Any #9482 movedrender_diagnosis_markdowntoloopx/presentation/renderers/diagnose_markdown.py. Kept zeroAnyannotations, routed error text throughmarkdown_scalar, and verified bothdiagnoseandupgrade-plancorrupt-registry paths throughloopx.cli:main.Scope And Continuation
Validation
214d757cdunitpassedtests/test_markdown_failure_reason.py(both commands fail on base and pass on214d757cd; verified on Python 3.13/3.14 prior to rebase and re-verified on214d757cdwith Python 3.15).staticpassedpy_compileandgit diff --checkclean on all 3 files.real_entrypointpassedloopx.cli:mainfordiagnoseandupgrade-planagainst a corrupt registry emits- error: <json error>in Markdown; exit 1.pytest/ruffwill also run on the PR.Frontend / Visual Evidence
Type of Change
LoopX Area
Technical Direction
Shared-authority RFC fixture impact
N/A
Boundary Checklist
.loopx/,.codex/goals/, and liveACTIVE_GOAL_STATE.md).python3 scripts/check_rfc_bilingual.py --base origin/main --head HEADpasses, or no paired RFC changed.none.Signed-off-bytrailer (git commit -s).