fix(cli): narrow settings enum schemas#5418
Conversation
|
@qwen-code /triage |
qwen-code-ci-bot
left a comment
There was a problem hiding this comment.
Hi @tt-a1i, thanks for the PR! The code changes look like a good improvement — narrowing context.importFormat and advanced.dnsResolutionOrder from free-form strings to proper enums is exactly the kind of schema tightening we want.
However, the PR body doesn't follow our PR template. The template requires these sections:
## What this PR does## Why it's needed## Reviewer Test Plan(with How to verify, Evidence, Tested on subsections)## Risk & Scope## Linked Issues
Your current body has ## Summary, ## Tests, and ## AI Assistance Disclosure — none of which match the required headings. Could you restructure the PR description to follow the template? This helps reviewers (and future maintainers) understand the motivation, verify the change, and assess risk.
中文说明
感谢 @tt-a1i 的贡献!代码改动本身不错——把 context.importFormat 和 advanced.dnsResolutionOrder 从自由字符串收窄为枚举,正是我们需要的 schema 优化。
但 PR 正文没有按照 PR 模板 填写。模板要求以下章节:
## What this PR does(做了什么)## Why it's needed(为什么需要)## Reviewer Test Plan(审查者验证计划,含 How to verify、Evidence、Tested on)## Risk & Scope(风险与范围)## Linked Issues(关联 Issue)
当前的 ## Summary、## Tests、## AI Assistance Disclosure 都不匹配模板要求的标题。请按照模板重新组织 PR 描述,方便审查者和后续维护者理解动机、验证改动和评估风险。
— Qwen Code · qwen3.7-max
|
updated the PR description to match the template. code is unchanged. |
| | ----------------------------------------------------------- | -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- | | ||
| | `context.fileName` | string or array of strings | The name of the context file(s). | `undefined` | | ||
| | `context.importFormat` | string | The format to use when importing memory. | `undefined` | | ||
| | `context.importFormat` | `"tree"` or `"flat"` | The format to use when importing memory. | `undefined` | |
There was a problem hiding this comment.
[Suggestion] The Type column for context.importFormat (and advanced.dnsResolutionOrder below) now uses a quoted-value format ("tree" or "flat"), but every other type: 'enum' setting in this file still uses string as its Type column — e.g., ui.renderMode (line 112), general.defaultFileEncoding (line 89), tools.approvalMode (line 269). This creates a mixed convention.
Either update all existing enum settings to the new quoted-value format (preferred — it's more informative for users), or revert these two to string to match the existing convention.
— qwen3.7-max via Qwen Code /review
There was a problem hiding this comment.
done, reverted those Type cells back to string. after rebasing onto latest main the PR diff no longer includes settings.md.
|
@qwen-code /triage |
|
Thanks for the PR, and for updating the body to match the template — that concern from the earlier review is resolved. ✅ On direction: clearly aligned. Two settings already have a small fixed value set enforced at runtime ( On approach: the diff is minimal (4 files, +49/-14) and follows the existing One concern worth discussing before proceeding: @wenshao pointed out that the docs now use Moving on to code review. 🔍 中文说明感谢 PR,也感谢把正文更新成模板格式——之前提出的模板问题已经解决了。✅ 方向:明确对齐。两个设置在运行时已经有固定的取值范围( 方案:改动很小(4 个文件,+49/-14),遵循已有的 一个值得讨论的点:@wenshao 指出 文档 Type 列现在用 进入代码审查 🔍 — Qwen Code · qwen3.7-max |
Code ReviewClean. The two settings ( Tests are focused: two new The one issue from Stage 1 still stands — the docs Type column uses TestingThis is a non-UI schema definition change, so testing focuses on unit tests and schema generation rather than TUI interaction. Unit tests22/22 tests pass (20 existing + 2 new from this PR). Schema generationSchema generation is idempotent. The committed Generated schema verificationOn Result: PASS ✅ 中文说明代码审查干净。两个设置( 测试聚焦:两个新的 Stage 1 提出的问题仍然成立——文档 Type 列用了 测试这是非 UI 的 schema 定义改动,测试重点是单元测试和 schema 生成,而非 TUI 交互。 单元测试 22/22 通过(20 个已有 + 2 个新增)。Schema 生成幂等,生成文件和提交文件完全匹配。 结果:通过 ✅ — Qwen Code · qwen3.7-max |
|
Stepping back: this is a clean, well-scoped PR that does exactly what it says. Two settings that already have fixed value sets at runtime get properly reflected as enums in the schema. The implementation follows existing patterns (9 other enum settings use the same If I had been asked to do this change independently, I would have produced essentially the same diff. The code is the easy part and it's right. The one thing holding this back is the docs inconsistency @wenshao flagged — the Type column now says My suggestion: revert these two to Everything else is ship-ready. 中文说明整体来看:这是一个干净、范围恰当的 PR,完全兑现了它的目标。两个在运行时已经有固定取值范围的设置,在 schema 里被正确地反映为枚举。实现遵循了现有模式(另外 9 个枚举设置用的都是 如果让我独立做这个改动,我大概会产出基本一样的 diff。代码部分没问题。 唯一卡住的地方是 @wenshao 指出的文档不一致——Type 列现在写的是 建议: 文档里这两个先恢复成 其他部分都可以合并。 — Qwen Code · qwen3.7-max |
qwen-code-ci-bot
left a comment
There was a problem hiding this comment.
Docs Type column inconsistency needs fixing before merge — see my notes above. The code itself is solid. 🙏
✅ Maintainer verification — local build + schema regeneration + tests (head
|
| Check | Result |
|---|---|
npm run build |
✅ exit 0 |
cli tsc --noEmit (after core rebuild) |
✅ 0 errors — PR change is type-clean |
prettier --check (4 changed files) |
✅ clean |
eslint (settingsSchema.ts + test) |
✅ exit 0 |
Generated artifact is in sync (the key check)
Ran npm run generate:settings-schema against the source and diffed the committed file:
git diff packages/vscode-ide-companion/schemas/settings.schema.json → (empty)
✅ The committed settings.schema.json is exactly what the generator produces from settingsSchema.ts — the artifact is in sync. The generated JSON correctly emits "enum": ["tree","flat"] / "enum": ["ipv4first","verbatim"] (with an Options: … description suffix), which is the proper JSON-Schema representation of an enum.
Correctness — enum options match the runtime types exactly
| Setting | PR enum options | Runtime union type | Match |
|---|---|---|---|
context.importFormat |
tree, flat |
MemoryImportFormat = 'tree' | 'flat' (settingsSchema.ts:260) |
✅ exact |
advanced.dnsResolutionOrder |
ipv4first, verbatim |
DnsResolutionOrder = 'ipv4first' | 'verbatim' (:261) |
✅ exact |
Both option sets are complete and correct against the actual TypeScript unions (also confirmed by runtime usage: config.ts:1820 defaults importFormat to 'tree', gemini.tsx:125 defaults dnsResolutionOrder to 'ipv4first'). type: 'enum' is an established pattern here (12 enum settings total) and is the same shape the existing ui.renderMode test already asserts.
No runtime behavior change
The type: 'string' → type: 'enum' change affects only the generated schema (editor completion / IDE validation). It does not add load-time validation that would reject existing configs:
- Both settings keep
showInDialog: false(:1396,:2314) → they never render in the settings dialog, so the enum-vs-string rendering path is irrelevant for them. - Runtime reads the values directly (
settings.context?.importFormat || 'tree'), not through schema validation. settings.test.ts(load/merge/validation) passes 133/133 — no regression.
Tests
| Suite | Result |
|---|---|
settingsSchema.test.ts (incl. the 2 new enum tests) |
✅ 24 pass |
gemini.test.tsx |
✅ 25 pass |
settings.test.ts (load/merge/validation regression) |
✅ 133 pass |
Open item — docs Type-column convention (the /review suggestion)
Confirmed and quantified. The PR renders the Type column for these 2 rows as `"tree"` or `"flat"` / `"ipv4first"` or `"verbatim"`, but every other enum-valued setting in settings.md still uses string (e.g. ui.renderMode, general.defaultFileEncoding, tools.approvalMode). This quoted-enum format appears on exactly these 2 rows and 0 rows on main — a brand-new, no-precedent mixed convention.
Non-blocking (the docs are accurate either way). Cleanest resolution: revert the 2 Type cells back to string to match the existing convention (smallest change), or — if the richer format is preferred — apply it to all enum rows in a follow-up. Author's call.
Verdict
Recommend merge. Builds, type-clean, focused tests green, the generated schema is in sync, the enum values are exactly right, and there is no runtime behavior change — a tidy schema/docs alignment. The CI-bot block was template-only (since addressed). The docs Type-column convention is a non-blocking Suggestion. (Note: only authorize/triage have run so far — the full Test/Lint/CodeQL matrix should be triggered to go green before merge; this local run covers that surface on macOS.)
🇨🇳 中文版(点击展开)
✅ 维护者验证 —— 本地构建 + schema 重新生成 + 测试(head 0ca5589c)
在隔离 worktree 验证了 head(0ca5589c,Node v22.22.2,macOS)—— 全量构建、schema 重新生成、聚焦测试、类型检查与 lint。
结论:干净、低风险的 schema 收窄改动 —— 建议合并。 构建通过、类型检查通过、所有聚焦测试通过;npm run generate:settings-schema 逐字节复现了提交的 settings.schema.json;枚举值与运行时联合类型完全一致;且没有任何运行时行为变化(两个设置都保持 showInDialog: false,运行时直接读取,加载时不做 schema 校验)。CI bot 的 CHANGES_REQUESTED 仅针对 PR 模板格式,作者已修正。唯一待办项是文档 Type 列的约定(之前 /review 提的建议)—— 非阻塞。
构建、类型与 lint
| 检查 | 结果 |
|---|---|
npm run build |
✅ exit 0 |
cli tsc --noEmit(重建 core 后) |
✅ 0 错误 —— PR 改动类型干净 |
prettier --check(4 个改动文件) |
✅ 干净 |
eslint(settingsSchema.ts + 测试) |
✅ exit 0 |
注:首次在复用的 worktree 上跑 cli typecheck 曾报与本 PR 无关的错误(
showResponseTokensPerSecond、compactToolResultDisplayForHistory等),那是 worktree 里 core 构建产物停留在较旧 main base 所致;重建 core 后全部消失,证明与本 PR 无关。
生成的产物已同步(关键检查)
对源码跑 npm run generate:settings-schema 后 diff 提交的文件:
git diff packages/vscode-ide-companion/schemas/settings.schema.json → (空)
✅ 提交的 settings.schema.json 正是生成器从 settingsSchema.ts 产出的结果 —— 产物已同步。生成的 JSON 正确输出 "enum": ["tree","flat"] / "enum": ["ipv4first","verbatim"](并在描述后追加 Options: …),这是枚举在 JSON Schema 中的标准表示。
正确性 —— 枚举选项与运行时类型完全一致
| 设置 | PR 枚举选项 | 运行时联合类型 | 一致 |
|---|---|---|---|
context.importFormat |
tree、flat |
MemoryImportFormat = 'tree' | 'flat'(settingsSchema.ts:260) |
✅ 完全一致 |
advanced.dnsResolutionOrder |
ipv4first、verbatim |
DnsResolutionOrder = 'ipv4first' | 'verbatim'(:261) |
✅ 完全一致 |
两组选项相对真实的 TypeScript 联合类型既完整又正确(运行时用法也佐证:config.ts:1820 把 importFormat 默认为 'tree',gemini.tsx:125 把 dnsResolutionOrder 默认为 'ipv4first')。type: 'enum' 在此处是成熟模式(共 12 个枚举设置),与现有 ui.renderMode 测试断言的形状相同。
无运行时行为变化
type: 'string' → type: 'enum' 只影响生成的 schema(编辑器补全 / IDE 校验),不会新增会拒绝现有配置的加载期校验:
- 两个设置都保持
showInDialog: false(:1396、:2314)→ 永远不会出现在设置对话框,所以 enum/string 的渲染分支对它们无关。 - 运行时直接读取值(
settings.context?.importFormat || 'tree'),不经过 schema 校验。 settings.test.ts(加载/合并/校验)133/133 通过 —— 无回归。
测试
| 套件 | 结果 |
|---|---|
settingsSchema.test.ts(含 2 个新枚举测试) |
✅ 24 通过 |
gemini.test.tsx |
✅ 25 通过 |
settings.test.ts(加载/合并/校验回归) |
✅ 133 通过 |
待办项 —— 文档 Type 列约定(/review 建议)
已确认并量化。PR 把这 2 行的 Type 列渲染为 `"tree"` or `"flat"` / `"ipv4first"` or `"verbatim"`,但 settings.md 里其它所有枚举设置仍用 string(如 ui.renderMode、general.defaultFileEncoding、tools.approvalMode)。这种引号枚举格式恰好只出现在这 2 行,main 上 0 行 —— 是全新、无先例的混合约定。
非阻塞(文档两种写法都准确)。最干净的处理:把这 2 个 Type 单元格改回 string 以匹配现有约定(改动最小);或者——若更倾向于更丰富的格式——在后续 PR 中统一应用到所有枚举行。由作者定夺。
结论
建议合并。 构建通过、类型干净、聚焦测试全绿、生成的 schema 已同步、枚举值完全正确、无运行时行为变化 —— 是一次整洁的 schema/文档对齐。CI bot 的阻塞仅为模板问题(已解决)。文档 Type 列约定为非阻塞建议。(注:目前只跑了 authorize/triage,完整的 Test/Lint/CodeQL 矩阵应触发并转绿后再合并;本次本地验证在 macOS 上覆盖了该范围。)
0ca5589 to
ed8f067
Compare
|
@qwen-code /triage |
|
Thanks for the PR, and for the follow-up commit ( On direction: clearly aligned. Two settings already have a small fixed value set enforced at runtime ( On approach: the diff is now minimal (3 files, +41/-6) after the docs revert, and follows the existing No concerns. Moving on to code review. 🔍 中文说明感谢 PR,也感谢后续提交 方向:明确对齐。两个设置在运行时已经有固定的取值范围( 方案:在 docs 回退后,diff 现在很精简(3 个文件,+41/-6),遵循已有的 没有顾虑。进入代码审查 🔍 — Qwen Code · qwen3.7-max |
Code ReviewClean. The two settings (
Runtime usage is consistent:
Tests are focused: two new No blockers. TestingThis is a non-UI schema definition change, so testing focuses on unit tests and schema generation rather than TUI interaction. Code-level verification (worktree, no local
|
|
Stepping back: this is a clean, well-scoped PR that does exactly what it says, and the one issue flagged in the previous round (docs Type-column inconsistency) has been addressed by the follow-up commit If I had been asked to do this change independently, I would have produced essentially the same diff: flip two Reflection checklist:
Approving. ✅ 中文说明整体来看:这是一个干净、范围恰当的 PR,完全兑现了目标;上一轮提出的文档 Type 列不一致问题也通过后续提交 如果让我独立做这个改动,我大概会产出基本一样的 diff:把两个 反思清单:
批准合并。✅ — Qwen Code · qwen3.7-max |
qwen-code-ci-bot
left a comment
There was a problem hiding this comment.
LGTM — schema tightening is clean, docs inconsistency addressed in ed8f067, maintainer-verified tests green. Ready to ship. ✅
✅ Maintainer re-verification on current head —
|
| Change | Effect on this review |
|---|---|
New commit ed8f067b "docs: keep settings type column consistent" |
Resolves my prior open item — the settings.md Type column for both rows is reverted from `"tree"` or `"flat"` back to string, matching every other enum row. The PR again touches exactly 3 files. |
Rebased onto newer main |
Re-verified on the new base: full build + typecheck are clean (see below). The PR-body caveat that typecheck failed in acp-integration/acpAgent.ts is now stale — it does not reproduce on this head. |
Build, type & lint (re-run synchronously on the current head)
| Check | Result |
|---|---|
npm ci |
✅ exit 0 |
npm run build |
✅ exit 0 (0 errors; the 15 lint warnings are pre-existing curly warnings in vscode-ide-companion, untouched by this PR) |
npm run typecheck (cli + core + sdk + webui) |
✅ exit 0, 0 errors — incl. acpAgent.ts; the PR-body typecheck caveat no longer reproduces |
eslint (settingsSchema.ts + test) |
✅ exit 0 |
prettier --check (4 changed files) |
✅ clean |
Generated artifact is in sync (the key check)
Ran npm run generate:settings-schema against the source and diffed the committed file:
git diff packages/vscode-ide-companion/schemas/settings.schema.json → (empty)
✅ The committed settings.schema.json is exactly what the generator produces from settingsSchema.ts — no hand-edit drift. The generator's case 'enum' (scripts/generate-settings-schema.ts:137) emits "enum": [values] and appends Options: … to the description, which is precisely the committed JSON.
Correctness — enum options match the runtime accepted set exactly
| Setting | PR enum options | Runtime source of truth | Match |
|---|---|---|---|
context.importFormat |
tree, flat |
MemoryImportFormat = 'tree' | 'flat' (settingsSchema.ts:260); dispatched at memoryImportProcessor.ts:239 (=== 'flat', else tree), default 'tree' (config.ts:1494) |
✅ exact & complete |
advanced.dnsResolutionOrder |
ipv4first, verbatim |
DnsResolutionOrder = 'ipv4first' | 'verbatim' (settingsSchema.ts:261); explicit runtime validator validateDnsResolutionOrder accepts only these two (gemini.tsx:134), else warns + falls back to ipv4first, before dns.setDefaultResultOrder (gemini.tsx:499) |
✅ exact & complete |
dnsResolutionOrder is especially strong: the runtime actively validates against exactly ipv4first/verbatim, so the schema now mirrors a constraint the code already enforces.
Tests are non-vacuous — mutation test
Reverted only settingsSchema.ts to its pre-PR base (kept the PR's test file) and re-ran settingsSchema.test.ts:
× should define context.importFormat as tree or flat → expected 'string' to be 'enum'
× should define advanced.dnsResolutionOrder as ... → expected 'string' to be 'enum'
(the other 22 tests still pass)
✅ Exactly the 2 new tests fail when the source change is reverted — they genuinely guard the enum, and the failure message is itself the before/after (string → enum). Restored the source afterwards; tree is clean.
No runtime behavior change
type: 'string' → type: 'enum' only affects the generated schema (editor completion / IDE validation). It does not add load-time validation that would reject existing configs:
- Both settings keep
showInDialog: false(settingsSchema.ts:1389,:2312) → they never render in the settings dialog, so the enum-vs-string render path is irrelevant for them. - Runtime reads the values directly and already tolerates unknown values (
importFormatfalls through totree;dnsResolutionOrderwarns + defaults toipv4first). settings.test.ts(load/merge/validation) passes 133/133 — no regression.
Test suites
| Suite | Result |
|---|---|
settingsSchema.test.ts (incl. the 2 new enum tests) |
✅ 24 pass |
gemini.test.tsx |
✅ 25 pass |
settings.test.ts (load/merge/validation regression) |
✅ 133 pass |
| Total | ✅ 182 pass |
CI on this head
Lint ✅ and CodeQL ✅ are green; the three Test (…, Node 22.x) jobs are still in progress. My local run covers that surface on macOS (build + typecheck + the focused suites all green).
Verdict
Recommend merge. Builds, type-clean across all workspaces, focused tests green, the generated schema is in sync, the enum values exactly match what the runtime accepts (with dnsResolutionOrder even runtime-validated), the new tests are mutation-proven non-vacuous, and there is no runtime behavior change. My one prior open item (docs Type-column convention) is resolved, and the PR-body typecheck caveat is stale on this head. A tidy, well-scoped schema/docs alignment.
🇨🇳 中文版(点击展开)
✅ 维护者对当前 head 的重新验证 —— ed8f067b(取代我之前针对 0ca5589c 的评论)
由于自上次审查后 head 发生了移动(变基 + 一个新的文档 commit),我在全新的隔离 worktree 中针对当前 head(ed8f067b,Node v22.22.2,macOS)重新跑了完整的本地验证。
结论:干净、低风险的 schema 收窄改动 —— 建议合并。 构建通过、跨所有 workspace 类型检查通过、所有聚焦测试通过;npm run generate:settings-schema 逐字节复现了提交的 settings.schema.json;枚举值与运行时实际接受的取值集完全一致;2 个新测试经 mutation 验证非空洞;且无任何运行时行为变化。我上次审查留下的唯一待办项现已解决。
自 0ca5589c 以来的变化
| 变化 | 对本次审查的影响 |
|---|---|
新 commit ed8f067b《docs: keep settings type column consistent》 |
解决了我上次提的待办项 —— settings.md 中这两行的 Type 列已从 `"tree"` or `"flat"` 改回 string,与其它所有枚举行一致。PR 重新回到恰好改动 3 个文件。 |
变基到更新的 main |
在新 base 上重新验证:完整 build + typecheck 均干净(见下)。PR 描述里提到 typecheck 在 acp-integration/acpAgent.ts 失败的那条注意事项现已过时 —— 在当前 head 上不复现。 |
构建、类型与 lint(在当前 head 上同步重跑)
| 检查 | 结果 |
|---|---|
npm ci |
✅ exit 0 |
npm run build |
✅ exit 0(0 error;那 15 个 lint warning 是 vscode-ide-companion 里预存的 curly 警告,本 PR 未触碰) |
npm run typecheck(cli + core + sdk + webui) |
✅ exit 0,0 error —— 含 acpAgent.ts;PR 描述里的 typecheck 注意事项不再复现 |
eslint(settingsSchema.ts + 测试) |
✅ exit 0 |
prettier --check(4 个改动文件) |
✅ 干净 |
生成的产物已同步(关键检查)
对源码跑 npm run generate:settings-schema 后 diff 提交的文件:
git diff packages/vscode-ide-companion/schemas/settings.schema.json → (空)
✅ 提交的 settings.schema.json 正是生成器从 settingsSchema.ts 产出的结果 —— 没有手改漂移。生成器的 case 'enum'(scripts/generate-settings-schema.ts:137)输出 "enum": [values] 并把 Options: … 追加到 description,与提交的 JSON 完全一致。
正确性 —— 枚举选项与运行时实际接受集完全一致
| 设置 | PR 枚举选项 | 运行时事实依据 | 一致 |
|---|---|---|---|
context.importFormat |
tree、flat |
MemoryImportFormat = 'tree' | 'flat'(settingsSchema.ts:260);在 memoryImportProcessor.ts:239 按 === 'flat' 分派(否则 tree),默认 'tree'(config.ts:1494) |
✅ 完全一致且完整 |
advanced.dnsResolutionOrder |
ipv4first、verbatim |
DnsResolutionOrder = 'ipv4first' | 'verbatim'(settingsSchema.ts:261);显式运行时校验器 validateDnsResolutionOrder 只接受这两个值(gemini.tsx:134),否则告警并回退到 ipv4first,再传给 dns.setDefaultResultOrder(gemini.tsx:499) |
✅ 完全一致且完整 |
dnsResolutionOrder 的证据尤其强:运行时主动校验只允许 ipv4first/verbatim,所以 schema 现在恰好镜像了代码已经强制的约束。
测试非空洞 —— mutation test
仅把 settingsSchema.ts 回退到 PR 前的 base(保留 PR 的测试文件),重跑 settingsSchema.test.ts:
× should define context.importFormat as tree or flat → expected 'string' to be 'enum'
× should define advanced.dnsResolutionOrder as ... → expected 'string' to be 'enum'
(其余 22 个测试仍通过)
✅ 回退源码改动后恰好这 2 个新测试失败 —— 它们真正守护了枚举,失败信息本身就是前后对比(string → enum)。之后已恢复源码,工作树干净。
无运行时行为变化
type: 'string' → type: 'enum' 只影响生成的 schema(编辑器补全 / IDE 校验),不会新增会拒绝现有配置的加载期校验:
- 两个设置都保持
showInDialog: false(settingsSchema.ts:1389、:2312)→ 永远不会出现在设置对话框,所以 enum/string 的渲染分支对它们无关。 - 运行时直接读取值,且本就容忍未知值(
importFormat落到tree;dnsResolutionOrder告警并默认ipv4first)。 settings.test.ts(加载/合并/校验)133/133 通过 —— 无回归。
测试套件
| 套件 | 结果 |
|---|---|
settingsSchema.test.ts(含 2 个新枚举测试) |
✅ 24 通过 |
gemini.test.tsx |
✅ 25 通过 |
settings.test.ts(加载/合并/校验回归) |
✅ 133 通过 |
| 合计 | ✅ 182 通过 |
当前 head 的 CI
Lint ✅ 与 CodeQL ✅ 已绿;三个 Test (…, Node 22.x) 仍在进行中。本次本地验证在 macOS 上覆盖了该范围(build + typecheck + 聚焦套件全绿)。
结论
建议合并。 构建通过、跨所有 workspace 类型干净、聚焦测试全绿、生成的 schema 已同步、枚举值与运行时接受集完全一致(dnsResolutionOrder 甚至有运行时校验)、新测试经 mutation 证明非空洞、且无运行时行为变化。我之前唯一的待办项(文档 Type 列约定)已解决,PR 描述里的 typecheck 注意事项在当前 head 已过时。一次整洁、范围清晰的 schema/文档对齐。
✅ Local real-build verification — merge-readyI built the real What this PR doesNarrows two settings in the generated schema from generic
Results
Key findings1. The enum values are not arbitrary — they exactly mirror the runtime contract. This is the strongest merge signal.
2. Real-binary tmux A/B — drove the built binary against in-enum vs out-of-enum values; the runtime boundary matches the new enum exactly: 3. Mutation test proves the new tests guard the change. Reverting only 4. 5. Docs consistency is correct. The 3rd commit reverts Scope / honestyBoth settings are Optional, non-blocking follow-up: unlike VerdictMerge-ready. ✅ The schema now matches the runtime contract exactly, tests are non-vacuous, build/typecheck/CI are green, and the generated artifact is reproducible. 🇨🇳 中文版(点击展开)✅ 本地真实构建验证 —— 可以合并我在隔离 worktree 中基于本 PR head( 本 PR 做了什么把生成 schema 里两个设置项从通用
验证结果
关键发现1. 枚举值不是拍脑袋定的 —— 它精确镜像了运行时契约。 这是最强的合并信号。
2. 真实二进制 tmux A/B —— 用构建出的二进制跑「枚举内 vs 枚举外」的值,运行时边界与新枚举完全一致: 3. 变异测试证明新测试确实守护了改动。 只把 4. 5. 文档一致性是对的。 第 3 个 commit 把 范围 / 诚实说明两个设置都是 可选、非阻塞的后续: 与 结论可以合并。 ✅ schema 现在与运行时契约精确一致,测试非空洞,build/typecheck/CI 全绿,生成产物可复现。 |
What this PR does
This narrows two string settings in the generated settings schema:
context.importFormatis now exposed astreeorflat, andadvanced.dnsResolutionOrderis now exposed asipv4firstorverbatim. It regenerates the VS Code settings schema and adds focused tests for both enum definitions.Why it is needed
Both settings already have a small supported value set in the CLI, but the published schema described them as generic strings. That makes editor completion weaker and lets invalid values look acceptable in settings files. Exposing the real enum values keeps the schema and runtime behavior aligned.
Reviewer Test Plan
How to verify
Check that the generated settings schema now lists enum values for
context.importFormatandadvanced.dnsResolutionOrder. The focused schema and CLI tests cover the generated schema shape and default settings behavior.Evidence
Before: both fields appeared as unrestricted strings in the generated schema. After: both fields expose their supported enum values in
packages/vscode-ide-companion/schemas/settings.schema.json.Tested on
Commands run locally:
npm run generate:settings-schemanpx vitest run --coverage.enabled=false packages/cli/src/config/settingsSchema.test.ts packages/cli/src/gemini.test.tsxnpx prettier --check docs/users/configuration/settings.md packages/cli/src/config/settingsSchema.ts packages/cli/src/config/settingsSchema.test.ts packages/vscode-ide-companion/schemas/settings.schema.jsonnpx eslint packages/cli/src/config/settingsSchema.ts packages/cli/src/config/settingsSchema.test.tsnpm run build --workspace packages/acp-bridgenpm run build --workspace packages/corenpm run typecheck --workspace packages/cligit diff --check upstream/mainRisk & Scope
Linked Issues
N/A
AI Assistance Disclosure
I used Codex to review the changes, sanity-check the implementation against existing patterns, and help spot potential edge cases.