From 911d8b0f54750d3cb669ea0faad8864b1fd1392f Mon Sep 17 00:00:00 2001 From: axiomlogicnexus Date: Wed, 6 May 2026 19:47:49 +0200 Subject: [PATCH] Hydrate idle review plan after run clear --- .../HyperTwistTrainingSubsystem.cpp | 25 +++++ ...EVIEW_PLAN_CONTINUITY_PACKET_2026-05-06.md | 97 +++++++++++++++++++ 2 files changed, 122 insertions(+) create mode 100644 docs/arch/HYPERTWIST_PHASE4_IDLE_REVIEW_PLAN_CONTINUITY_PACKET_2026-05-06.md diff --git a/UnrealHyperTwist/Source/UnrealHyperTwist/Private/HyperTwistTraining/HyperTwistTrainingSubsystem.cpp b/UnrealHyperTwist/Source/UnrealHyperTwist/Private/HyperTwistTraining/HyperTwistTrainingSubsystem.cpp index 783a293..92adf4b 100644 --- a/UnrealHyperTwist/Source/UnrealHyperTwist/Private/HyperTwistTraining/HyperTwistTrainingSubsystem.cpp +++ b/UnrealHyperTwist/Source/UnrealHyperTwist/Private/HyperTwistTraining/HyperTwistTrainingSubsystem.cpp @@ -4994,6 +4994,7 @@ void UHyperTwistTrainingSubsystem::RefreshRepositoryViews() ActiveLearnerPresets.Reset(); ActiveTrainingSessionTemplates.Reset(); ActiveCaseRecommendations.Reset(); + ActiveReviewPlanState = FHyperTwistTrainingReviewPlanState(); ActiveReviewFlowStatus = FHyperTwistTrainingReviewFlowStatus(); ActiveReviewProgramSummary = FHyperTwistTrainingReviewProgramSummary(); return; @@ -5036,6 +5037,30 @@ void UHyperTwistTrainingSubsystem::RefreshRepositoryViews() RepositoryViewUserId, RepositoryViewReferenceUtc ); + if (!bHasActiveRunContext) + { + const FString RepositoryReviewPlanId = !ActiveReviewProgramSummary.CurrentPlanId.IsEmpty() + ? ActiveReviewProgramSummary.CurrentPlanId + : ActiveReviewProgramSummary.NextPlanId; + if (!RepositoryReviewPlanId.IsEmpty()) + { + FHyperTwistTrainingReviewPlanState StoredReviewPlan; + const bool bHasStoredReviewPlan = UHyperTwistTrainingRepositoryLibrary::TryGetReviewPlan( + TrainingRepositoryState, + RepositoryReviewPlanId, + StoredReviewPlan + ); + ActiveReviewPlanState = bHasStoredReviewPlan + && StoredReviewPlan.IsStructurallyValid() + && StoredReviewPlan.UserId == RepositoryViewUserId + ? StoredReviewPlan + : FHyperTwistTrainingReviewPlanState(); + } + else + { + ActiveReviewPlanState = FHyperTwistTrainingReviewPlanState(); + } + } const FString ResolvedDeckId = bHasActiveRunContext ? ActiveRunState.Session.DeckId diff --git a/docs/arch/HYPERTWIST_PHASE4_IDLE_REVIEW_PLAN_CONTINUITY_PACKET_2026-05-06.md b/docs/arch/HYPERTWIST_PHASE4_IDLE_REVIEW_PLAN_CONTINUITY_PACKET_2026-05-06.md new file mode 100644 index 0000000..c0e752d --- /dev/null +++ b/docs/arch/HYPERTWIST_PHASE4_IDLE_REVIEW_PLAN_CONTINUITY_PACKET_2026-05-06.md @@ -0,0 +1,97 @@ +# HyperTwist Phase 4 idle review-plan continuity packet + +Created on `2026-05-06` + +Status: + +- first-party HyperTwist packet +- bounded Phase `4` coach-to-review validation slice + +## Purpose + +This packet closes the next post-clear review continuity gap in the live recognition-assisted coach-to-review loop. + +The open tasks are: + +- keep the stored pending review plan materialized in runtime state after `ClearActiveRun()` while carryover still exists +- let dashboard/runtime review-policy inspection continue to reflect the repository-backed pending plan until the review program is genuinely exhausted + +It is not: + +- a new review-policy heuristic packet +- a queue-priority packet +- a dashboard layout redesign +- a recognition transport packet + +## Scope + +Bounded lane: + +- rehydrate `ActiveReviewPlanState` from the repository-backed review program summary when there is no active run +- prefer `CurrentPlanId`, then `NextPlanId`, as the idle review-plan continuity target +- clear runtime review-plan state when repository context or repository-backed pending-plan state no longer exists +- keep the existing active-run review-plan path unchanged + +Out of scope: + +- new review recommendation scoring +- review-plan ordering redesign +- queue-memory retuning +- broad dashboard copy changes + +## Why this was the right next packet + +Before this slice: + +- review finalization already preserved carryover instead of force-closing plans +- clear-run repository-view continuity was already landed +- post-clear queue retirement was already landed + +But one continuity break still remained: + +- once `ClearActiveRun()` reset `ActiveReviewPlanState`, the subsystem no longer rehydrated the stored pending review plan from repository state during idle repository refresh + +That meant: + +- `ActiveReviewProgramSummary` could still show pending carryover +- coach guidance could still point at review recovery pressure +- but runtime/dashboard review inspection fell back to "no active review policy is materialized" because the actual pending plan state was no longer live in memory + +So the next honest move was: + +- rehydrate the pending review plan from repository state during idle refresh, and clear it only when repository context or pending-plan state is truly gone + +## What landed + +Primary code changes: + +- `UnrealHyperTwist/Source/UnrealHyperTwist/Private/HyperTwistTraining/HyperTwistTrainingSubsystem.cpp` + - when no active run exists, repository refresh now reloads `ActiveReviewPlanState` from `CurrentPlanId` or `NextPlanId` in `ActiveReviewProgramSummary` + - idle review-plan hydration is constrained to the retained repository-view user context + - repository refresh now also clears `ActiveReviewPlanState` when repository view context cannot be resolved + +## Product effect + +The idle review lane is now more truthful: + +- pending carryover review plans stay inspectable after run clear +- dashboard/runtime review-policy inspection stays aligned with repository-backed review-program state while carryover remains open +- once the review program is truly exhausted, the hydrated review-plan state collapses cleanly instead of lingering + +## Acceptance criteria + +- after `ClearActiveRun()`, a stored pending review plan is rehydrated from repository state when carryover still exists +- review-policy inspection continues to show the repository-backed active review plan during idle carryover +- runtime review-plan state clears when repository context or pending-plan state disappears +- active-run review-plan behavior remains unchanged +- full product build succeeds + +## Validation checklist + +1. build `UnrealHyperTwist.sln` / `UnrealHyperTwistEditor` +2. confirm idle repository refresh rehydrates the stored pending review plan from `CurrentPlanId` or `NextPlanId` +3. confirm review-plan inspection remains live after `ClearActiveRun()` while carryover exists +4. confirm runtime review-plan state clears when repository context or pending review state is gone +5. confirm no broader review-policy or queue redesign was reopened + +That is the packet.