Skip to content

fix(tools): migrate legacy community config files on startup - #2740

Open
HandSonic wants to merge 1 commit into
OtterMind:mainfrom
HandSonic:fix/config-legacy-file-migration
Open

fix(tools): migrate legacy community config files on startup#2740
HandSonic wants to merge 1 commit into
OtterMind:mainfrom
HandSonic:fix/config-legacy-file-migration

Conversation

@HandSonic

Copy link
Copy Markdown
Contributor

Related issue

N/A — regression found by reviewing the #2732 runtime-identity split; described below.

Summary

Upgrades from 4.0.0 silently reset the runtime config (systemUuid, networkStatus, latestStartupSuccessVersion) and minted a fresh client UUID: ConfigUtils only looks for the current runtime_config_{env}.json / client_uuid names, while 4.0.0 wrote enterprise_config_{env}.json / enterprise_client_uuid in the same directory, and nothing referenced the old names anymore. The client localStorage keys got the same treatment deliberately in a2333f5 — the server-side files were left orphaned.

Fix: one-time legacy migration where the files are resolved — when the current file is absent, a legacy sibling is copied to the current name (legacy files kept untouched as backup; copy via java.nio with logged, non-fatal error handling). Legacy names come from new default methods on ProductRuntimeIdentity (legacyRuntimeConfigFileName/legacyClientIdFileName) so other runtimes can override. No behavior change when the current file exists or neither exists.

Affected surfaces

  • Frontend / Web
  • Backend / API / Storage
  • Database plugin / Driver
  • JCEF / Desktop packaging
  • CI / Build / Release
  • Documentation only

Verification

Risk and compatibility

  • Public API or stored data: additive only — reads legacy files, never deletes them.
  • Database or driver compatibility: N/A.
  • Network, privacy, or security: N/A.
  • Community / Local / Pro boundary: the ProductRuntimeIdentity defaults return the community legacy names; a product whose legacy names differ overrides the default methods.
  • Backward compatibility: full — downgrades still find the legacy files untouched.

Reviewer map

  • Start here: ConfigUtils static block + migrateLegacyFile.
  • Failure condition: unreadable legacy file → logged warning, default config written (same as today).
  • Rollback or disable path: revert single commit; legacy files were never modified.

Contributor declaration

  • I linked the Issue that defines this change.
  • I tested the affected behavior and reported the actual results above.
  • I did not include credentials, private data, or generated build output.
  • I disclosed substantial AI assistance below, or this PR contains no substantial AI-generated code.

AI assistance: substantial — fix and tests drafted with AI assistance, verified locally.

Upgrades from releases that stored the runtime config as
enterprise_config_{env}.json and the client id as enterprise_client_uuid
silently reset systemUuid, network status, and latest startup version and
minted a new client id, because ConfigUtils only looked for the current
runtime_config_{env}.json / client_uuid names. The legacy files are now
copied once to the current names (legacy files kept as backup), with the
legacy names overridable via ProductRuntimeIdentity for other runtimes.
@HandSonic
HandSonic requested review from a team and openai0229 as code owners August 23, 2026 18:54
@openai0229 openai0229 moved this to In Review in Chat2DB Community Aug 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Review

Development

Successfully merging this pull request may close these issues.

2 participants