Drain memory record validators into core library

This commit is contained in:
axiomlogicnexus 2026-06-25 03:06:02 +00:00
parent b76a345250
commit 0c895c7890
3 changed files with 254 additions and 280 deletions

View file

@ -177,8 +177,85 @@ namespace HyperTwistMemoryCoreLibraryInternal
}
}
bool FHyperTwistMemoryLedgerState::IsStructurallyValid() const
bool IsConfidenceScoreInRange(const int32 Value)
{
return Value >= 0 && Value <= 100;
}
bool HasValidProvenanceLinks(
const TArray<FHyperTwistMemoryProvenanceLink>& ProvenanceLinks
)
{
return ProvenanceLinks.Num() > 0
&& HyperTwistMemoryCoreLibraryInternal::AreAllItemsStructurallyValid(
ProvenanceLinks);
}
}
bool FHyperTwistMemoryCognitiveFact::IsStructurallyValid() const
{
return !FactId.IsEmpty()
&& !FactFamily.IsEmpty()
&& !FactKind.IsEmpty()
&& !Headline.IsEmpty()
&& !UserId.IsEmpty()
&& !ReferenceUtc.IsEmpty()
&& Lane == EHyperTwistMemoryLane::CognitiveConsolidated
&& AuthorityKind != EHyperTwistMemoryAuthorityKind::None
&& SourceEntityIds.Num() > 0
&& !SummaryLine.IsEmpty()
&& HyperTwistMemoryCoreLibraryInternal::IsConfidenceScoreInRange(
ConfidenceScore)
&& EvidenceCount > 0
&& HyperTwistMemoryCoreLibraryInternal::HasValidProvenanceLinks(
ProvenanceLinks);
}
bool FHyperTwistMemoryCognitiveContradiction::IsStructurallyValid() const
{
return !ContradictionId.IsEmpty()
&& !FactFamily.IsEmpty()
&& !Headline.IsEmpty()
&& !UserId.IsEmpty()
&& !ReferenceUtc.IsEmpty()
&& !LeftFactId.IsEmpty()
&& !RightFactId.IsEmpty()
&& !ResolutionLabel.IsEmpty()
&& HyperTwistMemoryCoreLibraryInternal::HasValidProvenanceLinks(
ProvenanceLinks);
}
bool FHyperTwistMemoryCognitiveSupersession::IsStructurallyValid() const
{
return !SupersessionId.IsEmpty()
&& !FactFamily.IsEmpty()
&& !UserId.IsEmpty()
&& !ReferenceUtc.IsEmpty()
&& !PriorFactId.IsEmpty()
&& !CurrentFactId.IsEmpty()
&& !ReasonLabel.IsEmpty()
&& HyperTwistMemoryCoreLibraryInternal::HasValidProvenanceLinks(
ProvenanceLinks);
}
bool FHyperTwistMemoryConfidenceDecayEntry::IsStructurallyValid() const
{
return !DecayId.IsEmpty()
&& !FactId.IsEmpty()
&& !UserId.IsEmpty()
&& !ReferenceUtc.IsEmpty()
&& !TriggerLabel.IsEmpty()
&& HyperTwistMemoryCoreLibraryInternal::IsConfidenceScoreInRange(
PreviousConfidenceScore)
&& HyperTwistMemoryCoreLibraryInternal::IsConfidenceScoreInRange(
CurrentConfidenceScore)
&& CurrentConfidenceScore < PreviousConfidenceScore
&& HyperTwistMemoryCoreLibraryInternal::HasValidProvenanceLinks(
ProvenanceLinks);
}
bool FHyperTwistMemoryLedgerState::IsStructurallyValid() const
{
if (UserId.IsEmpty()
|| ReferenceUtc.IsEmpty()
|| LaneContracts.Num() == 0
@ -201,10 +278,10 @@ namespace HyperTwistMemoryCoreLibraryInternal
const int32 TotalEntityCount =
AuthoritativeEntityCount + SemiAuthoritativeEntityCount + DerivedEntityCount;
return TotalEntityCount == Entities.Num();
}
}
bool FHyperTwistMemoryChronicleContinuityState::IsStructurallyValid() const
{
bool FHyperTwistMemoryChronicleContinuityState::IsStructurallyValid() const
{
if (UserId.IsEmpty()
|| ReferenceUtc.IsEmpty()
|| (ChronicleEvents.Num() == 0
@ -260,10 +337,10 @@ namespace HyperTwistMemoryCoreLibraryInternal
&& OpenSessionGroupCount == ComputedOpenSessionGroupCount
&& ResumeRequiredCount == ResumePacks.Num()
&& BlockingGuardCount == ComputedBlockingGuardCount;
}
}
bool FHyperTwistMemoryRecallSharedContextState::IsStructurallyValid() const
{
bool FHyperTwistMemoryRecallSharedContextState::IsStructurallyValid() const
{
if (UserId.IsEmpty()
|| ReferenceUtc.IsEmpty()
|| QueryText.IsEmpty()
@ -304,10 +381,10 @@ namespace HyperTwistMemoryCoreLibraryInternal
&& SemiAuthoritativeRecallCount == ComputedSemiAuthoritativeRecallCount
&& SharedContextProjectionCount == SharedContextProjections.Num()
&& bHasScopedSharedContext == (SharedContextProjections.Num() > 0);
}
}
bool FHyperTwistMemoryCognitiveConsolidationState::IsStructurallyValid() const
{
bool FHyperTwistMemoryCognitiveConsolidationState::IsStructurallyValid() const
{
if (UserId.IsEmpty() || ReferenceUtc.IsEmpty() || Facts.Num() == 0)
{
return false;
@ -362,10 +439,59 @@ namespace HyperTwistMemoryCoreLibraryInternal
&& ContradictionCount == Contradictions.Num()
&& LowConfidenceFactCount == ComputedLowConfidenceFactCount
&& bHasOpenCognitiveReview == bComputedOpenCognitiveReview;
}
bool FHyperTwistMemoryKnowledgeObject::IsStructurallyValid() const
{
return !ObjectId.IsEmpty()
&& !ObjectKind.IsEmpty()
&& !Title.IsEmpty()
&& !Summary.IsEmpty()
&& !UserId.IsEmpty()
&& !ReferenceUtc.IsEmpty()
&& Lane == EHyperTwistMemoryLane::KnowledgeWiki
&& AuthorityKind == EHyperTwistMemoryAuthorityKind::Authoritative
&& !ScopeLabel.IsEmpty()
&& SourceRecordIds.Num() > 0
&& HyperTwistMemoryCoreLibraryInternal::HasValidProvenanceLinks(
ProvenanceLinks);
}
bool FHyperTwistMemoryKnowledgePromotionReview::IsStructurallyValid() const
{
return !ReviewId.IsEmpty()
&& !CandidateFactId.IsEmpty()
&& !UserId.IsEmpty()
&& !ReferenceUtc.IsEmpty()
&& !Headline.IsEmpty()
&& Decision != EHyperTwistMemoryKnowledgePromotionDecision::None
&& !ReasonLabel.IsEmpty()
&& HyperTwistMemoryCoreLibraryInternal::HasValidProvenanceLinks(
ProvenanceLinks);
}
bool FHyperTwistMemoryUserNotesPosture::IsStructurallyValid() const
{
const bool bCoreFieldsPresent = !UserId.IsEmpty()
&& !ReferenceUtc.IsEmpty()
&& Lane == EHyperTwistMemoryLane::UserNotes
&& !GateId.IsEmpty()
&& !SettingsKey.IsEmpty()
&& !Headline.IsEmpty()
&& !SummaryLine.IsEmpty()
&& HyperTwistMemoryCoreLibraryInternal::HasValidProvenanceLinks(
ProvenanceLinks);
if (!bCoreFieldsPresent)
{
return false;
}
bool FHyperTwistMemoryDerivedAdjunctState::IsStructurallyValid() const
{
return !bAcceptsUserAuthoredContent
|| (bOwnershipJustified && bLaneEnabled);
}
bool FHyperTwistMemoryDerivedAdjunctState::IsStructurallyValid() const
{
if (UserId.IsEmpty()
|| ReferenceUtc.IsEmpty()
|| ContextAssemblyProfile == EHyperTwistMemoryContextAssemblyProfile::None
@ -406,10 +532,58 @@ namespace HyperTwistMemoryCoreLibraryInternal
return CompactSummaryCount == 0
&& ReducedContextPacketCount == 0
&& DigestViewCount == 0;
}
}
bool FHyperTwistMemoryKnowledgeNotesState::IsStructurallyValid() const
{
bool FHyperTwistMemoryCompactSummary::IsStructurallyValid() const
{
return !SummaryId.IsEmpty()
&& !SummaryKind.IsEmpty()
&& !Headline.IsEmpty()
&& !SummaryText.IsEmpty()
&& !UserId.IsEmpty()
&& !ReferenceUtc.IsEmpty()
&& Lane == EHyperTwistMemoryLane::DerivedCompacted
&& AuthorityKind == EHyperTwistMemoryAuthorityKind::DerivedOnly
&& SourceEntityIds.Num() > 0
&& HyperTwistMemoryCoreLibraryInternal::HasValidProvenanceLinks(
ProvenanceLinks);
}
bool FHyperTwistMemoryReducedContextPacket::IsStructurallyValid() const
{
return !PacketId.IsEmpty()
&& !PacketKind.IsEmpty()
&& !Headline.IsEmpty()
&& !PacketBody.IsEmpty()
&& !UserId.IsEmpty()
&& !ReferenceUtc.IsEmpty()
&& Lane == EHyperTwistMemoryLane::DerivedCompacted
&& AuthorityKind == EHyperTwistMemoryAuthorityKind::DerivedOnly
&& MaxTokenHint > 0
&& SourceEntityIds.Num() > 0
&& HyperTwistMemoryCoreLibraryInternal::HasValidProvenanceLinks(
ProvenanceLinks);
}
bool FHyperTwistMemoryDigestView::IsStructurallyValid() const
{
return !DigestId.IsEmpty()
&& !DigestKind.IsEmpty()
&& !Title.IsEmpty()
&& !SummaryLine.IsEmpty()
&& !UserId.IsEmpty()
&& !ReferenceUtc.IsEmpty()
&& Lane == EHyperTwistMemoryLane::DerivedCompacted
&& AuthorityKind == EHyperTwistMemoryAuthorityKind::DerivedOnly
&& bUserVisible
&& bRemovable
&& SourceEntityIds.Num() > 0
&& HyperTwistMemoryCoreLibraryInternal::HasValidProvenanceLinks(
ProvenanceLinks);
}
bool FHyperTwistMemoryKnowledgeNotesState::IsStructurallyValid() const
{
if (UserId.IsEmpty()
|| ReferenceUtc.IsEmpty()
|| KnowledgeObjects.Num() == 0
@ -438,7 +612,10 @@ namespace HyperTwistMemoryCoreLibraryInternal
&& ComputedPromotionCount == PromotionReviews.Num()
&& bKnowledgeWikiEnabled
&& bUserNotesLaneAvailable == bComputedUserNotesLaneAvailable;
}
}
namespace HyperTwistMemoryCoreLibraryInternal
{
void AddChronicleEvent(
FHyperTwistMemoryChronicleContinuityState& ChronicleContinuityState,

View file

@ -1005,36 +1005,7 @@ struct FHyperTwistMemoryCognitiveFact
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
TArray<FHyperTwistMemoryProvenanceLink> ProvenanceLinks;
bool IsStructurallyValid() const
{
if (FactId.IsEmpty()
|| FactFamily.IsEmpty()
|| FactKind.IsEmpty()
|| Headline.IsEmpty()
|| UserId.IsEmpty()
|| ReferenceUtc.IsEmpty()
|| Lane != EHyperTwistMemoryLane::CognitiveConsolidated
|| AuthorityKind == EHyperTwistMemoryAuthorityKind::None
|| SourceEntityIds.Num() == 0
|| SummaryLine.IsEmpty()
|| ConfidenceScore < 0
|| ConfidenceScore > 100
|| EvidenceCount <= 0
|| ProvenanceLinks.Num() == 0)
{
return false;
}
for (const FHyperTwistMemoryProvenanceLink& ProvenanceLink : ProvenanceLinks)
{
if (!ProvenanceLink.IsStructurallyValid())
{
return false;
}
}
return true;
}
bool IsStructurallyValid() const;
};
USTRUCT(BlueprintType)
@ -1075,31 +1046,7 @@ struct FHyperTwistMemoryCognitiveContradiction
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
TArray<FHyperTwistMemoryProvenanceLink> ProvenanceLinks;
bool IsStructurallyValid() const
{
if (ContradictionId.IsEmpty()
|| FactFamily.IsEmpty()
|| Headline.IsEmpty()
|| UserId.IsEmpty()
|| ReferenceUtc.IsEmpty()
|| LeftFactId.IsEmpty()
|| RightFactId.IsEmpty()
|| ResolutionLabel.IsEmpty()
|| ProvenanceLinks.Num() == 0)
{
return false;
}
for (const FHyperTwistMemoryProvenanceLink& ProvenanceLink : ProvenanceLinks)
{
if (!ProvenanceLink.IsStructurallyValid())
{
return false;
}
}
return true;
}
bool IsStructurallyValid() const;
};
USTRUCT(BlueprintType)
@ -1134,30 +1081,7 @@ struct FHyperTwistMemoryCognitiveSupersession
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
TArray<FHyperTwistMemoryProvenanceLink> ProvenanceLinks;
bool IsStructurallyValid() const
{
if (SupersessionId.IsEmpty()
|| FactFamily.IsEmpty()
|| UserId.IsEmpty()
|| ReferenceUtc.IsEmpty()
|| PriorFactId.IsEmpty()
|| CurrentFactId.IsEmpty()
|| ReasonLabel.IsEmpty()
|| ProvenanceLinks.Num() == 0)
{
return false;
}
for (const FHyperTwistMemoryProvenanceLink& ProvenanceLink : ProvenanceLinks)
{
if (!ProvenanceLink.IsStructurallyValid())
{
return false;
}
}
return true;
}
bool IsStructurallyValid() const;
};
USTRUCT(BlueprintType)
@ -1192,33 +1116,7 @@ struct FHyperTwistMemoryConfidenceDecayEntry
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
TArray<FHyperTwistMemoryProvenanceLink> ProvenanceLinks;
bool IsStructurallyValid() const
{
if (DecayId.IsEmpty()
|| FactId.IsEmpty()
|| UserId.IsEmpty()
|| ReferenceUtc.IsEmpty()
|| TriggerLabel.IsEmpty()
|| PreviousConfidenceScore < 0
|| PreviousConfidenceScore > 100
|| CurrentConfidenceScore < 0
|| CurrentConfidenceScore > 100
|| CurrentConfidenceScore >= PreviousConfidenceScore
|| ProvenanceLinks.Num() == 0)
{
return false;
}
for (const FHyperTwistMemoryProvenanceLink& ProvenanceLink : ProvenanceLinks)
{
if (!ProvenanceLink.IsStructurallyValid())
{
return false;
}
}
return true;
}
bool IsStructurallyValid() const;
};
USTRUCT(BlueprintType)
@ -1304,33 +1202,7 @@ struct FHyperTwistMemoryKnowledgeObject
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
TArray<FHyperTwistMemoryProvenanceLink> ProvenanceLinks;
bool IsStructurallyValid() const
{
if (ObjectId.IsEmpty()
|| ObjectKind.IsEmpty()
|| Title.IsEmpty()
|| Summary.IsEmpty()
|| UserId.IsEmpty()
|| ReferenceUtc.IsEmpty()
|| Lane != EHyperTwistMemoryLane::KnowledgeWiki
|| AuthorityKind != EHyperTwistMemoryAuthorityKind::Authoritative
|| ScopeLabel.IsEmpty()
|| SourceRecordIds.Num() == 0
|| ProvenanceLinks.Num() == 0)
{
return false;
}
for (const FHyperTwistMemoryProvenanceLink& ProvenanceLink : ProvenanceLinks)
{
if (!ProvenanceLink.IsStructurallyValid())
{
return false;
}
}
return true;
}
bool IsStructurallyValid() const;
};
USTRUCT(BlueprintType)
@ -1372,30 +1244,7 @@ struct FHyperTwistMemoryKnowledgePromotionReview
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
TArray<FHyperTwistMemoryProvenanceLink> ProvenanceLinks;
bool IsStructurallyValid() const
{
if (ReviewId.IsEmpty()
|| CandidateFactId.IsEmpty()
|| UserId.IsEmpty()
|| ReferenceUtc.IsEmpty()
|| Headline.IsEmpty()
|| Decision == EHyperTwistMemoryKnowledgePromotionDecision::None
|| ReasonLabel.IsEmpty()
|| ProvenanceLinks.Num() == 0)
{
return false;
}
for (const FHyperTwistMemoryProvenanceLink& ProvenanceLink : ProvenanceLinks)
{
if (!ProvenanceLink.IsStructurallyValid())
{
return false;
}
}
return true;
}
bool IsStructurallyValid() const;
};
USTRUCT(BlueprintType)
@ -1439,32 +1288,7 @@ struct FHyperTwistMemoryUserNotesPosture
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
TArray<FHyperTwistMemoryProvenanceLink> ProvenanceLinks;
bool IsStructurallyValid() const
{
if (UserId.IsEmpty()
|| ReferenceUtc.IsEmpty()
|| Lane != EHyperTwistMemoryLane::UserNotes
|| GateId.IsEmpty()
|| SettingsKey.IsEmpty()
|| Headline.IsEmpty()
|| SummaryLine.IsEmpty()
|| ProvenanceLinks.Num() == 0)
{
return false;
}
for (const FHyperTwistMemoryProvenanceLink& ProvenanceLink : ProvenanceLinks)
{
if (!ProvenanceLink.IsStructurallyValid())
{
return false;
}
}
return bAcceptsUserAuthoredContent
? (bOwnershipJustified && bLaneEnabled)
: true;
}
bool IsStructurallyValid() const;
};
USTRUCT(BlueprintType)
@ -1544,32 +1368,7 @@ struct FHyperTwistMemoryCompactSummary
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
TArray<FHyperTwistMemoryProvenanceLink> ProvenanceLinks;
bool IsStructurallyValid() const
{
if (SummaryId.IsEmpty()
|| SummaryKind.IsEmpty()
|| Headline.IsEmpty()
|| SummaryText.IsEmpty()
|| UserId.IsEmpty()
|| ReferenceUtc.IsEmpty()
|| Lane != EHyperTwistMemoryLane::DerivedCompacted
|| AuthorityKind != EHyperTwistMemoryAuthorityKind::DerivedOnly
|| SourceEntityIds.Num() == 0
|| ProvenanceLinks.Num() == 0)
{
return false;
}
for (const FHyperTwistMemoryProvenanceLink& ProvenanceLink : ProvenanceLinks)
{
if (!ProvenanceLink.IsStructurallyValid())
{
return false;
}
}
return true;
}
bool IsStructurallyValid() const;
};
USTRUCT(BlueprintType)
@ -1611,33 +1410,7 @@ struct FHyperTwistMemoryReducedContextPacket
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
TArray<FHyperTwistMemoryProvenanceLink> ProvenanceLinks;
bool IsStructurallyValid() const
{
if (PacketId.IsEmpty()
|| PacketKind.IsEmpty()
|| Headline.IsEmpty()
|| PacketBody.IsEmpty()
|| UserId.IsEmpty()
|| ReferenceUtc.IsEmpty()
|| Lane != EHyperTwistMemoryLane::DerivedCompacted
|| AuthorityKind != EHyperTwistMemoryAuthorityKind::DerivedOnly
|| MaxTokenHint <= 0
|| SourceEntityIds.Num() == 0
|| ProvenanceLinks.Num() == 0)
{
return false;
}
for (const FHyperTwistMemoryProvenanceLink& ProvenanceLink : ProvenanceLinks)
{
if (!ProvenanceLink.IsStructurallyValid())
{
return false;
}
}
return true;
}
bool IsStructurallyValid() const;
};
USTRUCT(BlueprintType)
@ -1682,34 +1455,7 @@ struct FHyperTwistMemoryDigestView
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
TArray<FHyperTwistMemoryProvenanceLink> ProvenanceLinks;
bool IsStructurallyValid() const
{
if (DigestId.IsEmpty()
|| DigestKind.IsEmpty()
|| Title.IsEmpty()
|| SummaryLine.IsEmpty()
|| UserId.IsEmpty()
|| ReferenceUtc.IsEmpty()
|| Lane != EHyperTwistMemoryLane::DerivedCompacted
|| AuthorityKind != EHyperTwistMemoryAuthorityKind::DerivedOnly
|| !bUserVisible
|| !bRemovable
|| SourceEntityIds.Num() == 0
|| ProvenanceLinks.Num() == 0)
{
return false;
}
for (const FHyperTwistMemoryProvenanceLink& ProvenanceLink : ProvenanceLinks)
{
if (!ProvenanceLink.IsStructurallyValid())
{
return false;
}
}
return true;
}
bool IsStructurallyValid() const;
};
USTRUCT(BlueprintType)

