Skip to content

fix(config): preserve valid fields during migration#893

Merged
XingYu-Zhong merged 3 commits into
KunAgent:developfrom
luoye520ww:codex/fix-884-provider-diagnostics
Jul 18, 2026
Merged

fix(config): preserve valid fields during migration#893
XingYu-Zhong merged 3 commits into
KunAgent:developfrom
luoye520ww:codex/fix-884-provider-diagnostics

Conversation

@luoye520ww

@luoye520ww luoye520ww commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fix GUI-managed Kun config sanitization so one stale or unknown option cannot discard an otherwise valid config section. This closes the remaining failure mode behind #886 on older config files.

Scope

This PR is intentionally limited to preserving known valid fields while removing legacy fields. It is not a full schema-version migration; that remains a separate follow-up with its own backup, migration, and downgrade tests.

Changes

  • Retry strict section parsing with the schema's known keys when an old top-level option is present.
  • Validate known nested values independently so an obsolete nested option does not erase unrelated runtime settings.
  • Keep invalid known values rejected; no secrets are newly persisted by this change.
  • Add a regression assertion that a valid runtime token survives sanitization while the legacy key is removed.

Tests

npm.cmd exec vitest run src/main/kun-process.test.ts
npm.cmd run typecheck
npm.cmd run lint -- --quiet
npm.cmd run build
git diff --check

Results: 45 kun-process tests passed; Typecheck, lint, build, and diff check passed locally.

CI note

The previous GitHub run executed 55 tests successfully, then failed in the extension release gate while downloading the Electron binary (TypeError: fetch failed / Electron failed to install correctly). No changed config code was involved. The next synchronized run should be used to revalidate the external download step.

Issue

Part of #886

@himetuki

Copy link
Copy Markdown

米游姬 好耶

米游姬 好耶

加油💪

@XingYu-Zhong XingYu-Zhong 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.

Reviewed against current develop after branch update. Scope is focused, the change remains needed, and no blocking issue was found. Required CI must pass before merge.

@XingYu-Zhong
XingYu-Zhong merged commit cb7d28c into KunAgent:develop Jul 18, 2026
4 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