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>
This commit is contained in:
@@ -1674,6 +1674,11 @@ export default {
|
||||
goVersionDescription: "백엔드에서 사용하는 Go 언어 버전",
|
||||
dbVersionLabel: "데이터베이스 버전",
|
||||
dbVersionDescription: "현재 데이터베이스 마이그레이션 버전",
|
||||
dbMigrationFailedTag: "마이그레이션 실패",
|
||||
dbMigrationFailedTitle: "데이터베이스 마이그레이션 실패",
|
||||
dbMigrationFailedDesc: "시작 시 데이터베이스 마이그레이션이 정상적으로 완료되지 않았습니다. 일부 테이블이나 인덱스가 생성되지 않았을 수 있으며, Wiki와 지식 그래프 기능 등이 동작하지 않을 수 있습니다. 먼저 아래 문제 해결 문서를 확인하여 직접 복구해 보고, 그래도 해결되지 않으면 이슈를 등록해 주세요.",
|
||||
dbMigrationViewDocs: "문제 해결 문서 보기",
|
||||
dbMigrationReportIssue: "해결되지 않나요? 이슈 등록",
|
||||
keywordIndexEngineLabel: "키워드 인덱스 엔진",
|
||||
keywordIndexEngineDescription: "현재 사용 중인 키워드 인덱스 엔진",
|
||||
vectorStoreEngineLabel: "벡터 저장소 엔진",
|
||||
|
||||
Reference in New Issue
Block a user