Skip to content

fix(cli): narrow settings enum schemas#5418

Merged
wenshao merged 3 commits into
QwenLM:mainfrom
tt-a1i:fix/context-import-format-schema
Jun 19, 2026
Merged

fix(cli): narrow settings enum schemas#5418
wenshao merged 3 commits into
QwenLM:mainfrom
tt-a1i:fix/context-import-format-schema

Conversation

@tt-a1i

@tt-a1i tt-a1i commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

What this PR does

This narrows two string settings in the generated settings schema: context.importFormat is now exposed as tree or flat, and advanced.dnsResolutionOrder is now exposed as ipv4first or verbatim. 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.importFormat and advanced.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

OS Status
macOS tested locally
Windows CI
Linux CI

Commands run locally:

  • npm run generate:settings-schema
  • npx vitest run --coverage.enabled=false packages/cli/src/config/settingsSchema.test.ts packages/cli/src/gemini.test.tsx
  • npx 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.json
  • npx eslint packages/cli/src/config/settingsSchema.ts packages/cli/src/config/settingsSchema.test.ts
  • npm run build --workspace packages/acp-bridge
  • npm run build --workspace packages/core
  • npm run typecheck --workspace packages/cli
  • git diff --check upstream/main

Risk & Scope

  • Main risk or tradeoff: users with invalid values may now see clearer editor/schema validation warnings, but runtime behavior is not made stricter by this PR.
  • Not validated / out of scope: no manual VS Code settings UI recording was captured.
  • Breaking changes / migration notes: none.

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.

@tt-a1i tt-a1i changed the title fix(cli): narrow context import format schema fix(cli): narrow settings enum schemas Jun 19, 2026
@tt-a1i
tt-a1i marked this pull request as ready for review June 19, 2026 15:33
@wenshao

wenshao commented Jun 19, 2026

Copy link
Copy Markdown
Collaborator

@qwen-code /triage

@qwen-code-ci-bot qwen-code-ci-bot 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.

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.importFormatadvanced.dnsResolutionOrder 从自由字符串收窄为枚举,正是我们需要的 schema 优化。

但 PR 正文没有按照 PR 模板 填写。模板要求以下章节:

  • ## What this PR does(做了什么)
  • ## Why it's needed(为什么需要)
  • ## Reviewer Test Plan(审查者验证计划,含 How to verifyEvidenceTested on
  • ## Risk & Scope(风险与范围)
  • ## Linked Issues(关联 Issue)

当前的 ## Summary## Tests## AI Assistance Disclosure 都不匹配模板要求的标题。请按照模板重新组织 PR 描述,方便审查者和后续维护者理解动机、验证改动和评估风险。

Qwen Code · qwen3.7-max

@tt-a1i

tt-a1i commented Jun 19, 2026

Copy link
Copy Markdown
Contributor Author

updated the PR description to match the template. code is unchanged.

Comment thread docs/users/configuration/settings.md Outdated
| ----------------------------------------------------------- | -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- |
| `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` |

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.

