Drain large memory header validators
This commit is contained in:
parent
f34d4c3e6e
commit
1eafd5f121
3 changed files with 310 additions and 366 deletions
|
|
@ -10,6 +10,20 @@ namespace HyperTwistMemoryCoreLibraryInternal
|
|||
return ReferenceUtc.IsEmpty() ? FDateTime::UtcNow().ToIso8601() : ReferenceUtc;
|
||||
}
|
||||
|
||||
template <typename ItemType>
|
||||
bool AreAllItemsStructurallyValid(const TArray<ItemType>& Values)
|
||||
{
|
||||
for (const ItemType& Value : Values)
|
||||
{
|
||||
if (!Value.IsStructurallyValid())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
FString MakeDeckCaseKey(const FString& DeckId, const FString& CaseId)
|
||||
{
|
||||
return DeckId + TEXT("|") + CaseId;
|
||||
|
|
@ -163,6 +177,269 @@ namespace HyperTwistMemoryCoreLibraryInternal
|
|||
}
|
||||
}
|
||||
|
||||
bool FHyperTwistMemoryLedgerState::IsStructurallyValid() const
|
||||
{
|
||||
if (UserId.IsEmpty()
|
||||
|| ReferenceUtc.IsEmpty()
|
||||
|| LaneContracts.Num() == 0
|
||||
|| FeatureGates.Num() == 0
|
||||
|| !EconomicRetentionProfile.IsStructurallyValid()
|
||||
|| !MaxRetentionProfile.IsStructurallyValid())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!HyperTwistMemoryCoreLibraryInternal::AreAllItemsStructurallyValid(
|
||||
LaneContracts)
|
||||
|| !HyperTwistMemoryCoreLibraryInternal::AreAllItemsStructurallyValid(
|
||||
FeatureGates)
|
||||
|| !HyperTwistMemoryCoreLibraryInternal::AreAllItemsStructurallyValid(Entities))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
const int32 TotalEntityCount =
|
||||
AuthoritativeEntityCount + SemiAuthoritativeEntityCount + DerivedEntityCount;
|
||||
return TotalEntityCount == Entities.Num();
|
||||
}
|
||||
|
||||
bool FHyperTwistMemoryChronicleContinuityState::IsStructurallyValid() const
|
||||
{
|
||||
if (UserId.IsEmpty()
|
||||
|| ReferenceUtc.IsEmpty()
|
||||
|| (ChronicleEvents.Num() == 0
|
||||
&& SessionGroups.Num() == 0
|
||||
&& ResumePacks.Num() == 0
|
||||
&& ContinuityGuards.Num() == 0))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!HyperTwistMemoryCoreLibraryInternal::AreAllItemsStructurallyValid(ChronicleEvents)
|
||||
|| !HyperTwistMemoryCoreLibraryInternal::AreAllItemsStructurallyValid(SessionGroups)
|
||||
|| !HyperTwistMemoryCoreLibraryInternal::AreAllItemsStructurallyValid(ResumePacks)
|
||||
|| !HyperTwistMemoryCoreLibraryInternal::AreAllItemsStructurallyValid(ContinuityGuards))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int32 ComputedChronicleCaptureEventCount = 0;
|
||||
int32 ComputedContinuityResumeEventCount = 0;
|
||||
for (const FHyperTwistMemoryChronicleEventEntry& ChronicleEvent : ChronicleEvents)
|
||||
{
|
||||
if (ChronicleEvent.Lane == EHyperTwistMemoryLane::ChronicleCapture)
|
||||
{
|
||||
++ComputedChronicleCaptureEventCount;
|
||||
}
|
||||
else if (ChronicleEvent.Lane == EHyperTwistMemoryLane::ContinuityResume)
|
||||
{
|
||||
++ComputedContinuityResumeEventCount;
|
||||
}
|
||||
}
|
||||
|
||||
int32 ComputedOpenSessionGroupCount = 0;
|
||||
for (const FHyperTwistMemorySessionGroup& SessionGroup : SessionGroups)
|
||||
{
|
||||
if (!SessionGroup.bCompleted)
|
||||
{
|
||||
++ComputedOpenSessionGroupCount;
|
||||
}
|
||||
}
|
||||
|
||||
int32 ComputedBlockingGuardCount = 0;
|
||||
for (const FHyperTwistMemoryContinuityGuard& ContinuityGuard : ContinuityGuards)
|
||||
{
|
||||
if (ContinuityGuard.Severity == EHyperTwistMemoryContinuityGuardSeverity::Blocking)
|
||||
{
|
||||
++ComputedBlockingGuardCount;
|
||||
}
|
||||
}
|
||||
|
||||
return ChronicleCaptureEventCount == ComputedChronicleCaptureEventCount
|
||||
&& ContinuityResumeEventCount == ComputedContinuityResumeEventCount
|
||||
&& OpenSessionGroupCount == ComputedOpenSessionGroupCount
|
||||
&& ResumeRequiredCount == ResumePacks.Num()
|
||||
&& BlockingGuardCount == ComputedBlockingGuardCount;
|
||||
}
|
||||
|
||||
bool FHyperTwistMemoryRecallSharedContextState::IsStructurallyValid() const
|
||||
{
|
||||
if (UserId.IsEmpty()
|
||||
|| ReferenceUtc.IsEmpty()
|
||||
|| QueryText.IsEmpty()
|
||||
|| QueryTokens.Num() == 0
|
||||
|| SharedContextRules.Num() == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!HyperTwistMemoryCoreLibraryInternal::AreAllItemsStructurallyValid(RecallMatches)
|
||||
|| !HyperTwistMemoryCoreLibraryInternal::AreAllItemsStructurallyValid(
|
||||
ProvenanceDrillDownEntries)
|
||||
|| !HyperTwistMemoryCoreLibraryInternal::AreAllItemsStructurallyValid(
|
||||
SharedContextRules)
|
||||
|| !HyperTwistMemoryCoreLibraryInternal::AreAllItemsStructurallyValid(
|
||||
SharedContextProjections))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int32 ComputedAuthoritativeRecallCount = 0;
|
||||
int32 ComputedSemiAuthoritativeRecallCount = 0;
|
||||
for (const FHyperTwistMemoryRecallMatch& RecallMatch : RecallMatches)
|
||||
{
|
||||
if (RecallMatch.AuthorityKind == EHyperTwistMemoryAuthorityKind::Authoritative)
|
||||
{
|
||||
++ComputedAuthoritativeRecallCount;
|
||||
}
|
||||
else if (RecallMatch.AuthorityKind
|
||||
== EHyperTwistMemoryAuthorityKind::SemiAuthoritative)
|
||||
{
|
||||
++ComputedSemiAuthoritativeRecallCount;
|
||||
}
|
||||
}
|
||||
|
||||
return RecallResultCount == RecallMatches.Num()
|
||||
&& AuthoritativeRecallCount == ComputedAuthoritativeRecallCount
|
||||
&& SemiAuthoritativeRecallCount == ComputedSemiAuthoritativeRecallCount
|
||||
&& SharedContextProjectionCount == SharedContextProjections.Num()
|
||||
&& bHasScopedSharedContext == (SharedContextProjections.Num() > 0);
|
||||
}
|
||||
|
||||
bool FHyperTwistMemoryCognitiveConsolidationState::IsStructurallyValid() const
|
||||
{
|
||||
if (UserId.IsEmpty() || ReferenceUtc.IsEmpty() || Facts.Num() == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!HyperTwistMemoryCoreLibraryInternal::AreAllItemsStructurallyValid(Facts)
|
||||
|| !HyperTwistMemoryCoreLibraryInternal::AreAllItemsStructurallyValid(
|
||||
Contradictions)
|
||||
|| !HyperTwistMemoryCoreLibraryInternal::AreAllItemsStructurallyValid(
|
||||
Supersessions)
|
||||
|| !HyperTwistMemoryCoreLibraryInternal::AreAllItemsStructurallyValid(
|
||||
ConfidenceDecays))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int32 ComputedActiveFactCount = 0;
|
||||
int32 ComputedSupersededFactCount = 0;
|
||||
int32 ComputedLowConfidenceFactCount = 0;
|
||||
bool bComputedOpenCognitiveReview = false;
|
||||
|
||||
for (const FHyperTwistMemoryCognitiveFact& Fact : Facts)
|
||||
{
|
||||
if (Fact.bActive)
|
||||
{
|
||||
++ComputedActiveFactCount;
|
||||
}
|
||||
if (!Fact.SupersededByFactId.IsEmpty())
|
||||
{
|
||||
++ComputedSupersededFactCount;
|
||||
}
|
||||
if (Fact.ConfidenceScore < 50)
|
||||
{
|
||||
++ComputedLowConfidenceFactCount;
|
||||
}
|
||||
if (Fact.bRequiresReview)
|
||||
{
|
||||
bComputedOpenCognitiveReview = true;
|
||||
}
|
||||
}
|
||||
|
||||
for (const FHyperTwistMemoryCognitiveContradiction& Contradiction : Contradictions)
|
||||
{
|
||||
if (Contradiction.bNeedsManualReview)
|
||||
{
|
||||
bComputedOpenCognitiveReview = true;
|
||||
}
|
||||
}
|
||||
|
||||
return ActiveFactCount == ComputedActiveFactCount
|
||||
&& SupersededFactCount == ComputedSupersededFactCount
|
||||
&& ContradictionCount == Contradictions.Num()
|
||||
&& LowConfidenceFactCount == ComputedLowConfidenceFactCount
|
||||
&& bHasOpenCognitiveReview == bComputedOpenCognitiveReview;
|
||||
}
|
||||
|
||||
bool FHyperTwistMemoryDerivedAdjunctState::IsStructurallyValid() const
|
||||
{
|
||||
if (UserId.IsEmpty()
|
||||
|| ReferenceUtc.IsEmpty()
|
||||
|| ContextAssemblyProfile == EHyperTwistMemoryContextAssemblyProfile::None
|
||||
|| FeatureGateId.IsEmpty()
|
||||
|| SettingsKey.IsEmpty()
|
||||
|| !bDerivedOnlyStorageConfirmed
|
||||
|| !bRemovableWithoutLineageLoss
|
||||
|| !bAllFeaturesOffSafe)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!HyperTwistMemoryCoreLibraryInternal::AreAllItemsStructurallyValid(
|
||||
CompactSummaries)
|
||||
|| !HyperTwistMemoryCoreLibraryInternal::AreAllItemsStructurallyValid(
|
||||
ReducedContextPackets)
|
||||
|| !HyperTwistMemoryCoreLibraryInternal::AreAllItemsStructurallyValid(
|
||||
DigestViews))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
const bool bCountsMatch = CompactSummaryCount == CompactSummaries.Num()
|
||||
&& ReducedContextPacketCount == ReducedContextPackets.Num()
|
||||
&& DigestViewCount == DigestViews.Num();
|
||||
if (!bCountsMatch)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (bDerivedGateActive)
|
||||
{
|
||||
return CompactSummaryCount > 0
|
||||
&& ReducedContextPacketCount > 0
|
||||
&& DigestViewCount > 0;
|
||||
}
|
||||
|
||||
return CompactSummaryCount == 0
|
||||
&& ReducedContextPacketCount == 0
|
||||
&& DigestViewCount == 0;
|
||||
}
|
||||
|
||||
bool FHyperTwistMemoryKnowledgeNotesState::IsStructurallyValid() const
|
||||
{
|
||||
if (UserId.IsEmpty()
|
||||
|| ReferenceUtc.IsEmpty()
|
||||
|| KnowledgeObjects.Num() == 0
|
||||
|| !UserNotesPosture.IsStructurallyValid())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!HyperTwistMemoryCoreLibraryInternal::AreAllItemsStructurallyValid(
|
||||
KnowledgeObjects)
|
||||
|| !HyperTwistMemoryCoreLibraryInternal::AreAllItemsStructurallyValid(
|
||||
PromotionReviews))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
const int32 ComputedPromotionCount =
|
||||
ApprovedPromotionCount + DeferredPromotionCount + BlockedPromotionCount;
|
||||
const bool bComputedUserNotesLaneAvailable =
|
||||
UserNotesPosture.bOwnershipJustified
|
||||
&& UserNotesPosture.bLaneEnabled
|
||||
&& UserNotesPosture.bAcceptsUserAuthoredContent;
|
||||
|
||||
return CuratedReferenceObjectCount >= 0
|
||||
&& CuratedReferenceObjectCount <= KnowledgeObjects.Num()
|
||||
&& ComputedPromotionCount == PromotionReviews.Num()
|
||||
&& bKnowledgeWikiEnabled
|
||||
&& bUserNotesLaneAvailable == bComputedUserNotesLaneAvailable;
|
||||
}
|
||||
|
||||
void AddChronicleEvent(
|
||||
FHyperTwistMemoryChronicleContinuityState& ChronicleContinuityState,
|
||||
const FHyperTwistMemoryChronicleEventEntry& ChronicleEvent
|
||||
|
|
|
|||
|
|
@ -304,46 +304,7 @@ struct FHyperTwistMemoryLedgerState
|
|||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
|
||||
int32 DerivedEntityCount = 0;
|
||||
|
||||
bool IsStructurallyValid() const
|
||||
{
|
||||
if (UserId.IsEmpty()
|
||||
|| ReferenceUtc.IsEmpty()
|
||||
|| LaneContracts.Num() == 0
|
||||
|| FeatureGates.Num() == 0
|
||||
|| !EconomicRetentionProfile.IsStructurallyValid()
|
||||
|| !MaxRetentionProfile.IsStructurallyValid())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for (const FHyperTwistMemoryLaneContract& LaneContract : LaneContracts)
|
||||
{
|
||||
if (!LaneContract.IsStructurallyValid())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for (const FHyperTwistMemoryFeatureGate& FeatureGate : FeatureGates)
|
||||
{
|
||||
if (!FeatureGate.IsStructurallyValid())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for (const FHyperTwistMemoryEntityDescriptor& Entity : Entities)
|
||||
{
|
||||
if (!Entity.IsStructurallyValid())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
const int32 TotalEntityCount =
|
||||
AuthoritativeEntityCount + SemiAuthoritativeEntityCount + DerivedEntityCount;
|
||||
return TotalEntityCount == Entities.Num();
|
||||
}
|
||||
bool IsStructurallyValid() const;
|
||||
};
|
||||
|
||||
USTRUCT(BlueprintType)
|
||||
|
|
@ -682,88 +643,7 @@ struct FHyperTwistMemoryChronicleContinuityState
|
|||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
|
||||
bool bHasRepositoryContinuityIssues = false;
|
||||
|
||||
bool IsStructurallyValid() const
|
||||
{
|
||||
if (UserId.IsEmpty()
|
||||
|| ReferenceUtc.IsEmpty()
|
||||
|| (ChronicleEvents.Num() == 0
|
||||
&& SessionGroups.Num() == 0
|
||||
&& ResumePacks.Num() == 0
|
||||
&& ContinuityGuards.Num() == 0))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for (const FHyperTwistMemoryChronicleEventEntry& ChronicleEvent : ChronicleEvents)
|
||||
{
|
||||
if (!ChronicleEvent.IsStructurallyValid())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for (const FHyperTwistMemorySessionGroup& SessionGroup : SessionGroups)
|
||||
{
|
||||
if (!SessionGroup.IsStructurallyValid())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for (const FHyperTwistMemoryResumePack& ResumePack : ResumePacks)
|
||||
{
|
||||
if (!ResumePack.IsStructurallyValid())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for (const FHyperTwistMemoryContinuityGuard& ContinuityGuard : ContinuityGuards)
|
||||
{
|
||||
if (!ContinuityGuard.IsStructurallyValid())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
int32 ComputedChronicleCaptureEventCount = 0;
|
||||
int32 ComputedContinuityResumeEventCount = 0;
|
||||
for (const FHyperTwistMemoryChronicleEventEntry& ChronicleEvent : ChronicleEvents)
|
||||
{
|
||||
if (ChronicleEvent.Lane == EHyperTwistMemoryLane::ChronicleCapture)
|
||||
{
|
||||
++ComputedChronicleCaptureEventCount;
|
||||
}
|
||||
else if (ChronicleEvent.Lane == EHyperTwistMemoryLane::ContinuityResume)
|
||||
{
|
||||
++ComputedContinuityResumeEventCount;
|
||||
}
|
||||
}
|
||||
|
||||
int32 ComputedOpenSessionGroupCount = 0;
|
||||
for (const FHyperTwistMemorySessionGroup& SessionGroup : SessionGroups)
|
||||
{
|
||||
if (!SessionGroup.bCompleted)
|
||||
{
|
||||
++ComputedOpenSessionGroupCount;
|
||||
}
|
||||
}
|
||||
|
||||
int32 ComputedBlockingGuardCount = 0;
|
||||
for (const FHyperTwistMemoryContinuityGuard& ContinuityGuard : ContinuityGuards)
|
||||
{
|
||||
if (ContinuityGuard.Severity == EHyperTwistMemoryContinuityGuardSeverity::Blocking)
|
||||
{
|
||||
++ComputedBlockingGuardCount;
|
||||
}
|
||||
}
|
||||
|
||||
return ChronicleCaptureEventCount == ComputedChronicleCaptureEventCount
|
||||
&& ContinuityResumeEventCount == ComputedContinuityResumeEventCount
|
||||
&& OpenSessionGroupCount == ComputedOpenSessionGroupCount
|
||||
&& ResumeRequiredCount == ResumePacks.Num()
|
||||
&& BlockingGuardCount == ComputedBlockingGuardCount;
|
||||
}
|
||||
bool IsStructurallyValid() const;
|
||||
};
|
||||
|
||||
USTRUCT(BlueprintType)
|
||||
|
|
@ -1062,72 +942,7 @@ struct FHyperTwistMemoryRecallSharedContextState
|
|||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
|
||||
bool bHasScopedSharedContext = false;
|
||||
|
||||
bool IsStructurallyValid() const
|
||||
{
|
||||
if (UserId.IsEmpty()
|
||||
|| ReferenceUtc.IsEmpty()
|
||||
|| QueryText.IsEmpty()
|
||||
|| QueryTokens.Num() == 0
|
||||
|| SharedContextRules.Num() == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for (const FHyperTwistMemoryRecallMatch& RecallMatch : RecallMatches)
|
||||
{
|
||||
if (!RecallMatch.IsStructurallyValid())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for (const FHyperTwistMemoryProvenanceDrillDownEntry& DrillDownEntry :
|
||||
ProvenanceDrillDownEntries)
|
||||
{
|
||||
if (!DrillDownEntry.IsStructurallyValid())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for (const FHyperTwistMemorySharedContextRule& SharedContextRule : SharedContextRules)
|
||||
{
|
||||
if (!SharedContextRule.IsStructurallyValid())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for (const FHyperTwistMemorySharedContextProjection& SharedContextProjection :
|
||||
SharedContextProjections)
|
||||
{
|
||||
if (!SharedContextProjection.IsStructurallyValid())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
int32 ComputedAuthoritativeRecallCount = 0;
|
||||
int32 ComputedSemiAuthoritativeRecallCount = 0;
|
||||
for (const FHyperTwistMemoryRecallMatch& RecallMatch : RecallMatches)
|
||||
{
|
||||
if (RecallMatch.AuthorityKind == EHyperTwistMemoryAuthorityKind::Authoritative)
|
||||
{
|
||||
++ComputedAuthoritativeRecallCount;
|
||||
}
|
||||
else if (RecallMatch.AuthorityKind ==
|
||||
EHyperTwistMemoryAuthorityKind::SemiAuthoritative)
|
||||
{
|
||||
++ComputedSemiAuthoritativeRecallCount;
|
||||
}
|
||||
}
|
||||
|
||||
return RecallResultCount == RecallMatches.Num()
|
||||
&& AuthoritativeRecallCount == ComputedAuthoritativeRecallCount
|
||||
&& SemiAuthoritativeRecallCount == ComputedSemiAuthoritativeRecallCount
|
||||
&& SharedContextProjectionCount == SharedContextProjections.Num()
|
||||
&& bHasScopedSharedContext == (SharedContextProjections.Num() > 0);
|
||||
}
|
||||
bool IsStructurallyValid() const;
|
||||
};
|
||||
|
||||
USTRUCT(BlueprintType)
|
||||
|
|
@ -1444,85 +1259,7 @@ struct FHyperTwistMemoryCognitiveConsolidationState
|
|||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
|
||||
bool bHasOpenCognitiveReview = false;
|
||||
|
||||
bool IsStructurallyValid() const
|
||||
{
|
||||
if (UserId.IsEmpty() || ReferenceUtc.IsEmpty() || Facts.Num() == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for (const FHyperTwistMemoryCognitiveFact& Fact : Facts)
|
||||
{
|
||||
if (!Fact.IsStructurallyValid())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for (const FHyperTwistMemoryCognitiveContradiction& Contradiction : Contradictions)
|
||||
{
|
||||
if (!Contradiction.IsStructurallyValid())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for (const FHyperTwistMemoryCognitiveSupersession& Supersession : Supersessions)
|
||||
{
|
||||
if (!Supersession.IsStructurallyValid())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for (const FHyperTwistMemoryConfidenceDecayEntry& ConfidenceDecay :
|
||||
ConfidenceDecays)
|
||||
{
|
||||
if (!ConfidenceDecay.IsStructurallyValid())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
int32 ComputedActiveFactCount = 0;
|
||||
int32 ComputedSupersededFactCount = 0;
|
||||
int32 ComputedLowConfidenceFactCount = 0;
|
||||
bool bComputedOpenCognitiveReview = false;
|
||||
|
||||
for (const FHyperTwistMemoryCognitiveFact& Fact : Facts)
|
||||
{
|
||||
if (Fact.bActive)
|
||||
{
|
||||
++ComputedActiveFactCount;
|
||||
}
|
||||
if (!Fact.SupersededByFactId.IsEmpty())
|
||||
{
|
||||
++ComputedSupersededFactCount;
|
||||
}
|
||||
if (Fact.ConfidenceScore < 50)
|
||||
{
|
||||
++ComputedLowConfidenceFactCount;
|
||||
}
|
||||
if (Fact.bRequiresReview)
|
||||
{
|
||||
bComputedOpenCognitiveReview = true;
|
||||
}
|
||||
}
|
||||
|
||||
for (const FHyperTwistMemoryCognitiveContradiction& Contradiction : Contradictions)
|
||||
{
|
||||
if (Contradiction.bNeedsManualReview)
|
||||
{
|
||||
bComputedOpenCognitiveReview = true;
|
||||
}
|
||||
}
|
||||
|
||||
return ActiveFactCount == ComputedActiveFactCount
|
||||
&& SupersededFactCount == ComputedSupersededFactCount
|
||||
&& ContradictionCount == Contradictions.Num()
|
||||
&& LowConfidenceFactCount == ComputedLowConfidenceFactCount
|
||||
&& bHasOpenCognitiveReview == bComputedOpenCognitiveReview;
|
||||
}
|
||||
bool IsStructurallyValid() const;
|
||||
};
|
||||
|
||||
USTRUCT(BlueprintType)
|
||||
|
|
@ -1768,46 +1505,7 @@ struct FHyperTwistMemoryKnowledgeNotesState
|
|||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
|
||||
bool bUserNotesLaneAvailable = false;
|
||||
|
||||
bool IsStructurallyValid() const
|
||||
{
|
||||
if (UserId.IsEmpty()
|
||||
|| ReferenceUtc.IsEmpty()
|
||||
|| KnowledgeObjects.Num() == 0
|
||||
|| !UserNotesPosture.IsStructurallyValid())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for (const FHyperTwistMemoryKnowledgeObject& KnowledgeObject : KnowledgeObjects)
|
||||
{
|
||||
if (!KnowledgeObject.IsStructurallyValid())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for (const FHyperTwistMemoryKnowledgePromotionReview& PromotionReview :
|
||||
PromotionReviews)
|
||||
{
|
||||
if (!PromotionReview.IsStructurallyValid())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
const int32 ComputedPromotionCount =
|
||||
ApprovedPromotionCount + DeferredPromotionCount + BlockedPromotionCount;
|
||||
const bool bComputedUserNotesLaneAvailable =
|
||||
UserNotesPosture.bOwnershipJustified
|
||||
&& UserNotesPosture.bLaneEnabled
|
||||
&& UserNotesPosture.bAcceptsUserAuthoredContent;
|
||||
|
||||
return CuratedReferenceObjectCount >= 0
|
||||
&& CuratedReferenceObjectCount <= KnowledgeObjects.Num()
|
||||
&& ComputedPromotionCount == PromotionReviews.Num()
|
||||
&& bKnowledgeWikiEnabled
|
||||
&& bUserNotesLaneAvailable == bComputedUserNotesLaneAvailable;
|
||||
}
|
||||
bool IsStructurallyValid() const;
|
||||
};
|
||||
|
||||
USTRUCT(BlueprintType)
|
||||
|
|
@ -2065,63 +1763,5 @@ struct FHyperTwistMemoryDerivedAdjunctState
|
|||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
|
||||
bool bAllFeaturesOffSafe = false;
|
||||
|
||||
bool IsStructurallyValid() const
|
||||
{
|
||||
if (UserId.IsEmpty()
|
||||
|| ReferenceUtc.IsEmpty()
|
||||
|| ContextAssemblyProfile == EHyperTwistMemoryContextAssemblyProfile::None
|
||||
|| FeatureGateId.IsEmpty()
|
||||
|| SettingsKey.IsEmpty()
|
||||
|| !bDerivedOnlyStorageConfirmed
|
||||
|| !bRemovableWithoutLineageLoss
|
||||
|| !bAllFeaturesOffSafe)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for (const FHyperTwistMemoryCompactSummary& CompactSummary : CompactSummaries)
|
||||
{
|
||||
if (!CompactSummary.IsStructurallyValid())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for (const FHyperTwistMemoryReducedContextPacket& ReducedContextPacket :
|
||||
ReducedContextPackets)
|
||||
{
|
||||
if (!ReducedContextPacket.IsStructurallyValid())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for (const FHyperTwistMemoryDigestView& DigestView : DigestViews)
|
||||
{
|
||||
if (!DigestView.IsStructurallyValid())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
const bool bCountsMatch =
|
||||
CompactSummaryCount == CompactSummaries.Num()
|
||||
&& ReducedContextPacketCount == ReducedContextPackets.Num()
|
||||
&& DigestViewCount == DigestViews.Num();
|
||||
if (!bCountsMatch)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (bDerivedGateActive)
|
||||
{
|
||||
return CompactSummaryCount > 0
|
||||
&& ReducedContextPacketCount > 0
|
||||
&& DigestViewCount > 0;
|
||||
}
|
||||
|
||||
return CompactSummaryCount == 0
|
||||
&& ReducedContextPacketCount == 0
|
||||
&& DigestViewCount == 0;
|
||||
}
|
||||
bool IsStructurallyValid() const;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -334,6 +334,33 @@ Latest later skill-header cleanup follow-up still on `2026-06-24`:
|
|||
- any further extraction there should be justified by readability or churn,
|
||||
not by obvious large inline-validator debt
|
||||
|
||||
Latest later memory-header cleanup follow-up still on `2026-06-24`:
|
||||
|
||||
- the next bounded memory-family refactor packet then moved the larger state
|
||||
validators out of `Public/HyperTwistMemory/HyperTwistMemoryTypes.h` and into
|
||||
`Private/HyperTwistMemory/HyperTwistMemoryCoreLibrary.cpp` for:
|
||||
- `FHyperTwistMemoryChronicleContinuityState::IsStructurallyValid()`
|
||||
- `FHyperTwistMemoryRecallSharedContextState::IsStructurallyValid()`
|
||||
- `FHyperTwistMemoryCognitiveConsolidationState::IsStructurallyValid()`
|
||||
- `FHyperTwistMemoryDerivedAdjunctState::IsStructurallyValid()`
|
||||
- `FHyperTwistMemoryLedgerState::IsStructurallyValid()`
|
||||
- `FHyperTwistMemoryKnowledgeNotesState::IsStructurallyValid()`
|
||||
- the private memory core now also owns a shared
|
||||
`AreAllItemsStructurallyValid(...)` helper so these state-summary checks no
|
||||
longer repeat container-validation loops in the public header
|
||||
- `scripts/run-hypertwist-sentrux-source-only.sh` then improved again to:
|
||||
- `Quality: 6157`
|
||||
- all `7` rules passing
|
||||
- the current largest remaining inline validators in
|
||||
`HyperTwistMemoryTypes.h` are now down to:
|
||||
- `30` lines for `FHyperTwistMemoryCognitiveFact`
|
||||
- `28` lines for `FHyperTwistMemoryDigestView`
|
||||
- `27` lines for `FHyperTwistMemoryReducedContextPacket`
|
||||
- current truthful “vanilla refactor” reading tightens again:
|
||||
- the obvious larger memory-state inline-validator cluster is drained
|
||||
- remaining memory extractions are now optional smaller-seam cleanup rather
|
||||
than the next glaring structural debt island
|
||||
|
||||
Latest same-day browser/distribution continuity follow-up still on `2026-06-24`:
|
||||
|
||||
- auth-entry, protected-route loading, dashboard auth health, and release-authority fallback states now share a more deliberate operator-facing recovery shape instead of scattering single-line warnings across public and protected surfaces
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue