From dc82c5393bba327908ff0e846e796902a179d741 Mon Sep 17 00:00:00 2001 From: Vaclav Eder Date: Thu, 9 Apr 2026 11:41:54 +0200 Subject: [PATCH 1/2] fix: debug server /tuning-history returns correct field names The endpoint was mapping non-existent field names (r.type instead of r.tuningType, r.appliedChanges instead of r.appliedPIDChanges) and omitting verification metrics, convergence data, and log IDs entirely. Co-Authored-By: Claude Opus 4.6 (1M context) --- src/main/debug/DebugServer.ts | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/main/debug/DebugServer.ts b/src/main/debug/DebugServer.ts index 1c0e5fd5..31a7aedd 100644 --- a/src/main/debug/DebugServer.ts +++ b/src/main/debug/DebugServer.ts @@ -473,14 +473,23 @@ async function getTuningHistory() { totalSessions: records.length, records: records.map((r: any) => ({ id: r.id, - type: r.type, + tuningType: r.tuningType, completedAt: r.completedAt, - phase: r.phase, - qualityScore: r.qualityScore, + startedAt: r.startedAt, filterMetrics: r.filterMetrics, pidMetrics: r.pidMetrics, - appliedChanges: r.appliedChanges, - dataQuality: r.dataQuality, + verificationMetrics: r.verificationMetrics, + verificationPidMetrics: r.verificationPidMetrics, + transferFunctionMetrics: r.transferFunctionMetrics, + appliedFilterChanges: r.appliedFilterChanges, + appliedPIDChanges: r.appliedPIDChanges, + appliedFeedforwardChanges: r.appliedFeedforwardChanges, + filterLogId: r.filterLogId, + pidLogId: r.pidLogId, + verificationLogId: r.verificationLogId, + convergence: r.convergence, + qualityScore: r.qualityScore, + bfPidProfileIndex: r.bfPidProfileIndex, })), }; } catch (err: any) { From 07074b20fe3b6a3500fcae193b0045bdd20e9e4f Mon Sep 17 00:00:00 2001 From: Vaclav Eder Date: Thu, 9 Apr 2026 12:33:54 +0200 Subject: [PATCH 2/2] review: type record as CompletedTuningRecord, add missing fields Address CodePilot feedback: - Type `r` as CompletedTuningRecord (prevents future field-name mismatches) - Add quickLogId and verificationTransferFunctionMetrics Co-Authored-By: Claude Opus 4.6 (1M context) --- src/main/debug/DebugServer.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/debug/DebugServer.ts b/src/main/debug/DebugServer.ts index 31a7aedd..a67941c1 100644 --- a/src/main/debug/DebugServer.ts +++ b/src/main/debug/DebugServer.ts @@ -45,6 +45,7 @@ import { analyzePID, analyzeTransferFunction } from '../analysis/PIDAnalyzer'; import { extractFlightPIDs } from '../analysis/PIDRecommender'; import { validateBBLHeader, enrichSettingsFromBBLHeaders } from '../analysis/headerValidation'; import { DEFAULT_FILTER_SETTINGS } from '@shared/types/analysis.types'; +import type { CompletedTuningRecord } from '@shared/types/tuning-history.types'; const DEFAULT_PORT = 9300; const MAX_LOG_LINES = 500; @@ -471,7 +472,7 @@ async function getTuningHistory() { profileId: currentProfile.id, profileName: currentProfile.name, totalSessions: records.length, - records: records.map((r: any) => ({ + records: records.map((r: CompletedTuningRecord) => ({ id: r.id, tuningType: r.tuningType, completedAt: r.completedAt, @@ -481,11 +482,13 @@ async function getTuningHistory() { verificationMetrics: r.verificationMetrics, verificationPidMetrics: r.verificationPidMetrics, transferFunctionMetrics: r.transferFunctionMetrics, + verificationTransferFunctionMetrics: r.verificationTransferFunctionMetrics, appliedFilterChanges: r.appliedFilterChanges, appliedPIDChanges: r.appliedPIDChanges, appliedFeedforwardChanges: r.appliedFeedforwardChanges, filterLogId: r.filterLogId, pidLogId: r.pidLogId, + quickLogId: r.quickLogId, verificationLogId: r.verificationLogId, convergence: r.convergence, qualityScore: r.qualityScore,