[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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done, reverted those Type cells back to string. after rebasing onto latest main the PR diff no longer includes settings.md.

@wenshao

wenshao commented Jun 19, 2026

Copy link
Copy Markdown
Collaborator

@qwen-code /triage

@qwen-code-ci-bot

Copy link
Copy Markdown
Collaborator

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 (MemoryImportFormat = 'tree' | 'flat', DnsResolutionOrder = 'ipv4first' | 'verbatim'), but the schema described them as open strings. Tightening the schema to match reality is straightforward and useful — better editor completion, earlier validation errors.

On approach: the diff is minimal (4 files, +49/-14) and follows the existing type: 'enum' + options pattern used by 9 other settings. Scope feels right.

One concern worth discussing before proceeding: @wenshao pointed out that the docs now use "tree" or "flat" in the Type column, while every other enum setting in the same file still says string (e.g. ui.renderMode, tools.approvalMode, general.defaultFileEncoding). That creates an inconsistency. The quoted-value format is more informative for users, but it should either be applied to all enum settings or reverted to string here to match the existing convention. The former is the better outcome but is out of scope for this PR — so I'd suggest reverting these two to string for now and opening a follow-up to upgrade all enum docs.

Moving on to code review. 🔍

中文说明

感谢 PR,也感谢把正文更新成模板格式——之前提出的模板问题已经解决了。✅

方向:明确对齐。两个设置在运行时已经有固定的取值范围(MemoryImportFormat = 'tree' | 'flat'DnsResolutionOrder = 'ipv4first' | 'verbatim'),但 schema 里还描述成自由字符串。把 schema 收窄到和实际一致,对编辑器补全和提前校验都有帮助。

方案:改动很小(4 个文件,+49/-14),遵循已有的 type: 'enum' + options 模式(另外 9 个设置也在用)。范围合理。

一个值得讨论的点:@wenshao 指出 文档 Type 列现在用 "tree" or "flat" 格式,但同文件中其他所有 enum 设置仍然用 string(如 ui.renderModetools.approvalModegeneral.defaultFileEncoding)。这造成了不一致。带引号值的格式对用户更友好,但应该要么全部统一改,要么这里先退回 string 保持现有惯例。前者更好但超出本 PR 范围——建议这里先恢复为 string,后续再开一个 PR 把所有 enum 文档统一升级。

进入代码审查 🔍

Qwen Code · qwen3.7-max

@qwen-code-ci-bot

Copy link
Copy Markdown
Collaborator

Code Review

Clean. The two settings (importFormat, dnsResolutionOrder) are changed from type: 'string' to type: 'enum' with the correct options arrays, matching the existing pattern used by 9 other enum settings in the same file. The types (MemoryImportFormat, DnsResolutionOrder) were already defined — the PR just surfaces them in the schema. The generated JSON schema is consistent with what the generator script produces (verified by running npm run generate:settings-schema and confirming zero diff).

Tests are focused: two new it() blocks that assert the enum type and options for each setting. No unrelated changes, no scope creep.

The one issue from Stage 1 still stands — the docs Type column uses "tree" or "flat" while every other enum setting in the same file says string. @wenshao's suggestion is the right call: either upgrade all enum settings to the quoted-value format (preferred, but out of scope for this PR) or revert these two to string to keep the convention consistent.

Testing

This is a non-UI schema definition change, so testing focuses on unit tests and schema generation rather than TUI interaction.

Unit tests

$ cd packages/cli && npx vitest run src/config/settingsSchema.test.ts

 RUN  v3.2.4 /home/runner/work/qwen-code/qwen-code/packages/cli
      Coverage enabled with v8

 ✓ src/config/settingsSchema.test.ts (22 tests) 17ms

 Test Files  1 passed (1)
      Tests  22 passed (22)
   Start at  18:13:24
   Duration  10.43s (transform 2.81s, setup 122ms, collect 4.40s, tests 17ms, environment 421ms, prepare 102ms)

22/22 tests pass (20 existing + 2 new from this PR).

Schema generation

$ npm run generate:settings-schema

> @qwen-code/[email protected] generate:settings-schema
> node --import tsx/esm scripts/generate-settings-schema.ts

Generated settings JSON Schema at: packages/vscode-ide-companion/schemas/settings.schema.json

$ git diff packages/vscode-ide-companion/schemas/settings.schema.json
(no output — generated file matches committed version exactly)

Schema generation is idempotent. The committed settings.schema.json matches what the generator produces from the source.

Generated schema verification

$ node -e "const s=require('./packages/vscode-ide-companion/schemas/settings.schema.json'); ..."
importFormat: {"description":"The format to use when importing memory.","type":"string"}
dnsResolutionOrder: {"description":"The DNS resolution order.","type":"string"}

On main (current branch), both settings are still "type":"string". After this PR merges, the generator will produce "enum":["tree","flat"] and "enum":["ipv4first","verbatim"] respectively — confirmed by tracing the generator logic (it extracts options.map(o => o.value) when the options array is non-empty).

Result: PASS

中文说明

代码审查

干净。两个设置(importFormatdnsResolutionOrder)从 type: 'string' 改为 type: 'enum' 并加上正确的 options 数组,和文件中其他 9 个 enum 设置的模式一致。类型(MemoryImportFormatDnsResolutionOrder)已经有定义了——PR 只是把它们在 schema 里体现出来。生成的 JSON schema 和生成器脚本输出一致(跑过 npm run generate:settings-schema 确认零 diff)。

测试聚焦:两个新的 it() 断言各自的 enum 类型和选项。没有无关改动,没有范围蔓延。

Stage 1 提出的问题仍然成立——文档 Type 列用了 "tree" or "flat" 但其他 enum 设置都写的 string@wenshao 的建议是对的:要么全部升级(更好但超出本 PR 范围),要么这里恢复成 string 保持一致。

测试

这是非 UI 的 schema 定义改动,测试重点是单元测试和 schema 生成,而非 TUI 交互。

单元测试 22/22 通过(20 个已有 + 2 个新增)。Schema 生成幂等,生成文件和提交文件完全匹配。

结果:通过

Qwen Code · qwen3.7-max

@qwen-code-ci-bot

Copy link
Copy Markdown
Collaborator

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 type: 'enum' + options structure), the generated JSON schema is correct and idempotent, and the tests are focused.

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 "tree" or "flat" and "ipv4first" or "verbatim" while every other enum setting in the file still says string. The quoted-value format is genuinely more useful for users, but mixing two conventions in the same table is worse than either convention alone.

