fix: system backup history queries use wrong column names#2421
Conversation
The v3.7 baseline creates system_backup_history with camelCase columns (backupPath, backupType, totalSize, etc.) but the INSERT and SELECT queries were using snake_case names (dirname, type, size, etc.). This caused "no such column: backupPath" on SQLite when listing backups, and silently failed INSERTs meaning no backup history was ever recorded. Fixed all queries (SELECT, INSERT, DELETE) across all three backends to use the baseline schema's column names. Fixes #2419 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Claude finished @Yeraze's task —— View job PR Code ReviewReviewing PR #2421: fix: system backup history queries use wrong column names Tasks
Review Summary ✅This PR successfully fixes a critical bug where backup history operations were failing due to column name mismatches. The fix is well-implemented and addresses the root cause effectively. Code Quality AssessmentExcellent Fix Quality ✅
Technical AnalysisDatabase Compatibility ✅
Query Analysis ✅
Performance & SecurityPerformance: ✅ No performance impact - same query patterns, just corrected column names Test Coverage Gaps 🔍The PR description identifies a critical testing gap:
Recommendations for Better Test Coverage:
Minor Suggestions
Verification ChecklistBefore merging, please verify:
ConclusionThis is a well-executed bug fix that:
Recommendation: APPROVE - This fix resolves a critical functionality bug with no apparent risks. --- | Branch: fix/backup-history-column-names |
Summary
Fixes "View Saved Backups" failing with
SqliteError: no such column: backupPathon all database backends.Root cause: The v3.7 baseline migration creates
system_backup_historywith camelCase columns (backupPath,backupType,totalSize,tableCount,appVersion,schemaVersion), but during the async refactoring the INSERT and SELECT queries were rewritten to use snake_case names (dirname,type,size,table_count,meshmonitor_version,schema_version). This meant:Why tests didn't catch it: The backup system test only checks HTTP 200 and that a backup dirname appears in the list. Since INSERTs were failing, listBackups returned empty arrays (no SQL error). The API exercise test only checks status codes.
Fixes #2419
Changes
src/server/services/systemBackupService.tsTest plan
npx vitest run— all tests passnpm run build— no TypeScript errors🤖 Generated with Claude Code