View file

@ -634,6 +634,57 @@ Latest same-day browser/distribution continuity follow-up still on `2026-06-24`:
## Canonical development authorities
Latest later memory-header follow-up still on `2026-06-25`:
- the next bounded memory-family refactor packet then moved the larger
cognitive, knowledge, and derived-record validators out of
`Public/HyperTwistMemory/HyperTwistMemoryTypes.h` and into
`Private/HyperTwistMemory/HyperTwistMemoryCoreLibrary.cpp` for:
- `FHyperTwistMemoryCognitiveFact::IsStructurallyValid()`
- `FHyperTwistMemoryCognitiveContradiction::IsStructurallyValid()`
- `FHyperTwistMemoryCognitiveSupersession::IsStructurallyValid()`
- `FHyperTwistMemoryConfidenceDecayEntry::IsStructurallyValid()`
- `FHyperTwistMemoryKnowledgeObject::IsStructurallyValid()`
- `FHyperTwistMemoryKnowledgePromotionReview::IsStructurallyValid()`
- `FHyperTwistMemoryUserNotesPosture::IsStructurallyValid()`
- `FHyperTwistMemoryCompactSummary::IsStructurallyValid()`
- `FHyperTwistMemoryReducedContextPacket::IsStructurallyValid()`
- `FHyperTwistMemoryDigestView::IsStructurallyValid()`
- the private memory core now also owns the new shared scalar and provenance
helpers:
- `IsConfidenceScoreInRange(...)`
- `HasValidProvenanceLinks(...)`
- the authoritative Windows Unreal lane caught a real refactor mistake on the
first rerun:
- the initial remote rebuild failed because the new record validators were
still placed inside the helper namespace
- the slice was repaired immediately, re-synced to the maintained validation
root, and rerun cleanly instead of treating that failed pass as acceptable
- `scripts/run-hypertwist-sentrux-source-only.sh` then improved again to:
- `Quality: 6211`
- all `7` rules passing
- `scripts/run-hypertwist-gitnexus-analyze.sh` then refreshed the bounded
source-only mirror again at:
- `16,257` nodes
- `38,063` edges
- `668` clusters
- `300` flows
- the doctrine-clean Windows Unreal rerun against
`C:\HyperTwist_worktrees\phase10validate` then succeeded after the repair:
- `Result: Succeeded`
- parallel executor time `78.40 seconds`
- total execution time `85.25 seconds`
- the current largest remaining inline validators now shift to:
- `36` lines in `Public/HyperTwistSimulation/HyperTwistViewerTypes.h`
- `30` lines in `Public/HyperTwistRecognition/HyperTwistRecognitionTypes.h`
- `27` lines for `FHyperTwistMemoryRecallMatch`
- `26` lines for `FHyperTwistMemoryResumePack`
- current truthful “vanilla refactor” reading tightens again:
- the larger cognitive/knowledge/derived memory-record cluster is now drained
- remaining structural cleanup is now a choice between the viewer family, the
recognition family, or smaller remaining memory seams rather than another
obvious large memory-header block
Use these before widening implementation:
- `ROADMAP.md` for current queue truth