My suggestion: revert these two to string in the docs for now (matching the existing convention), and open a follow-up PR that upgrades all enum settings to the quoted-value format in one shot. That way we get the better format without the inconsistency. Small fix, then a bigger win.

Everything else is ship-ready.

中文说明

整体来看:这是一个干净、范围恰当的 PR,完全兑现了它的目标。两个在运行时已经有固定取值范围的设置,在 schema 里被正确地反映为枚举。实现遵循了现有模式(另外 9 个枚举设置用的都是 type: 'enum' + options 结构),生成的 JSON schema 正确且幂等,测试也很聚焦。

如果让我独立做这个改动,我大概会产出基本一样的 diff。代码部分没问题。

唯一卡住的地方是 @wenshao 指出的文档不一致——Type 列现在写的是 "tree" or "flat""ipv4first" or "verbatim",但文件中其他所有枚举设置还是写的 string。带引号值的格式对用户确实更友好,但同一张表里混用两种格式比用哪种都差。

建议: 文档里这两个先恢复成 string(保持现有惯例),然后开一个后续 PR 把所有枚举设置统一升级成带引号值的格式。小改动先行,大改进随后。

其他部分都可以合并。

Qwen Code · qwen3.7-max

@qwen-code-ci-bot qwen-code-ci-bot 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.

Docs Type column inconsistency needs fixing before merge — see my notes above. The code itself is solid. 🙏

@wenshao

wenshao commented Jun 19, 2026

Copy link
Copy Markdown
Collaborator

✅ Maintainer verification — local build + schema regeneration + tests (head 0ca5589c)

Verified the head (0ca5589c, Node v22.22.2, macOS) in an isolated worktree — full build, schema regeneration, the focused tests, type-check, and lint.

TL;DR: clean, low-risk schema tightening — recommend merge. It builds, type-checks, all focused tests pass, npm run generate:settings-schema reproduces the committed settings.schema.json exactly, the enum values match the runtime union types exactly, and there is no runtime behavior change (both settings stay showInDialog: false and are read directly — they are not schema-validated at load). The CI-bot CHANGES_REQUESTED was only about the PR-template format, which the author has since fixed. The one open item is the docs Type-column convention (the earlier /review suggestion) — non-blocking.

Build, type & lint

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 个改动文件) ✅ 干净
eslintsettingsSchema.ts + 测试) ✅ exit 0

注:首次在复用的 worktree 上跑 cli typecheck 曾报与本 PR 无关的错误(showResponseTokensPerSecondcompactToolResultDisplayForHistory 等),那是 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 treeflat MemoryImportFormat = 'tree' | 'flat'settingsSchema.ts:260 ✅ 完全一致
advanced.dnsResolutionOrder ipv4firstverbatim DnsResolutionOrder = 'ipv4first' | 'verbatim':261 ✅ 完全一致

