WeKnora/frontend/src
wizardchen 6f95c75ed2 feat(system-info): surface DB migration errors with troubleshooting links
When a startup database migration fails (e.g. issue #1319: pg_trgm not
available so 000041 cannot build its trigram index), the application
intentionally keeps booting so operators can reach the UI to diagnose.
However, before this change the system info page silently dropped the
"DB Version" row because the value was empty:

  - migration.go only cached the version after a successful m.Up(); the
    error path returned early and left migrationVersionSet=false.
  - system.go used CachedMigrationVersion's ok=false to skip emitting
    db_version, and the JSON tag was already omitempty.
  - SystemInfo.vue gated the entire row on v-if="systemInfo?.db_version".

The end result was the most useful diagnostic surface vanishing in the
exact failure mode that needs it most — Wiki ingest and KG features
would silently produce nothing with no UI hint.

Changes:

  - migration.go: replace sync.Once-based setter with an RWMutex-guarded
    state struct holding {version, dirty, err}. Every failure path now
    calls captureMigrationFailure(m, err), which best-effort reads
    m.Version() so the cached value still reflects the partial state.
  - system.go (handler): always emit db_version (falling back to
    "unknown" when no version could be read), append " (failed)" when an
    error is recorded, and add db_migration_error to the response.
  - swagger / client SDK: keep the API contract in sync with the new
    response field.
  - SystemInfo.vue: render the DB version row whenever either field is
    present, show a "Migration failed" danger tag, and add a full-width
    alert below the row carrying the error message plus two links:
      1. View troubleshooting guide -> new docs/migration-troubleshooting.md
      2. Report an issue -> github.com/Tencent/WeKnora/issues/new,
         prefilled with the captured error and environment metadata.
  - docs/migration-troubleshooting.md: new self-service guide covering
    the common failure modes (missing extension, dirty state, privileges,
    out of disk, schema drift) with concrete psql / make commands.
  - i18n: add the new keys to zh-CN, en-US, ko-KR, ru-RU.

Refs #1319.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-14 16:34:50 +08:00
..
api feat(system-info): surface DB migration errors with troubleshooting links 2026-05-14 16:34:50 +08:00
assets fix(frontend): polish model settings UI and fix disabled brand color 2026-05-07 21:51:22 +08:00
components fix(agent): relax rerank model requirement for custom agents 2026-05-12 16:57:24 +08:00
composables fix(frontend): make general-settings font picker actually work 2026-05-07 15:07:24 +08:00
hooks feat(knowledge-base): document list filters and explicit batch-management UX 2026-05-12 18:29:47 +08:00
i18n feat(system-info): surface DB migration errors with troubleshooting links 2026-05-14 16:34:50 +08:00
router feat(frontend): replace standalone search page with global command palette 2026-05-06 16:26:22 +08:00
stores feat(frontend): replace standalone search page with global command palette 2026-05-06 16:26:22 +08:00
types feat(frontend): chunking debug panel with live preview 2026-05-06 17:17:07 +08:00
utils fix(agent): exclude wiki-only KBs from quick-answer (RAG) mode 2026-05-12 16:27:28 +08:00
views feat(system-info): surface DB migration errors with troubleshooting links 2026-05-14 16:34:50 +08:00
wailsjs feat: implement automatic update checking and downloading functionality in the desktop app, enhancing user experience with seamless updates and corresponding UI settings 2026-04-11 18:51:16 +08:00
App.vue fix(frontend): make general-settings font picker actually work 2026-05-07 15:07:24 +08:00
main.ts perf(wiki): lazy-load sidebar page list with virtual-scroll tabs 2026-05-08 15:07:59 +08:00