WeKnora/frontend/src/api
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
..
agent feat(im): tenant-wide IM channels overview under the user menu 2026-04-30 15:29:14 +08:00
auth fix oidc auth login 2026-05-05 00:21:41 +08:00
chat feat(observability): log end-to-end TTFB on both ends of chat stream 2026-05-12 21:16:37 +08:00
chunker feat(frontend): chunking debug panel with live preview 2026-05-06 17:17:07 +08:00
datasource feat(frontend): tree view resource selector with cascading selection 2026-04-08 16:31:25 +08:00
initialization fix(chunker): QA audit — pointer DTOs, profile reuse, stats correctness 2026-05-06 17:17:07 +08:00
knowledge-base feat(knowledge-base): document list filters and explicit batch-management UX 2026-05-12 18:29:47 +08:00
model feat(models): support custom HTTP headers across all remote model calls 2026-04-23 23:36:40 +08:00
organization feat(api): integrate per-organization resource counts into organization listing 2026-02-09 11:40:25 +08:00
skill feat: enhance agent skills sandbox configuration and availability 2026-02-04 20:58:24 +08:00
system feat(system-info): surface DB migration errors with troubleshooting links 2026-05-14 16:34:50 +08:00
tenant feat(tenant): expose API Key reset from the API Info page 2026-04-29 20:07:38 +08:00
wiki perf(wiki): move ingest log to event table and index to on-demand API 2026-05-08 21:48:52 +08:00
chat-history.ts feat: implement chat history and retrieval settings 2026-03-09 11:46:56 +08:00
mcp-service.ts feat(agent): human-in-the-loop approval for MCP tool calls (#1173) 2026-05-10 22:57:12 +08:00
retrieval.ts feat: implement chat history and retrieval settings 2026-03-09 11:46:56 +08:00
vector-store.ts feat: add VectorStore management UI settings page 2026-04-17 21:51:25 +08:00
web-search-provider.ts feat(web-search): add SearXNG provider (#1166) 2026-05-11 16:53:47 +08:00
web-search.ts feat(web-search): refactor web search provider 2026-03-31 20:22:34 +08:00