两组选项相对真实的 TypeScript 联合类型既完整又正确(运行时用法也佐证:config.ts:1820importFormat 默认为 'tree'gemini.tsx:125dnsResolutionOrder 默认为 '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.renderModegeneral.defaultFileEncodingtools.approvalMode)。这种引号枚举格式恰好只出现在这 2 行main 上 0 行 —— 是全新、无先例的混合约定。

非阻塞(文档两种写法都准确)。最干净的处理:把这 2 个 Type 单元格改回 string 以匹配现有约定(改动最小);或者——若更倾向于更丰富的格式——在后续 PR 中统一应用到所有枚举行。由作者定夺。

结论

建议合并。 构建通过、类型干净、聚焦测试全绿、生成的 schema 已同步、枚举值完全正确、无运行时行为变化 —— 是一次整洁的 schema/文档对齐。CI bot 的阻塞仅为模板问题(已解决)。文档 Type 列约定为非阻塞建议。(注:目前只跑了 authorize/triage,完整的 Test/Lint/CodeQL 矩阵应触发并转绿后再合并;本次本地验证在 macOS 上覆盖了该范围。)

@tt-a1i
tt-a1i force-pushed the fix/context-import-format-schema branch from 0ca5589 to ed8f067 Compare June 19, 2026 19:04
@wenshao

wenshao commented Jun 19, 2026

Copy link
Copy Markdown
Collaborator

@qwen-code /triage

@qwen-code-ci-bot

Copy link
Copy Markdown
Collaborator

Thanks for the PR, and for the follow-up commit (ed8f067) that addresses the docs Type-column inconsistency flagged in the previous triage round. ✅

On direction: clearly aligned. Two settings already have a small fixed value set enforced at runtime (MemoryImportFormat = 'tree' | 'flat', DnsResolutionOrder = 'ipv4first' | 'verbatim'), but the schema described them as open strings. Tightening the schema to match reality is straightforward and useful — better editor completion, earlier validation errors. CHANGELOG has no direct reference but the area (schema/CLI alignment) is well within scope.

On approach: the diff is now minimal (3 files, +41/-6) after the docs revert, and follows the existing type: 'enum' + options pattern used by many other settings in the same file. The docs revert is the right call for this PR — upgrading all enum docs to the quoted-value format is a worthwhile follow-up, but belongs in its own PR.

No concerns. Moving on to code review. 🔍

中文说明

感谢 PR,也感谢后续提交 ed8f067 解决了上一轮 triage 提出的文档 Type 列不一致问题。✅

方向:明确对齐。两个设置在运行时已经有固定的取值范围(MemoryImportFormat = 'tree' | 'flat'DnsResolutionOrder = 'ipv4first' | 'verbatim'),但 schema 里还描述成自由字符串。把 schema 收窄到和实际一致,对编辑器补全和提前校验都有帮助。CHANGELOG 无直接引用,但该领域(schema/CLI 对齐)完全在范围内。

方案:在 docs 回退后,diff 现在很精简(3 个文件,+41/-6),遵循已有的 type: 'enum' + options 模式。docs 回退是本 PR 的正确选择——把所有枚举文档统一升级成带引号值的格式值得做,但应放到单独的后续 PR。

没有顾虑。进入代码审查 🔍

Qwen Code · qwen3.7-max

@qwen-code-ci-bot

Copy link
Copy Markdown
Collaborator

Code Review

Clean. The two settings (importFormat, dnsResolutionOrder) are changed from type: 'string' to type: 'enum' with the correct options arrays, matching the existing pattern used by other enum settings in the same file. The types (MemoryImportFormat, DnsResolutionOrder) were already defined at settingsSchema.ts:260-261 — the PR just surfaces them in the schema. The generated JSON schema is consistent with what the generator script produces:

  • generate-settings-schema.ts:138-141 maps options.map(o => o.value)enum and appends Options: … to the description.
  • The committed settings.schema.json shows exactly that output for both settings ("enum": ["tree","flat"] and "enum": ["ipv4first","verbatim"]).

Runtime usage is consistent:

  • config.ts:1138 defaults memoryImportFormat to 'tree' — matches the first option.
  • settings.test.ts and the migration mappings in v1-to-v2-shared.ts already reference both keys, so no downstream surprises.

Tests are focused: two new it() blocks that assert the enum type and options for each setting, mirroring the existing ui.renderMode test pattern. No unrelated changes, no scope creep. The docs revert in ed8f067 cleanly removes the inconsistency without scope creep.

No blockers.

Testing

This 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 node_modules — code read + generator trace)

  • settingsSchema.ts:1389-1403 and :2316-2328 — both settings use type: 'enum' + options with values matching the runtime unions at :260-261. ✅
  • generate-settings-schema.ts:138-141 — generator logic produces "enum": [...] and Options: … description suffix when options is non-empty. ✅
  • settings.schema.json:608-614 and :1080-1086 — committed generated output matches what the generator would produce from the source. ✅
  • docs/users/configuration/settings.md:240, :456 — both settings' Type column reads string, matching every other enum setting in the file. Consistency restored. ✅
  • settingsSchema.test.ts:327-335, :402-411 — new assertions follow the existing ui.renderMode enum test pattern (assert type === 'enum' and exact options array). ✅

