From ed3184f6285cbd89099895b9b5c6cea1d1af2298 Mon Sep 17 00:00:00 2001 From: axiomlogicnexus Date: Thu, 30 Apr 2026 00:01:29 +0200 Subject: [PATCH] Retain aligned packet handoff history on dashboard --- .../HyperTwistCoachDashboardWidget.cpp | 113 ++++++++++++++++-- .../HyperTwistCoachDashboardWidget.h | 2 + 2 files changed, 105 insertions(+), 10 deletions(-) diff --git a/UnrealHyperTwist/Source/UnrealHyperTwist/Private/HyperTwistTraining/HyperTwistCoachDashboardWidget.cpp b/UnrealHyperTwist/Source/UnrealHyperTwist/Private/HyperTwistTraining/HyperTwistCoachDashboardWidget.cpp index e849152..8e9c2b0 100644 --- a/UnrealHyperTwist/Source/UnrealHyperTwist/Private/HyperTwistTraining/HyperTwistCoachDashboardWidget.cpp +++ b/UnrealHyperTwist/Source/UnrealHyperTwist/Private/HyperTwistTraining/HyperTwistCoachDashboardWidget.cpp @@ -42,6 +42,8 @@ namespace HyperTwistCoachDashboardWidgetInternal int32 RecommendedAcceptedDeltaCount = 0; int32 AlignedTightFollowUpOutcomeAcceptedDeltaCount = 0; int32 AlignedBroadRecommendedOutcomeAcceptedDeltaCount = 0; + int32 AlignedTightFollowUpPacketAcceptedDeltaCount = 0; + int32 AlignedBroadRecommendedPacketAcceptedDeltaCount = 0; int32 DeferredOverflowQueueAcceptedDeltaCount = 0; int32 DeferredOverflowFollowUpAcceptedDeltaCount = 0; int32 DeferredOverflowRecommendedAcceptedDeltaCount = 0; @@ -111,6 +113,7 @@ namespace HyperTwistCoachDashboardWidgetInternal bool bHasReliableAlignedTrustedTightPlanOutcomeSignal = false; bool bHasReliableAlignedTrustedBroadPlanOutcomeSignal = false; bool bHasAlignedGuidanceOutcomeAcceptedSignal = false; + bool bHasAlignedPacketAcceptedSignal = false; bool bHasSignal = false; }; @@ -323,17 +326,37 @@ namespace HyperTwistCoachDashboardWidgetInternal || SourceLabel.StartsWith(TEXT("coach-memory-method-drill-recovery-")); } + bool IsAlignedTightFollowUpOutcomeSourceLabel(const FString& SourceLabel) + { + return SourceLabel == TEXT("recommendation-history-aligned-tight-follow-up-outcome"); + } + + bool IsAlignedBroadRecommendedOutcomeSourceLabel(const FString& SourceLabel) + { + return SourceLabel == TEXT("recommendation-history-aligned-broad-recommended-outcome"); + } + + bool IsAlignedTightFollowUpPacketSourceLabel(const FString& SourceLabel) + { + return SourceLabel == TEXT("coach-memory-aligned-follow-up-packet-structure-tight-follow-up"); + } + + bool IsAlignedBroadRecommendedPacketSourceLabel(const FString& SourceLabel) + { + return SourceLabel + == TEXT("coach-memory-aligned-follow-up-packet-structure-broad-recommended"); + } + bool IsAlignedTightFollowUpGuidanceSourceLabel(const FString& SourceLabel) { - return SourceLabel == TEXT("recommendation-history-aligned-tight-follow-up-outcome") - || SourceLabel == TEXT("coach-memory-aligned-follow-up-packet-structure-tight-follow-up"); + return IsAlignedTightFollowUpOutcomeSourceLabel(SourceLabel) + || IsAlignedTightFollowUpPacketSourceLabel(SourceLabel); } bool IsAlignedBroadRecommendedGuidanceSourceLabel(const FString& SourceLabel) { - return SourceLabel == TEXT("recommendation-history-aligned-broad-recommended-outcome") - || SourceLabel - == TEXT("coach-memory-aligned-follow-up-packet-structure-broad-recommended"); + return IsAlignedBroadRecommendedOutcomeSourceLabel(SourceLabel) + || IsAlignedBroadRecommendedPacketSourceLabel(SourceLabel); } FString DescribeCoachMemorySourceLabel(const FString& SourceLabel) @@ -1419,6 +1442,10 @@ namespace HyperTwistCoachDashboardWidgetInternal bHasPreviousEntry ? PreviousEntry.AcceptedAlignedTightFollowUpOutcomeHandoffCount : 0; const int32 PreviousAlignedBroadRecommendedOutcomeCount = bHasPreviousEntry ? PreviousEntry.AcceptedAlignedBroadRecommendedOutcomeHandoffCount : 0; + const int32 PreviousAlignedTightFollowUpPacketCount = + bHasPreviousEntry ? PreviousEntry.AcceptedAlignedTightFollowUpPacketHandoffCount : 0; + const int32 PreviousAlignedBroadRecommendedPacketCount = + bHasPreviousEntry ? PreviousEntry.AcceptedAlignedBroadRecommendedPacketHandoffCount : 0; const int32 QueuedDelta = FMath::Max(0, Entry.AcceptedQueuedHandoffCount - PreviousQueuedCount); @@ -1461,6 +1488,16 @@ namespace HyperTwistCoachDashboardWidgetInternal Entry.AcceptedAlignedBroadRecommendedOutcomeHandoffCount - PreviousAlignedBroadRecommendedOutcomeCount ); + const int32 AlignedTightFollowUpPacketDelta = FMath::Max( + 0, + Entry.AcceptedAlignedTightFollowUpPacketHandoffCount + - PreviousAlignedTightFollowUpPacketCount + ); + const int32 AlignedBroadRecommendedPacketDelta = FMath::Max( + 0, + Entry.AcceptedAlignedBroadRecommendedPacketHandoffCount + - PreviousAlignedBroadRecommendedPacketCount + ); if (QueuedDelta > 0) { @@ -1504,6 +1541,13 @@ namespace HyperTwistCoachDashboardWidgetInternal Bias.FollowUpScore += AlignedTightFollowUpOutcomeDelta * 4; Bias.bHasAlignedGuidanceOutcomeAcceptedSignal = true; } + if (AlignedTightFollowUpPacketDelta > 0) + { + Bias.AlignedTightFollowUpPacketAcceptedDeltaCount += + AlignedTightFollowUpPacketDelta; + Bias.FollowUpScore += AlignedTightFollowUpPacketDelta * 4; + Bias.bHasAlignedPacketAcceptedSignal = true; + } if (Entry.bUsedReliableTrustedTightStructurePlanHistory) { Bias.ReliableTrustedTightFollowUpAcceptedDeltaCount += FollowUpDelta; @@ -1541,6 +1585,13 @@ namespace HyperTwistCoachDashboardWidgetInternal Bias.RecommendedScore += AlignedBroadRecommendedOutcomeDelta * 4; Bias.bHasAlignedGuidanceOutcomeAcceptedSignal = true; } + if (AlignedBroadRecommendedPacketDelta > 0) + { + Bias.AlignedBroadRecommendedPacketAcceptedDeltaCount += + AlignedBroadRecommendedPacketDelta; + Bias.RecommendedScore += AlignedBroadRecommendedPacketDelta * 4; + Bias.bHasAlignedPacketAcceptedSignal = true; + } if (Entry.bUsedReliableTrustedTightStructurePlanHistory) { Bias.ReliableTrustedTightRecommendedAcceptedDeltaCount += RecommendedDelta; @@ -8115,6 +8166,14 @@ void UHyperTwistCoachDashboardWidget::RecordCoachHandoffHistorySnapshot( HandoffHistoryEntries.Num() > 0 ? HandoffHistoryEntries.Last().AcceptedAlignedBroadRecommendedOutcomeHandoffCount : 0; + const int32 PreviousAcceptedAlignedTightFollowUpPacketHandoffCount = + HandoffHistoryEntries.Num() > 0 + ? HandoffHistoryEntries.Last().AcceptedAlignedTightFollowUpPacketHandoffCount + : 0; + const int32 PreviousAcceptedAlignedBroadRecommendedPacketHandoffCount = + HandoffHistoryEntries.Num() > 0 + ? HandoffHistoryEntries.Last().AcceptedAlignedBroadRecommendedPacketHandoffCount + : 0; const int32 AcceptedFollowUpHandoffDelta = FMath::Max( 0, Entry.AcceptedFollowUpHandoffCount - PreviousAcceptedFollowUpHandoffCount @@ -8124,10 +8183,16 @@ void UHyperTwistCoachDashboardWidget::RecordCoachHandoffHistorySnapshot( Entry.AcceptedRecommendedHandoffCount - PreviousAcceptedRecommendedHandoffCount ); const bool bAlignedTightFollowUpGuidanceOutcomeSource = - HyperTwistCoachDashboardWidgetInternal::IsAlignedTightFollowUpGuidanceSourceLabel( + HyperTwistCoachDashboardWidgetInternal::IsAlignedTightFollowUpOutcomeSourceLabel( CachedCoachPanelState.PreferredGuidanceSourceLabel); const bool bAlignedBroadRecommendedGuidanceOutcomeSource = - HyperTwistCoachDashboardWidgetInternal::IsAlignedBroadRecommendedGuidanceSourceLabel( + HyperTwistCoachDashboardWidgetInternal::IsAlignedBroadRecommendedOutcomeSourceLabel( + CachedCoachPanelState.PreferredGuidanceSourceLabel); + const bool bAlignedTightFollowUpPacketSource = + HyperTwistCoachDashboardWidgetInternal::IsAlignedTightFollowUpPacketSourceLabel( + CachedCoachPanelState.PreferredGuidanceSourceLabel); + const bool bAlignedBroadRecommendedPacketSource = + HyperTwistCoachDashboardWidgetInternal::IsAlignedBroadRecommendedPacketSourceLabel( CachedCoachPanelState.PreferredGuidanceSourceLabel); Entry.AcceptedAlignedTightFollowUpOutcomeHandoffCount = PreviousAcceptedAlignedTightFollowUpOutcomeHandoffCount @@ -8135,6 +8200,12 @@ void UHyperTwistCoachDashboardWidget::RecordCoachHandoffHistorySnapshot( Entry.AcceptedAlignedBroadRecommendedOutcomeHandoffCount = PreviousAcceptedAlignedBroadRecommendedOutcomeHandoffCount + (bAlignedBroadRecommendedGuidanceOutcomeSource ? AcceptedRecommendedHandoffDelta : 0); + Entry.AcceptedAlignedTightFollowUpPacketHandoffCount = + PreviousAcceptedAlignedTightFollowUpPacketHandoffCount + + (bAlignedTightFollowUpPacketSource ? AcceptedFollowUpHandoffDelta : 0); + Entry.AcceptedAlignedBroadRecommendedPacketHandoffCount = + PreviousAcceptedAlignedBroadRecommendedPacketHandoffCount + + (bAlignedBroadRecommendedPacketSource ? AcceptedRecommendedHandoffDelta : 0); Entry.ReliableAlignedTrustedTightPlanOutcomeHistoryCount = CachedCoachPanelState .ReliableAlignedTrustedTightMethodDrillRecoveryStructurePlanOutcomeHistoryCount; @@ -8212,6 +8283,10 @@ void UHyperTwistCoachDashboardWidget::RecordCoachHandoffHistorySnapshot( == Entry.AcceptedAlignedTightFollowUpOutcomeHandoffCount && HandoffHistoryEntries.Last().AcceptedAlignedBroadRecommendedOutcomeHandoffCount == Entry.AcceptedAlignedBroadRecommendedOutcomeHandoffCount + && HandoffHistoryEntries.Last().AcceptedAlignedTightFollowUpPacketHandoffCount + == Entry.AcceptedAlignedTightFollowUpPacketHandoffCount + && HandoffHistoryEntries.Last().AcceptedAlignedBroadRecommendedPacketHandoffCount + == Entry.AcceptedAlignedBroadRecommendedPacketHandoffCount && HandoffHistoryEntries.Last().ReliableAlignedTrustedTightPlanOutcomeHistoryCount == Entry.ReliableAlignedTrustedTightPlanOutcomeHistoryCount && HandoffHistoryEntries.Last().ReliableAlignedTrustedBroadPlanOutcomeHistoryCount @@ -10564,9 +10639,11 @@ void UHyperTwistCoachDashboardWidget::UpdateDashboardPresentation() HandoffHistoryBias.RecommendedRecommendationCount ); CoachHandoffRecommendationDetailLine += FString::Printf( - TEXT(" | aligned guidance accepted follow-up/recommended %d/%d"), + TEXT(" | aligned guidance accepted follow-up/recommended %d/%d | aligned packet accepted follow-up/recommended %d/%d"), HandoffHistoryBias.AlignedTightFollowUpOutcomeAcceptedDeltaCount, - HandoffHistoryBias.AlignedBroadRecommendedOutcomeAcceptedDeltaCount + HandoffHistoryBias.AlignedBroadRecommendedOutcomeAcceptedDeltaCount, + HandoffHistoryBias.AlignedTightFollowUpPacketAcceptedDeltaCount, + HandoffHistoryBias.AlignedBroadRecommendedPacketAcceptedDeltaCount ); if (HandoffHistoryBias.AlignedTightFollowUpOutcomeAcceptedDeltaCount > 0 && HandoffHistoryBias.PreferredKind @@ -10582,6 +10659,20 @@ void UHyperTwistCoachDashboardWidget::UpdateDashboardPresentation() CoachHandoffRecommendationDetailLine += TEXT(" | Accepted aligned broad recommended handoffs are directly reinforcing broader redirect."); } + if (HandoffHistoryBias.AlignedTightFollowUpPacketAcceptedDeltaCount > 0 + && HandoffHistoryBias.PreferredKind + == HyperTwistCoachDashboardWidgetInternal::EHandoffRecommendationKind::FollowUp) + { + CoachHandoffRecommendationDetailLine += + TEXT(" | Accepted aligned tight packet follow-up-first handoffs are reinforcing the retained narrow branch."); + } + else if (HandoffHistoryBias.AlignedBroadRecommendedPacketAcceptedDeltaCount > 0 + && HandoffHistoryBias.PreferredKind + == HyperTwistCoachDashboardWidgetInternal::EHandoffRecommendationKind::Recommended) + { + CoachHandoffRecommendationDetailLine += + TEXT(" | Accepted aligned broad packet recommended-first handoffs are reinforcing the retained broad branch."); + } CoachHandoffRecommendationDetailLine += FString::Printf( TEXT(" | upstream drill recovery strong/weak/history %d/%d/%d avg %.1f"), CachedCoachPanelState.StrongMethodDrillRecoveryHistoryCount, @@ -10902,12 +10993,14 @@ void UHyperTwistCoachDashboardWidget::UpdateDashboardPresentation() const FString HandoffHistoryDetailLine = SelectedHandoffHistoryEntry != nullptr ? FString::Printf( - TEXT("Accepted queued/follow-up/recommended: %d/%d/%d | aligned guidance accepted follow-up/recommended: %d/%d | deferred-overflow queued/follow-up/recommended: %d/%d/%d | drill-driven queued/follow-up/recommended: %d/%d/%d | aligned reliable handoff outcomes tight/broad %d/%d avg %.1f/%.1f | deferred-first suppression recommendation used: %s | drill weighting used: %s | reliable trusted plan: %s | retained posture: %s | queue source: %s | preferred lane: %s | memory source: %s | recovery action: %s | recovery source: %s | closure continuation bias %d | closure suppression bias %d | readiness queue/follow-up/recommended: %s/%s/%s || %s"), + TEXT("Accepted queued/follow-up/recommended: %d/%d/%d | aligned guidance accepted follow-up/recommended: %d/%d | aligned packet accepted follow-up/recommended: %d/%d | deferred-overflow queued/follow-up/recommended: %d/%d/%d | drill-driven queued/follow-up/recommended: %d/%d/%d | aligned reliable handoff outcomes tight/broad %d/%d avg %.1f/%.1f | deferred-first suppression recommendation used: %s | drill weighting used: %s | reliable trusted plan: %s | retained posture: %s | queue source: %s | preferred lane: %s | memory source: %s | recovery action: %s | recovery source: %s | closure continuation bias %d | closure suppression bias %d | readiness queue/follow-up/recommended: %s/%s/%s || %s"), SelectedHandoffHistoryEntry->AcceptedQueuedHandoffCount, SelectedHandoffHistoryEntry->AcceptedFollowUpHandoffCount, SelectedHandoffHistoryEntry->AcceptedRecommendedHandoffCount, SelectedHandoffHistoryEntry->AcceptedAlignedTightFollowUpOutcomeHandoffCount, SelectedHandoffHistoryEntry->AcceptedAlignedBroadRecommendedOutcomeHandoffCount, + SelectedHandoffHistoryEntry->AcceptedAlignedTightFollowUpPacketHandoffCount, + SelectedHandoffHistoryEntry->AcceptedAlignedBroadRecommendedPacketHandoffCount, SelectedHandoffHistoryEntry->AcceptedDeferredOverflowQueuedHandoffCount, SelectedHandoffHistoryEntry->AcceptedDeferredOverflowFollowUpHandoffCount, SelectedHandoffHistoryEntry->AcceptedDeferredOverflowRecommendedHandoffCount, diff --git a/UnrealHyperTwist/Source/UnrealHyperTwist/Public/HyperTwistTraining/HyperTwistCoachDashboardWidget.h b/UnrealHyperTwist/Source/UnrealHyperTwist/Public/HyperTwistTraining/HyperTwistCoachDashboardWidget.h index 32c28c0..7aaad77 100644 --- a/UnrealHyperTwist/Source/UnrealHyperTwist/Public/HyperTwistTraining/HyperTwistCoachDashboardWidget.h +++ b/UnrealHyperTwist/Source/UnrealHyperTwist/Public/HyperTwistTraining/HyperTwistCoachDashboardWidget.h @@ -340,6 +340,8 @@ struct FHyperTwistCoachDashboardHandoffHistoryEntry int32 AcceptedMethodDrillRecommendedHandoffCount = 0; int32 AcceptedAlignedTightFollowUpOutcomeHandoffCount = 0; int32 AcceptedAlignedBroadRecommendedOutcomeHandoffCount = 0; + int32 AcceptedAlignedTightFollowUpPacketHandoffCount = 0; + int32 AcceptedAlignedBroadRecommendedPacketHandoffCount = 0; int32 ReliableAlignedTrustedTightPlanOutcomeHistoryCount = 0; int32 ReliableAlignedTrustedBroadPlanOutcomeHistoryCount = 0; float ReliableAlignedTrustedTightPlanOutcomeAverageScore = 0.0f;