refactor(cli): remove superseded settings dialog helpers - #9379
Conversation
…ils-generation-a] The settings utility module carried two generations of dialog API. The dialog was rebuilt on one set of helpers and the earlier set was never removed, leaving thirteen exported functions whose only consumer was their own unit test. One was a character-for-character duplicate of a helper the dialog does use; another wrapped a wrapper. Removes those thirteen with the tests that existed only to cover them, plus the type import they alone needed. Helpers that a naive search also flags are kept: one is still called by live code, and one is named by an in-flight design document as an API it intends to reuse. Behaviour is unchanged. Candidate settings-utils-generation-a from the find-simplifications sweep. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Thanks for the PR! Template looks good ✓ Problem: real and verified, not theoretical. I checked the claim against the base tree: every one of the thirteen removed helpers ( Direction: aligned — removing a superseded API generation that only its own tests exercise is exactly the Simplicity First cleanup Size: not applicable — Approach: the scope is right. One candidate, not a batch, and the three "deliberately kept" justifications each check out: Risk: no elevated risk signals — none of the revert-correlated paths are touched. Moving on to code review. 🔍 中文说明感谢贡献! 模板完整 ✓ 问题:真实且已验证,不是理论问题。我在 base 树上核实了 PR 的论断:13 个被移除的辅助函数( 方向:对齐——删除一代仅由自身测试驱动的已被取代的 API,正是 规模:不适用—— 方案:范围合理。只含一个候选而非一批,且三个"刻意保留"的理由逐一核实无误: 风险:无升级风险信号——未触及任何与 revert 相关的路径。 进入代码审查 🔍 — Qwen Code · qwen3.8-max Reviewed at |
Code reviewBefore reading the diff, my independent plan for "remove the superseded settings-dialog helpers" was: name-search every export of the module, keep the ones with live callers, delete the zero-reference ones together with their test blocks, and fix whichever surviving test leans on a removed helper. The PR does exactly this, and I could not find a simpler version of it. What I verified against the base tree and the diff:
No blockers, no convention violations. No sequence diagram or files table — this is a two-file deletion with no runtime flow to draw. Testing evidence (the PR's own CI, read via the API)Per the gate rules I do not run PR code; the evidence below is the PR's own CI on the reviewed commit. The main unit suite ( Final CI results for
One row per check name (latest run); skipped checks omitted; failures sort first. / 每个检查名一行(取最新一次运行),省略 skipped,失败项排在最前。 Not verified: runtime behaviour after the change — nothing user-visible changes by construction (no live caller loses a code path), and the dialog's own test suite covers it in CI; live execution is off-limits for the gate (PR code is never run here). No sandboxed-lane line either — this PR makes no behavioural claim; the claim is "nothing references these", which the static search above already settles and CI typecheck re-settles. 中文说明代码审查在读 diff 之前,我对"移除被取代的设置对话框辅助函数"的独立方案是:按名搜索该模块的每个导出,保留有活跃调用者的,删除零引用的及其测试块,并修正依赖被删辅助函数的存活测试。PR 的做法与此完全一致,我没有找到更简的版本。 我对照 base 树与 diff 核实的内容:
无阻塞项,无约定违规。不附时序图或文件表——这是两个文件的删除,没有可绘制的运行时流程。 测试证据(PR 自己的 CI,通过 API 读取)按门禁规则我不运行 PR 代码;以下证据是 PR 自身 CI 在被审 commit 上的结果。主单元测试套件( 未验证:变更后的运行时行为——按构造就没有用户可见的变化(没有任何活跃调用者失去代码路径),对话框自身的测试套件在 CI 中覆盖;门禁禁止实际执行(此处从不运行 PR 代码)。也不附沙箱验证行——本 PR 不做行为性论断;其论断是"没有东西引用这些",上面的静态搜索已了结,CI 类型检查会再次了结。 — Qwen Code · qwen3.8-max Reviewed at |
|
Confidence: 3/5 — clean review, but the fork-refactor approval guardrail needs a maintainer's sign-off. Stepping back: this is what a good cleanup PR looks like. The problem is not a hypothesis — the dead code is statically observable, and I confirmed it myself: thirteen exported helpers whose only caller anywhere in the repository was their own unit test, the remains of a dialog generation that was rebuilt and never swept out. My independent proposal (name-search every export, delete the zero-reference set with its tests, keep what still has callers) is exactly what the PR does; I did not find a simpler path it missed. The three kept helpers each have a real, verified reason to stay. The diff is 100% deletion plus one semantically equivalent line swap — nothing unrelated rode along. Every stage came back clean. The reason this is not an approval is policy, not doubt:
One honest caveat for the maintainer: the author holds write access on this repository and opened the PR from a fork; the guardrail keys on the PR's fork origin, not on the author's trust level, so it still applies — but it also means the escalation is likely a formality. No 中文说明置信度:3/5 —— 审查干净,但 fork refactor 审批护栏需要维护者签核。 退一步看:这是一个清理类 PR 该有的样子。问题不是假设——死代码在静态上可观察,我也亲自确认了:十三个导出辅助函数在全仓库的唯一调用者就是它们自己的单元测试,是重建后从未清扫掉的上一代对话框 API 的遗留。我的独立方案(按名搜索每个导出,删除零引用集合及其测试,保留仍有调用者的)与 PR 的做法完全一致;我没有找到它遗漏的更简路径。三个保留下来的辅助函数各有真实且已核实的留存理由。diff 是 100% 删除外加一行语义等价的替换——没有任何无关改动夹带。每个阶段都干净。 不给 approve 的原因是政策而非疑虑:
给维护者的一个诚实提示:作者在本仓库拥有 write 权限,是从 fork 开出的 PR;护栏以 PR 的 fork 来源为准,与作者的信任级别无关,因此仍然适用——但这也意味着本次升级大概率只是走个形式。由于护栏无论 CI 结果如何都阻止批准,本次不发出 approve-on-green 标记。 — Qwen Code · qwen3.8-max Reviewed at |
|
⏸️ Deferring to @ZijianZhang989 — fork- — Qwen Code · qwen3.8-max |
qwen-code-ci-bot
left a comment
There was a problem hiding this comment.
No issues found. LGTM! ✅
中文说明
未发现问题。LGTM!✅
— qwen3.8-max via Qwen Code /review (v0.21.13)
doudouOUC
left a comment
There was a problem hiding this comment.
.qwen/tmp/qwen-review-body.txt
doudouOUC
left a comment
There was a problem hiding this comment.
Review: PR #9379 — refactor(cli): remove superseded settings dialog helpers
Verdict: COMMENT — no Criticals, no Suggestions, no findings.
Summary
All 14 review agents (correctness, security, code quality, performance, test coverage, adversarial personas, build & test) examined this diff and returned zero findings. This is a clean dead-code removal:
- 13 exported functions removed from
packages/cli/src/utils/settingsUtils.ts— every one had zero callers outside the two files being modified (verified by cross-codebase grep). - ~517 lines of dead code deleted (178 source + 339 test), plus 1 line added to replace a deleted helper in a surviving test assertion.
- Three deliberately kept helpers (
setNestedPropertyForce,getRestartRequiredSettings,isDefaultValue) all have live callers or a design-doc reservation. - The one behavioral change (
getSettingValue→getEffectiveValue) in the test file is semantically equivalent for the tested value.
What was verified
- Cross-codebase grep for all 13 removed symbols: zero hits outside the diff.
- All 6 files that import from
settingsUtilsimport only remaining exports. SettingsTypetype import removal is correct (only used by removed functions).isValueInherited↔isDefaultValueduplicate resolution: correct.- No security, performance, or test-coverage regressions.
Conclusion
This is a well-scoped, well-verified dead-code cleanup that follows the Simplicity First principle from AGENTS.md. The PR is ready to merge.
doudouOUC
left a comment
There was a problem hiding this comment.
Review: PR #9379 — refactor(cli): remove superseded settings dialog helpers
Verdict: APPROVE — no Criticals, no Suggestions, no findings.
Summary
All 8 review agents (issue fidelity, correctness, security, code quality, test coverage, diff specialist, adversarial persona, build & test) examined this diff and returned zero findings. This is a clean dead-code removal:
- 13 exported functions removed from
packages/cli/src/utils/settingsUtils.ts— every one had zero callers outside the two files being modified (verified by cross-codebase grep acrosspackages/,integration-tests/,scripts/,docs/,.github/). - ~517 lines of dead code deleted (178 source + 339 test), plus 1 line added to replace a deleted helper in a surviving test assertion.
- Three deliberately kept helpers (
setNestedPropertyForce,getRestartRequiredSettings,isDefaultValue) all have live callers or a design-doc reservation. - The one behavioral change (
getSettingValue→getEffectiveValue) in the test file is semantically equivalent for the tested value.
What was verified
- Cross-codebase grep for all 13 removed symbols: zero hits outside the diff.
- All 6 files that import from
settingsUtilsimport only remaining exports. SettingsTypetype import removal is correct (only used by removed functions).isValueInherited↔isDefaultValueduplicate resolution: correct (both are!settingExistsInScope(key, settings)).- No security, performance, or test-coverage regressions.
Conclusion
This is a well-scoped, well-verified dead-code cleanup that follows the Simplicity First principle from AGENTS.md. No issues found. The PR is ready to merge.
|
Released in v0.21.14. |
What this PR does
Removes thirteen exported helpers from the settings utility module, together with the tests that existed only to cover them. Every one of them was reachable from nothing but its own unit test: no runtime code path, in this repository or any package it publishes, called them.
They are the remains of an earlier generation of the settings-dialog API. The dialog was rebuilt on a different set of helpers in the same module and the old set was never removed, so the two generations have been sitting side by side. One of the removed predicates was a character-for-character duplicate of a helper the dialog does use; another was a one-line wrapper around a second wrapper.
Three neighbouring helpers that a naive search also flags were deliberately kept: one is still called by a live function, one is named by an in-flight design document as an API it intends to reuse, and one was needed by a surviving test as an assertion helper, so that test now calls the live function it delegated to anyway. Behaviour is unchanged — nothing that runs today loses a code path.
Why it's needed
AGENTS.mdopens with Simplicity First: minimum code that solves the problem, nothing speculative. A superseded API generation that only its own tests exercise is the opposite — it costs every future reader a decision about which of two near-identical helpers to call, and it costs every future refactor a set of tests that pin behaviour nothing depends on. Deleting it makes the module's real surface visible.This is the first candidate filed on #9375 and the first PR produced by that sweep. It is deliberately one candidate, not a batch.
Reviewer Test Plan
How to verify
The claim to check is that nothing outside the module used these helpers. Search the repository for any of the removed names —
packages/,integration-tests/,scripts/,docs/, and.github/— and confirm every hit is inside this diff. There is no star re-export of the module and no namespace import of it, so a name search is complete.Then confirm the settings dialog is untouched in behaviour: it imports a different set of helpers from the same module, and its suite still passes in full.
Type checking is the gate that matters most here: it is what proves no surviving code referenced a removed symbol, and it does not run in CI.
Evidence (Before & After)
N/A — no user-visible or TUI change.
Tested on
Environment (optional)
Unit tests, typecheck and lint only; no runtime invocation needed.
Risk & Scope
exportsubpath, neither of which reaches this module, so the risk is theoretical rather than semver-visible.Linked Issues
Candidate
settings-utils-generation-afrom #9375.Removed symbols and their evidence
Removed from
packages/cli/src/utils/settingsUtils.ts(177 lines) andpackages/cli/src/utils/settingsUtils.test.ts(336 lines), plus one now-unused type import:getSettingsByCategory,getSettingsByType,getSettingsRequiringRestart,isValidSettingKey,getSettingCategory,shouldShowInDialog,getDialogSettingsByCategory,getDialogSettingsByType,getSettingValue,isSettingModified,hasRestartRequiredSettings,isValueInherited,getEffectiveDisplayValueConsumers found for each, before removal: exactly one file,
packages/cli/src/utils/settingsUtils.test.ts. No production file, no other package, no integration test, no documentation, no dynamic or string-keyed lookup, noexport *re-export, no namespace import.Kept deliberately:
setNestedPropertyForce— called by the livesetPendingSettingValue.getRestartRequiredSettings— named atdocs/design/hot-reload/settings-change-detection.md:426as an API that design intends to reuse; that design has no implementation in the tree yet, so the helper is reserved, not dead.isDefaultValue— the surviving twin of the removedisValueInherited; the two had identical bodies and the dialog imports this one.The single added line replaces a deleted helper used as an assertion aid in a surviving test with
getEffectiveValue, which the deleted helper delegated to.中文说明
这个 PR 做了什么
从设置工具模块中移除十三个导出的辅助函数,以及仅为覆盖它们而存在的测试。这些函数的唯一可达路径就是它们自己的单元测试:本仓库以及它发布的任何 package 中,都没有任何运行时代码调用它们。
它们是上一代设置对话框 API 的遗留物。对话框已在同一模块中基于另一组辅助函数重建,而旧的一组从未被移除,因此两代 API 一直并存。被移除的其中一个判定函数与对话框实际使用的某个函数逐字符完全相同;另一个则是对另一层包装的一行包装。
有三个相邻的辅助函数虽然也会被朴素搜索标记出来,但被刻意保留:一个仍被在用的函数调用;一个被一份尚在推进中的设计文档列为将要复用的 API;还有一个是某个存活测试用作断言辅助的,现在该测试改为直接调用它本就委托的那个在用函数。行为没有变化——今天在运行的代码没有失去任何路径。
为什么需要
AGENTS.md开篇即是 Simplicity First:解决问题的最小代码量,不做任何投机性设计。一代仅由自身测试驱动的、已被取代的 API 恰恰相反——它让每位后来的读者都要判断两个近乎相同的函数该调用哪个,也让每次重构都要面对一批固定着无人依赖之行为的测试。删除它能让该模块真实的代码面显现出来。这是 #9375 上记录的第一个候选,也是该轮扫描产出的第一个 PR。它刻意只包含一个候选,而非一批。
审阅测试计划
如何验证
需要核实的论断是:模块之外没有任何地方使用这些辅助函数。在仓库中搜索任一被移除的名称——
packages/、integration-tests/、scripts/、docs/、.github/——确认所有命中都在本 diff 之内。该模块没有星号再导出,也没有命名空间导入,因此按名称搜索是完备的。然后确认设置对话框的行为未受影响:它从同一模块导入的是另一组辅助函数,其测试套件仍全部通过。
这里最关键的门禁是类型检查:它才是"没有存活代码引用被删符号"的证明,而它并不在 CI 中运行。
证据(前后对比)
N/A——无用户可见或 TUI 变化。
测试环境
运行环境(可选)
仅单元测试、类型检查与 lint,无需运行时调用。
风险与范围
export子路径,二者都无法触及该模块,因此这一风险是理论上的,而非 semver 层面的破坏。关联 Issue
来自 #9375 的候选
settings-utils-generation-a。