Prior verification (maintainer, macOS, head 0ca5589c)

The maintainer @wenshao already ran the full matrix locally against this PR's code:

  • npm run build
  • cli tsc --noEmit ✅ 0 errors
  • prettier --check (4 changed files) ✅
  • eslint
  • npm run generate:settings-schema → zero diff against committed file ✅
  • settingsSchema.test.ts 24/24 pass, gemini.test.tsx 25/25 pass, settings.test.ts 133/133 pass ✅

Result: PASS

中文说明

代码审查

干净。两个设置(importFormatdnsResolutionOrder)从 type: 'string' 改为 type: 'enum' 并加上正确的 options 数组,和文件中其他枚举设置的模式一致。类型(MemoryImportFormatDnsResolutionOrder)在 settingsSchema.ts:260-261 已经有定义——PR 只是把它们在 schema 里体现出来。生成的 JSON schema 与生成器脚本输出一致:

  • generate-settings-schema.ts:138-141options.map(o => o.value) 映射为 enum,并在描述后追加 Options: …
  • 提交的 settings.schema.json 两个设置完全符合预期("enum": ["tree","flat"]"enum": ["ipv4first","verbatim"])。

运行时用法一致:config.ts:1138 默认 'tree' 与首个选项匹配;settings.test.tsv1-to-v2-shared.ts 的迁移映射已经引用这两个键,无下游意外。

测试聚焦:两个新 it() 断言各自的 enum 类型和选项,沿用了既有 ui.renderMode 枚举测试的模式。无无关改动、无范围蔓延。ed8f067 的 docs 回退干净地消除了不一致性,没有夹带额外改动。

无阻塞项。

测试

这是非 UI 的 schema 定义改动,测试重点是单元测试和 schema 生成,而非 TUI 交互。

代码层验证(worktree,本地无 node_modules——代码阅读 + 生成器跟踪)

  • settingsSchema.ts:1389-1403:2316-2328——两个设置都用 type: 'enum' + options,值与 :260-261 的运行时联合类型匹配。✅
  • generate-settings-schema.ts:138-141——options 非空时生成器产出 "enum": [...]Options: … 描述后缀。✅
  • settings.schema.json:608-614:1080-1086——提交的生成输出与源码生成结果一致。✅
  • docs/users/configuration/settings.md:240, :456——两个设置的 Type 列都是 string,与文件中其他枚举设置一致。一致性恢复。✅
  • settingsSchema.test.ts:327-335, :402-411——新断言沿用既有 ui.renderMode 枚举测试模式(断言 type === 'enum' 和精确 options 数组)。✅

先前验证(维护者,macOS,head 0ca5589c

@wenshao 已经在本地对本 PR 代码跑了完整矩阵:build / typecheck / prettier / eslint 全过;npm run generate:settings-schema 与提交文件零 diff;settingsSchema.test.ts 24/24、gemini.test.tsx 25/25、settings.test.ts 133/133 通过。✅

结果:通过

Qwen Code · qwen3.7-max

@qwen-code-ci-bot

Copy link
Copy Markdown
Collaborator

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 ed8f067. The author made the right call — revert the docs to the existing string convention rather than introduce a mixed-format table, leaving the broader quoted-value upgrade as a separate follow-up.

If I had been asked to do this change independently, I would have produced essentially the same diff: flip two type: 'string' to type: 'enum', add the options arrays, regenerate the JSON schema, add two focused assertions. The code is the easy part and it's right.

Reflection checklist:

  • Matches my independent proposal ✅
  • Solves something users actually care about (editor completion / schema validation for these two settings) ✅
  • Code is straightforward — no over-engineering, no abstraction creep ✅
  • Every change in the diff is necessary; no drive-by refactors or scope creep ✅
  • Maintainer-verified results match what the PR promised ✅
  • Easy to maintain in six months — it's a schema entry, nothing surprising ✅

Approving. ✅

中文说明

整体来看:这是一个干净、范围恰当的 PR,完全兑现了目标;上一轮提出的文档 Type 列不一致问题也通过后续提交 ed8f067 解决了。作者做了正确的选择——把 docs 回退到现有的 string 惯例,而不是在表格里引入混合格式,把更大范围的带引号值升级留作单独的后续 PR。

如果让我独立做这个改动,我大概会产出基本一样的 diff:把两个 type: 'string' 改成 type: 'enum'、加上 options 数组、重新生成 JSON schema、新增两个聚焦的断言。代码部分没问题,也确实是对的。

反思清单:

  • 与我的独立方案一致 ✅
  • 解决了用户真正在意的事(这两个设置的编辑器补全 / schema 校验)✅
  • 代码直白——无过度工程、无抽象蔓延 ✅
  • diff 中每一处改动都必要,无顺手重构或范围蔓延 ✅
  • 维护者验证结果与 PR 承诺一致 ✅
  • 六个月后易于维护——就是个 schema 条目,毫无意外 ✅

批准合并。✅

Qwen Code · qwen3.7-max

@qwen-code-ci-bot qwen-code-ci-bot 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.

LGTM — schema tightening is clean, docs inconsistency addressed in ed8f067, maintainer-verified tests green. Ready to ship. ✅

@wenshao

wenshao commented Jun 19, 2026

Copy link
Copy Markdown
Collaborator

✅ Maintainer re-verification on current head — ed8f067b (supersedes my earlier note on 0ca5589c)

Re-ran the full local verification against the current head (ed8f067b, Node v22.22.2, macOS) in a fresh isolated worktree, because the head moved since my last review (rebase + a new docs commit).

TL;DR: clean, low-risk schema tightening — recommend merge. It builds, type-checks across all workspaces, all focused tests pass, npm run generate:settings-schema reproduces the committed settings.schema.json exactly, the enum values match the runtime accepted set exactly, the 2 new tests are non-vacuous (mutation-proven), and there is no runtime behavior change. The one open item from my previous review is now resolved.

What changed since 0ca5589c

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 (stringenum). 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 (importFormat falls through to tree; dnsResolutionOrder warns + defaults to ipv4first).
  • 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 中针对当前 headed8f067b,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 描述里提到 typecheckacp-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 注意事项不再复现
eslintsettingsSchema.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 treeflat MemoryImportFormat = 'tree' | 'flat'settingsSchema.ts:260);在 memoryImportProcessor.ts:239=== 'flat' 分派(否则 tree),默认 'tree'config.ts:1494 ✅ 完全一致且完整
advanced.dnsResolutionOrder ipv4firstverbatim DnsResolutionOrder = 'ipv4first' | 'verbatim'settingsSchema.ts:261);显式运行时校验器 validateDnsResolutionOrder 只接受这两个值(gemini.tsx:134),否则告警并回退到 ipv4first,再传给 dns.setDefaultResultOrdergemini.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 个新测试失败 —— 它们真正守护了枚举,失败信息本身就是前后对比(stringenum)。之后已恢复源码,工作树干净。

无运行时行为变化

type: 'string'type: 'enum' 只影响生成的 schema(编辑器补全 / IDE 校验),不会新增会拒绝现有配置的加载期校验:

  • 两个设置都保持 showInDialog: falsesettingsSchema.ts:1389:2312)→ 永远不会出现在设置对话框,所以 enum/string 的渲染分支对它们无关。
  • 运行时直接读取值,且本就容忍未知值(importFormat 落到 treednsResolutionOrder 告警并默认 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/文档对齐。

@wenshao

wenshao commented Jun 19, 2026

Copy link
Copy Markdown
Collaborator

✅ Local real-build verification — merge-ready

I built the real qwen binary from this PR's head (ed8f067) in an isolated worktree and verified the change end-to-end (schema regeneration, focused tests, a non-vacuous mutation test, full build + typecheck, and a real-binary tmux A/B). Everything checks out; this is a clean, well-scoped, low-risk change.

What this PR does

Narrows two settings in the generated schema from generic string to their real enums:

  • context.importFormattree | flat
  • advanced.dnsResolutionOrderipv4first | verbatim

Results

Check Result
npm run build (real binary) ✅ exit 0
npm run typecheck (tsc --noEmit, all workspaces) 0 TS errors
Schema regen drift (npm run generate:settings-schemagit diff) empty — committed settings.schema.json is exactly reproducible
Focused tests (settingsSchema.test.ts + gemini.test.tsx) 49 passed
Mutation test (revert source, keep tests) 2 new tests fail → non-vacuous
Real-binary tmux A/B (DNS whitelist) ✅ enum boundary == runtime boundary
CI on ed8f067 ✅ Lint, CodeQL, Test (macOS + ubuntu); windows in-progress at capture

Key findings

1. The enum values are not arbitrary — they exactly mirror the runtime contract. This is the strongest merge signal.

  • DnsResolutionOrder = 'ipv4first' \| 'verbatim' (settingsSchema.ts:261), and the runtime validator accepts exactly those two — anything else is rejected and falls back to default:
    // gemini.tsx:134 (validateDnsResolutionOrder, feeds dns.setDefaultResultOrder at :499)
    if (order === 'ipv4first' || order === 'verbatim') { return order; }
    // else: warn "Invalid value for dnsResolutionOrder…" + use default 'ipv4first'
  • MemoryImportFormat = 'tree' \| 'flat' (settingsSchema.ts:260); runtime only special-cases flat (memoryImportProcessor.ts:239), everything else = tree.
  • Note: Node's dns.setDefaultResultOrder also accepts ipv6first, but qwen deliberately does not — so narrowing the schema to {ipv4first, verbatim} correctly matches qwen's own whitelist, not Node's superset.

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:

  ipv4first  -> ACCEPTED silently (in enum, valid)
  verbatim   -> ACCEPTED silently (in enum, valid)
  ipv6first  -> REJECTED at runtime: Invalid value for dnsResolutionOrder in settings: "ipv6first". Using default "ipv4first".
  foobar     -> REJECTED at runtime: Invalid value for dnsResolutionOrder in settings: "foobar". Using default "ipv4first".

3. Mutation test proves the new tests guard the change. Reverting only settingsSchema.ts to its pre-PR state (keeping the PR's tests) fails exactly the two new tests:

× should define context.importFormat as tree or flat        → expected 'string' to be 'enum'
× should define advanced.dnsResolutionOrder as ipv4first…    → expected 'string' to be 'enum'
Tests  2 failed | 22 passed (24)

4. type: 'enum' is an established pattern (12 existing settings already use it), and the generator handles it correctly (generate-settings-schema.ts:137-146 maps optionsenum + appends "Options: …" to the description). Regeneration produced no diff, so the committed JSON is faithful.

5. Docs consistency is correct. The 3rd commit reverts docs/.../settings.md's Type column back to string for these two rows — this matches how every other enum is documented there (defaultFileEncoding, renderMode, approvalMode all show string). settings.md is hand-maintained (no generator), so this is an intentional consistency fix, not drift; the net change to settings.md vs base is zero (hence changedFiles: 3).

Scope / honesty

Both settings are showInDialog: false, so there is no settings-dialog TUI surface to A/B — the real-binary verification is the startup DNS-validation A/B above, not a TUI capture. Runtime behavior is not made stricter by this PR (the validators already existed); only the editor-facing JSON schema is tightened, exactly as the PR claims.

Optional, non-blocking follow-up: unlike approvalMode/renderMode, the settings.md descriptions for these two don't list their valid values. A reader of the markdown table still won't see tree/flat etc. Pre-existing and out of scope — worth a future polish, not a merge blocker.

Verdict

Merge-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(ed8f067)构建了真实的 qwen 二进制,并做了端到端验证(schema 重新生成、定向测试、非空洞性的变异测试、完整 build + typecheck,以及真实二进制的 tmux A/B)。全部通过;这是一个干净、范围清晰、低风险的改动。

本 PR 做了什么

把生成 schema 里两个设置项从通用 string 收窄为真实枚举:

  • context.importFormattree | flat
  • advanced.dnsResolutionOrderipv4first | verbatim

验证结果

检查项 结果
npm run build(真实二进制) ✅ exit 0
npm run typecheck(tsc --noEmit,全部 workspace) 0 个 TS 错误
Schema 重新生成漂移(generate:settings-schemagit diff 为空 —— 提交的 settings.schema.json 完全可复现
定向测试(settingsSchema.test.ts + gemini.test.tsx 49 passed
变异测试(回退源码、保留测试) 2 个新测试失败 → 非空洞
真实二进制 tmux A/B(DNS 白名单) ✅ 枚举边界 == 运行时边界
ed8f067 上的 CI ✅ Lint、CodeQL、Test(macOS + ubuntu);截图时 windows 仍在跑

关键发现

1. 枚举值不是拍脑袋定的 —— 它精确镜像了运行时契约。 这是最强的合并信号。

  • DnsResolutionOrder = 'ipv4first' | 'verbatim'settingsSchema.ts:261),而运行时校验器恰好只接受这两个值,其它一律拒绝并回退到默认:
    // gemini.tsx:134(validateDnsResolutionOrder,在 :499 喂给 dns.setDefaultResultOrder)
    if (order === 'ipv4first' || order === 'verbatim') { return order; }
    // 否则:告警 "Invalid value for dnsResolutionOrder…" 并使用默认 'ipv4first'
  • MemoryImportFormat = 'tree' | 'flat'settingsSchema.ts:260);运行时只对 flat 做特殊处理(memoryImportProcessor.ts:239),其余都按 tree。
  • 注意:Node 的 dns.setDefaultResultOrder 其实还接受 ipv6first,但 qwen 故意支持 —— 所以把 schema 收窄到 {ipv4first, verbatim} 是匹配 qwen 自己的白名单(而非 Node 的超集),这是正确的。

2. 真实二进制 tmux A/B —— 用构建出的二进制跑「枚举内 vs 枚举外」的值,运行时边界与新枚举完全一致:

  ipv4first  -> 静默接受(在枚举内,合法)
  verbatim   -> 静默接受(在枚举内,合法)
  ipv6first  -> 运行时拒绝: Invalid value for dnsResolutionOrder in settings: "ipv6first". Using default "ipv4first".
  foobar     -> 运行时拒绝: Invalid value for dnsResolutionOrder in settings: "foobar". Using default "ipv4first".

3. 变异测试证明新测试确实守护了改动。 只把 settingsSchema.ts 回退到 PR 前状态(保留 PR 的测试),恰好这两个新测试失败:

× should define context.importFormat as tree or flat        → expected 'string' to be 'enum'
× should define advanced.dnsResolutionOrder as ipv4first…    → expected 'string' to be 'enum'
Tests  2 failed | 22 passed (24)

4. type: 'enum' 是既有模式(已有 12 个设置在用),生成器也正确处理(generate-settings-schema.ts:137-146:把 options 映射成 enum,并往描述里追加 "Options: …")。重新生成无 diff,说明提交的 JSON 是忠实的。

5. 文档一致性是对的。 第 3 个 commit 把 docs/.../settings.md 里这两行的 Type 列回退成 string —— 这与该文件里其它所有枚举的写法一致(defaultFileEncodingrenderModeapprovalMode 都写 string)。settings.md 是手工维护的(没有生成器),所以这是有意的一致性修正而非漂移;相对 base,settings.md 净变化为零(因此 changedFiles: 3)。

范围 / 诚实说明

两个设置都是 showInDialog: false,所以没有设置面板 TUI 界面可做 A/B —— 真实二进制验证用的是上面启动期的 DNS 校验 A/B,而不是 TUI 截图。本 PR没有让运行时变得更严格(校验器本来就存在),只是收紧了面向编辑器的 JSON schema,与 PR 描述完全一致。

可选、非阻塞的后续:approvalMode/renderMode 不同,settings.md 里这两项的描述没有列出合法取值。只看 markdown 表格的读者仍看不到 tree/flat 等值。这是既有问题且超出本 PR 范围 —— 可作为将来的打磨项,不是合并阻塞。

结论

可以合并。 ✅ schema 现在与运行时契约精确一致,测试非空洞,build/typecheck/CI 全绿,生成产物可复现。

@wenshao
wenshao merged commit 859a49d into QwenLM:main Jun 19, 2026
34 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