diff --git a/UnrealHyperTwist/Source/UnrealHyperTwist/Private/HyperTwistSkills/HyperTwistSkillTypes.cpp b/UnrealHyperTwist/Source/UnrealHyperTwist/Private/HyperTwistSkills/HyperTwistSkillTypes.cpp index 2de2a70..5a638aa 100644 --- a/UnrealHyperTwist/Source/UnrealHyperTwist/Private/HyperTwistSkills/HyperTwistSkillTypes.cpp +++ b/UnrealHyperTwist/Source/UnrealHyperTwist/Private/HyperTwistSkills/HyperTwistSkillTypes.cpp @@ -14,6 +14,27 @@ namespace HyperTwistSkillTypesInternal return true; } + + template + bool AreAllItemsStructurallyValid(const TArray& Values) + { + for (const ItemType& Value : Values) + { + if (!Value.IsStructurallyValid()) + { + return false; + } + } + + return true; + } + + bool IsImplementedPermissiveWrapperSkillId(const FString& SkillId) + { + return SkillId == TEXT("skill/review-architecture") + || SkillId == TEXT("skill/memory-resume-briefing") + || SkillId == TEXT("skill/provider-routing-inspector"); + } } bool FHyperTwistSkillExtractionSkill::IsStructurallyValid() const @@ -1942,3 +1963,444 @@ bool FHyperTwistSkillCreativeMediaPackState::IsStructurallyValid() const && bBoundarySensitiveLicensingRemainsExplicit == bComputedBoundarySensitiveLicensingRemainsExplicit; } + +bool FHyperTwistSkillAnalyzerWrapperState::IsStructurallyValid() const +{ + if (RegistryId.IsEmpty() + || ManifestVersion.IsEmpty() + || ReferenceUtc.IsEmpty() + || CommandSurfaceRootId.IsEmpty() + || TemplateVersion.IsEmpty() + || Outputs.Num() == 0 + || SkillCount <= 0 + || OutputCount != Outputs.Num() + || ArchitectureScanCount < 0 + || PolicyScanCount < 0 + || RouteInspectionCount < 0 + || WatchAndRecheckCount < 0 + || !bEveryWrapperMapsToStableInvocationPattern + || !bEveryWrapperEmitsStructuredOutput + || !bOnlyImplementedPermissiveWrappersIncluded) + { + return false; + } + + TArray SeenOutputIds; + TArray SeenSkillIds; + int32 ComputedArchitectureScanCount = 0; + int32 ComputedPolicyScanCount = 0; + int32 ComputedRouteInspectionCount = 0; + int32 ComputedWatchAndRecheckCount = 0; + bool bComputedStableInvocationPattern = true; + bool bComputedStructuredOutput = true; + bool bComputedOnlyImplementedPermissiveWrappersIncluded = true; + + for (const FHyperTwistSkillAnalyzerWrapperOutput& Output : Outputs) + { + if (!Output.IsStructurallyValid() || SeenOutputIds.Contains(Output.WrapperOutputId)) + { + return false; + } + + SeenOutputIds.Add(Output.WrapperOutputId); + SeenSkillIds.AddUnique(Output.SkillId); + bComputedStableInvocationPattern &= Output.bStableInvocationPattern; + bComputedStructuredOutput &= Output.bStructuredOutput; + bComputedOnlyImplementedPermissiveWrappersIncluded &= + HyperTwistSkillTypesInternal::IsImplementedPermissiveWrapperSkillId(Output.SkillId); + + if (Output.OutputKindId == TEXT("wrapper-output/architecture-scan")) + { + ComputedArchitectureScanCount += 1; + } + else if (Output.OutputKindId == TEXT("wrapper-output/policy-scan")) + { + ComputedPolicyScanCount += 1; + } + else if (Output.OutputKindId == TEXT("wrapper-output/route-inspection")) + { + ComputedRouteInspectionCount += 1; + } + else if (Output.OutputKindId == TEXT("wrapper-output/watch-and-recheck")) + { + ComputedWatchAndRecheckCount += 1; + } + else + { + return false; + } + } + + return SkillCount == SeenSkillIds.Num() + && ArchitectureScanCount == ComputedArchitectureScanCount + && PolicyScanCount == ComputedPolicyScanCount + && RouteInspectionCount == ComputedRouteInspectionCount + && WatchAndRecheckCount == ComputedWatchAndRecheckCount + && bEveryWrapperMapsToStableInvocationPattern == bComputedStableInvocationPattern + && bEveryWrapperEmitsStructuredOutput == bComputedStructuredOutput + && bOnlyImplementedPermissiveWrappersIncluded + == bComputedOnlyImplementedPermissiveWrappersIncluded; +} + +bool FHyperTwistSkillCleanRoomCommandContractSpec::IsStructurallyValid() const +{ + if (SpecId.IsEmpty() + || SkillId.IsEmpty() + || DisplayLabel.IsEmpty() + || CommandSurfaceId.IsEmpty() + || ServiceBindingId.IsEmpty() + || OwnerLaneId.IsEmpty() + || OwnerFeatureId.IsEmpty() + || InvocationPattern.IsEmpty() + || ArtifactKind.IsEmpty() + || PermissionScopeIds.Num() == 0 + || RequiredTemplateSectionIds.Num() == 0 + || SafetyRuleIds.Num() == 0 + || SmokeExecutionMode != EHyperTwistSkillValidationExecutionMode::DeclarationOnly + || EvalExecutionMode + != EHyperTwistSkillValidationExecutionMode::DeferredUntilCleanRoomSkillSpec + || !bUsesFirstPartyTermsOnly + || !bAvoidsDonorWording + || !bPreservesOptionalAssistiveOffState + || !bDerivedAssistiveOnly + || !bRequiresProvenanceLedger + || !bNoProductTruthMutation + || !bFutureWrapperMayBindWithoutContractRewrite) + { + return false; + } + + return HyperTwistSkillTypesInternal::AreAllStringsPopulated(PermissionScopeIds) + && HyperTwistSkillTypesInternal::AreAllStringsPopulated(RequiredTemplateSectionIds) + && HyperTwistSkillTypesInternal::AreAllStringsPopulated(SafetyRuleIds); +} + +bool FHyperTwistSkillCleanRoomCommandContractState::IsStructurallyValid() const +{ + if (RegistryId.IsEmpty() + || ManifestVersion.IsEmpty() + || ReferenceUtc.IsEmpty() + || CommandSurfaceRootId.IsEmpty() + || TemplateVersion.IsEmpty() + || Specs.Num() == 0 + || SkillCount <= 0 + || SpecCount != Specs.Num() + || SafetyRuleCount <= 0 + || !bEverySpecUsesFirstPartyTerms + || !bEverySpecAvoidsDonorWording + || !bEverySpecPreservesOptionalAssistiveOffState + || !bEverySpecRestrictsToDerivedAssistiveOutput + || !bEverySpecRequiresProvenanceLedger + || !bEverySpecAvoidsProductTruthMutation + || !bEverySpecMayBindFutureWrapperWithoutContractRewrite + || !bEverySpecHasAuthoringHarnessCoverage + || !bEverySpecDefersEvalUntilCleanRoomSkillSpec) + { + return false; + } + + TArray SeenSpecIds; + TArray SeenSkillIds; + TArray SeenSafetyRuleIds; + bool bComputedFirstPartyTerms = true; + bool bComputedAvoidsDonorWording = true; + bool bComputedPreservesOffState = true; + bool bComputedDerivedAssistiveOnly = true; + bool bComputedRequiresProvenanceLedger = true; + bool bComputedAvoidsProductTruthMutation = true; + bool bComputedMayBindWithoutRewrite = true; + bool bComputedHasHarnessCoverage = true; + bool bComputedDefersEvalUntilSkillSpec = true; + + for (const FHyperTwistSkillCleanRoomCommandContractSpec& Spec : Specs) + { + if (!Spec.IsStructurallyValid() || SeenSpecIds.Contains(Spec.SpecId)) + { + return false; + } + + SeenSpecIds.Add(Spec.SpecId); + SeenSkillIds.AddUnique(Spec.SkillId); + bComputedFirstPartyTerms &= Spec.bUsesFirstPartyTermsOnly; + bComputedAvoidsDonorWording &= Spec.bAvoidsDonorWording; + bComputedPreservesOffState &= Spec.bPreservesOptionalAssistiveOffState; + bComputedDerivedAssistiveOnly &= Spec.bDerivedAssistiveOnly; + bComputedRequiresProvenanceLedger &= Spec.bRequiresProvenanceLedger; + bComputedAvoidsProductTruthMutation &= Spec.bNoProductTruthMutation; + bComputedMayBindWithoutRewrite &= Spec.bFutureWrapperMayBindWithoutContractRewrite; + bComputedHasHarnessCoverage &= Spec.RequiredTemplateSectionIds.Num() > 0; + bComputedDefersEvalUntilSkillSpec &= + Spec.EvalExecutionMode + == EHyperTwistSkillValidationExecutionMode::DeferredUntilCleanRoomSkillSpec; + + for (const FString& SafetyRuleId : Spec.SafetyRuleIds) + { + SeenSafetyRuleIds.AddUnique(SafetyRuleId); + } + } + + return SkillCount == SeenSkillIds.Num() + && SafetyRuleCount == SeenSafetyRuleIds.Num() + && bEverySpecUsesFirstPartyTerms == bComputedFirstPartyTerms + && bEverySpecAvoidsDonorWording == bComputedAvoidsDonorWording + && bEverySpecPreservesOptionalAssistiveOffState == bComputedPreservesOffState + && bEverySpecRestrictsToDerivedAssistiveOutput == bComputedDerivedAssistiveOnly + && bEverySpecRequiresProvenanceLedger == bComputedRequiresProvenanceLedger + && bEverySpecAvoidsProductTruthMutation == bComputedAvoidsProductTruthMutation + && bEverySpecMayBindFutureWrapperWithoutContractRewrite == bComputedMayBindWithoutRewrite + && bEverySpecHasAuthoringHarnessCoverage == bComputedHasHarnessCoverage + && bEverySpecDefersEvalUntilCleanRoomSkillSpec == bComputedDefersEvalUntilSkillSpec; +} + +bool FHyperTwistSkillCleanRoomSkillSpec::IsStructurallyValid() const +{ + if (SkillSpecId.IsEmpty() + || SkillId.IsEmpty() + || DisplayLabel.IsEmpty() + || CommandContractSpecId.IsEmpty() + || CommandSurfaceId.IsEmpty() + || ServiceBindingId.IsEmpty() + || OwnerLaneId.IsEmpty() + || OwnerFeatureId.IsEmpty() + || InputStateKinds.Num() == 0 + || OutputArtifactKinds.Num() == 0 + || SpecStepIds.Num() == 0 + || SafetyRuleIds.Num() == 0 + || RequiredTemplateSectionIds.Num() == 0 + || SmokeExecutionMode != EHyperTwistSkillValidationExecutionMode::DeclarationOnly + || EvalExecutionMode != EHyperTwistSkillValidationExecutionMode::DeclarationOnly + || !bUsesFirstPartyTermsOnly + || !bAvoidsDonorWording + || !bSpecReadyForFutureImplementation + || !bNotLiveImplementationYet + || !bPreservesOptionalAssistiveOffState + || !bDerivedAssistiveOnly + || !bRequiresProvenanceLedger + || !bNoProductTruthMutation) + { + return false; + } + + return HyperTwistSkillTypesInternal::AreAllStringsPopulated(InputStateKinds) + && HyperTwistSkillTypesInternal::AreAllStringsPopulated(OutputArtifactKinds) + && HyperTwistSkillTypesInternal::AreAllStringsPopulated(SpecStepIds) + && HyperTwistSkillTypesInternal::AreAllStringsPopulated(SafetyRuleIds) + && HyperTwistSkillTypesInternal::AreAllStringsPopulated(RequiredTemplateSectionIds); +} + +bool FHyperTwistSkillCleanRoomSkillSpecState::IsStructurallyValid() const +{ + if (RegistryId.IsEmpty() + || ManifestVersion.IsEmpty() + || ReferenceUtc.IsEmpty() + || CommandSurfaceRootId.IsEmpty() + || TemplateVersion.IsEmpty() + || Specs.Num() == 0 + || SkillCount <= 0 + || SpecCount != Specs.Num() + || StepCount <= 0 + || SafetyRuleCount <= 0 + || !bEverySpecUsesFirstPartyTerms + || !bEverySpecAvoidsDonorWording + || !bEverySpecBindsToCommandContractState + || !bEverySpecReadyForFutureImplementation + || !bNoSpecClaimsLiveImplementation + || !bEverySpecPreservesOptionalAssistiveOffState + || !bEverySpecRestrictsToDerivedAssistiveOutput + || !bEverySpecRequiresProvenanceLedger + || !bEverySpecAvoidsProductTruthMutation + || !bEverySpecHasAuthoringHarnessCoverage + || !bEverySpecUsesDeclarationOnlyValidation) + { + return false; + } + + TArray SeenSpecIds; + TArray SeenSkillIds; + TArray SeenStepIds; + TArray SeenSafetyRuleIds; + bool bComputedFirstPartyTerms = true; + bool bComputedAvoidsDonorWording = true; + bool bComputedBindsToCommandContractState = true; + bool bComputedReadyForFutureImplementation = true; + bool bComputedNoLiveImplementation = true; + bool bComputedPreservesOffState = true; + bool bComputedDerivedAssistiveOnly = true; + bool bComputedRequiresProvenanceLedger = true; + bool bComputedAvoidsProductTruthMutation = true; + bool bComputedHasHarnessCoverage = true; + bool bComputedUsesDeclarationOnlyValidation = true; + + for (const FHyperTwistSkillCleanRoomSkillSpec& Spec : Specs) + { + if (!Spec.IsStructurallyValid() || SeenSpecIds.Contains(Spec.SkillSpecId)) + { + return false; + } + + SeenSpecIds.Add(Spec.SkillSpecId); + SeenSkillIds.AddUnique(Spec.SkillId); + bComputedFirstPartyTerms &= Spec.bUsesFirstPartyTermsOnly; + bComputedAvoidsDonorWording &= Spec.bAvoidsDonorWording; + bComputedBindsToCommandContractState &= !Spec.CommandContractSpecId.IsEmpty(); + bComputedReadyForFutureImplementation &= Spec.bSpecReadyForFutureImplementation; + bComputedNoLiveImplementation &= Spec.bNotLiveImplementationYet; + bComputedPreservesOffState &= Spec.bPreservesOptionalAssistiveOffState; + bComputedDerivedAssistiveOnly &= Spec.bDerivedAssistiveOnly; + bComputedRequiresProvenanceLedger &= Spec.bRequiresProvenanceLedger; + bComputedAvoidsProductTruthMutation &= Spec.bNoProductTruthMutation; + bComputedHasHarnessCoverage &= Spec.RequiredTemplateSectionIds.Num() > 0; + bComputedUsesDeclarationOnlyValidation &= + Spec.SmokeExecutionMode == EHyperTwistSkillValidationExecutionMode::DeclarationOnly + && Spec.EvalExecutionMode == EHyperTwistSkillValidationExecutionMode::DeclarationOnly; + + for (const FString& StepId : Spec.SpecStepIds) + { + SeenStepIds.AddUnique(StepId); + } + + for (const FString& SafetyRuleId : Spec.SafetyRuleIds) + { + SeenSafetyRuleIds.AddUnique(SafetyRuleId); + } + } + + return SkillCount == SeenSkillIds.Num() + && StepCount == SeenStepIds.Num() + && SafetyRuleCount == SeenSafetyRuleIds.Num() + && bEverySpecUsesFirstPartyTerms == bComputedFirstPartyTerms + && bEverySpecAvoidsDonorWording == bComputedAvoidsDonorWording + && bEverySpecBindsToCommandContractState == bComputedBindsToCommandContractState + && bEverySpecReadyForFutureImplementation == bComputedReadyForFutureImplementation + && bNoSpecClaimsLiveImplementation == bComputedNoLiveImplementation + && bEverySpecPreservesOptionalAssistiveOffState == bComputedPreservesOffState + && bEverySpecRestrictsToDerivedAssistiveOutput == bComputedDerivedAssistiveOnly + && bEverySpecRequiresProvenanceLedger == bComputedRequiresProvenanceLedger + && bEverySpecAvoidsProductTruthMutation == bComputedAvoidsProductTruthMutation + && bEverySpecHasAuthoringHarnessCoverage == bComputedHasHarnessCoverage + && bEverySpecUsesDeclarationOnlyValidation == bComputedUsesDeclarationOnlyValidation; +} + +bool FHyperTwistSkillContinuityResumeSkill::IsStructurallyValid() const +{ + if (SkillId.IsEmpty() + || DisplayLabel.IsEmpty() + || CommandSurfaceId.IsEmpty() + || ServiceBindingId.IsEmpty() + || OwnerLaneId.IsEmpty() + || OwnerFeatureId.IsEmpty() + || Status == EHyperTwistSkillStatus::None + || PermissionScopeIds.Num() == 0 + || InputStateKinds.Num() == 0 + || OutputArtifactKinds.Num() == 0 + || PreviewHeadlines.Num() == 0 + || AvailableItemCount < 0 + || BlockingItemCount < 0 + || !bReadsAuthoritativeStores + || !bPreservesOptionalAssistiveOffState + || !bDerivedAssistiveOnly + || !bHasValidationHarnessCoverage) + { + return false; + } + + if (!HyperTwistSkillTypesInternal::AreAllStringsPopulated(PermissionScopeIds) + || !HyperTwistSkillTypesInternal::AreAllStringsPopulated(InputStateKinds) + || !HyperTwistSkillTypesInternal::AreAllStringsPopulated(OutputArtifactKinds) + || !HyperTwistSkillTypesInternal::AreAllStringsPopulated(PreviewHeadlines)) + { + return false; + } + + if (Status == EHyperTwistSkillStatus::ImplementedNow) + { + return bLiveSkill && bAvailableNow && !bRequiresOwnerActivation; + } + + if (Status == EHyperTwistSkillStatus::CommandContractPending) + { + return !bLiveSkill && !bAvailableNow && bRequiresOwnerActivation; + } + + return false; +} + +bool FHyperTwistSkillContinuityResumeState::IsStructurallyValid() const +{ + if (RegistryId.IsEmpty() + || ManifestVersion.IsEmpty() + || ReferenceUtc.IsEmpty() + || CommandSurfaceRootId.IsEmpty() + || TemplateVersion.IsEmpty() + || Skills.Num() == 0 + || SkillCount != Skills.Num() + || !bEveryLiveSkillReadsAuthoritativeStores + || !bEverySkillPreservesOptionalAssistiveOffState + || !bEveryLiveSkillHasValidationHarnessCoverage + || !bNoSkillClaimsActiveUserNoteCaptureWithoutOwnerActivation) + { + return false; + } + + TArray SeenSkillIds; + int32 ComputedLiveSkillCount = 0; + int32 ComputedAvailableNowCount = 0; + int32 ComputedPendingSkillCount = 0; + int32 ComputedResumeSessionSkillCount = 0; + int32 ComputedSearchHistorySkillCount = 0; + int32 ComputedCaptureNoteSkillCount = 0; + bool bComputedEveryLiveSkillReadsAuthoritativeStores = true; + bool bComputedEverySkillPreservesOptionalAssistiveOffState = true; + bool bComputedEveryLiveSkillHasValidationHarnessCoverage = true; + bool bComputedCaptureNoteGuard = false; + + for (const FHyperTwistSkillContinuityResumeSkill& Skill : Skills) + { + if (!Skill.IsStructurallyValid() || SeenSkillIds.Contains(Skill.SkillId)) + { + return false; + } + + SeenSkillIds.Add(Skill.SkillId); + ComputedLiveSkillCount += Skill.bLiveSkill ? 1 : 0; + ComputedAvailableNowCount += Skill.bAvailableNow ? 1 : 0; + ComputedPendingSkillCount += + Skill.Status == EHyperTwistSkillStatus::CommandContractPending ? 1 : 0; + ComputedResumeSessionSkillCount += + Skill.SkillId == TEXT("skill/resume-session") ? 1 : 0; + ComputedSearchHistorySkillCount += + Skill.SkillId == TEXT("skill/search-history") ? 1 : 0; + ComputedCaptureNoteSkillCount += + Skill.SkillId == TEXT("skill/capture-note") ? 1 : 0; + bComputedEverySkillPreservesOptionalAssistiveOffState &= + Skill.bPreservesOptionalAssistiveOffState; + + if (Skill.bLiveSkill) + { + bComputedEveryLiveSkillReadsAuthoritativeStores &= Skill.bReadsAuthoritativeStores; + bComputedEveryLiveSkillHasValidationHarnessCoverage &= + Skill.bHasValidationHarnessCoverage; + } + + if (Skill.SkillId == TEXT("skill/capture-note")) + { + bComputedCaptureNoteGuard = + !Skill.bLiveSkill && !Skill.bAvailableNow && Skill.bRequiresOwnerActivation; + } + } + + return LiveSkillCount == ComputedLiveSkillCount + && AvailableNowCount == ComputedAvailableNowCount + && PendingSkillCount == ComputedPendingSkillCount + && ResumeSessionSkillCount == ComputedResumeSessionSkillCount + && SearchHistorySkillCount == ComputedSearchHistorySkillCount + && CaptureNoteSkillCount == ComputedCaptureNoteSkillCount + && bEveryLiveSkillReadsAuthoritativeStores + == bComputedEveryLiveSkillReadsAuthoritativeStores + && bEverySkillPreservesOptionalAssistiveOffState + == bComputedEverySkillPreservesOptionalAssistiveOffState + && bEveryLiveSkillHasValidationHarnessCoverage + == bComputedEveryLiveSkillHasValidationHarnessCoverage + && bNoSkillClaimsActiveUserNoteCaptureWithoutOwnerActivation + == bComputedCaptureNoteGuard; +} diff --git a/UnrealHyperTwist/Source/UnrealHyperTwist/Public/HyperTwistSkills/HyperTwistSkillTypes.h b/UnrealHyperTwist/Source/UnrealHyperTwist/Public/HyperTwistSkills/HyperTwistSkillTypes.h index b8c0876..66cece2 100644 --- a/UnrealHyperTwist/Source/UnrealHyperTwist/Public/HyperTwistSkills/HyperTwistSkillTypes.h +++ b/UnrealHyperTwist/Source/UnrealHyperTwist/Public/HyperTwistSkills/HyperTwistSkillTypes.h @@ -1403,85 +1403,7 @@ struct FHyperTwistSkillAnalyzerWrapperState UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist") FString Summary; - bool IsStructurallyValid() const - { - if (RegistryId.IsEmpty() - || ManifestVersion.IsEmpty() - || ReferenceUtc.IsEmpty() - || CommandSurfaceRootId.IsEmpty() - || TemplateVersion.IsEmpty() - || Outputs.Num() == 0 - || SkillCount <= 0 - || OutputCount != Outputs.Num() - || ArchitectureScanCount < 0 - || PolicyScanCount < 0 - || RouteInspectionCount < 0 - || WatchAndRecheckCount < 0 - || !bEveryWrapperMapsToStableInvocationPattern - || !bEveryWrapperEmitsStructuredOutput - || !bOnlyImplementedPermissiveWrappersIncluded) - { - return false; - } - - TArray SeenOutputIds; - TArray SeenSkillIds; - int32 ComputedArchitectureScanCount = 0; - int32 ComputedPolicyScanCount = 0; - int32 ComputedRouteInspectionCount = 0; - int32 ComputedWatchAndRecheckCount = 0; - bool bComputedStableInvocationPattern = true; - bool bComputedStructuredOutput = true; - bool bComputedOnlyImplementedPermissiveWrappersIncluded = true; - - for (const FHyperTwistSkillAnalyzerWrapperOutput& Output : Outputs) - { - if (!Output.IsStructurallyValid() || SeenOutputIds.Contains(Output.WrapperOutputId)) - { - return false; - } - - SeenOutputIds.Add(Output.WrapperOutputId); - SeenSkillIds.AddUnique(Output.SkillId); - bComputedStableInvocationPattern &= Output.bStableInvocationPattern; - bComputedStructuredOutput &= Output.bStructuredOutput; - bComputedOnlyImplementedPermissiveWrappersIncluded &= - Output.SkillId == TEXT("skill/review-architecture") - || Output.SkillId == TEXT("skill/memory-resume-briefing") - || Output.SkillId == TEXT("skill/provider-routing-inspector"); - - if (Output.OutputKindId == TEXT("wrapper-output/architecture-scan")) - { - ComputedArchitectureScanCount += 1; - } - else if (Output.OutputKindId == TEXT("wrapper-output/policy-scan")) - { - ComputedPolicyScanCount += 1; - } - else if (Output.OutputKindId == TEXT("wrapper-output/route-inspection")) - { - ComputedRouteInspectionCount += 1; - } - else if (Output.OutputKindId == TEXT("wrapper-output/watch-and-recheck")) - { - ComputedWatchAndRecheckCount += 1; - } - else - { - return false; - } - } - - return SkillCount == SeenSkillIds.Num() - && ArchitectureScanCount == ComputedArchitectureScanCount - && PolicyScanCount == ComputedPolicyScanCount - && RouteInspectionCount == ComputedRouteInspectionCount - && WatchAndRecheckCount == ComputedWatchAndRecheckCount - && bEveryWrapperMapsToStableInvocationPattern == bComputedStableInvocationPattern - && bEveryWrapperEmitsStructuredOutput == bComputedStructuredOutput - && bOnlyImplementedPermissiveWrappersIncluded - == bComputedOnlyImplementedPermissiveWrappersIncluded; - } + bool IsStructurallyValid() const; }; USTRUCT(BlueprintType) @@ -1557,60 +1479,7 @@ struct FHyperTwistSkillCleanRoomCommandContractSpec UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist") FString Summary; - bool IsStructurallyValid() const - { - if (SpecId.IsEmpty() - || SkillId.IsEmpty() - || DisplayLabel.IsEmpty() - || CommandSurfaceId.IsEmpty() - || ServiceBindingId.IsEmpty() - || OwnerLaneId.IsEmpty() - || OwnerFeatureId.IsEmpty() - || InvocationPattern.IsEmpty() - || ArtifactKind.IsEmpty() - || PermissionScopeIds.Num() == 0 - || RequiredTemplateSectionIds.Num() == 0 - || SafetyRuleIds.Num() == 0 - || SmokeExecutionMode != EHyperTwistSkillValidationExecutionMode::DeclarationOnly - || EvalExecutionMode - != EHyperTwistSkillValidationExecutionMode::DeferredUntilCleanRoomSkillSpec - || !bUsesFirstPartyTermsOnly - || !bAvoidsDonorWording - || !bPreservesOptionalAssistiveOffState - || !bDerivedAssistiveOnly - || !bRequiresProvenanceLedger - || !bNoProductTruthMutation - || !bFutureWrapperMayBindWithoutContractRewrite) - { - return false; - } - - for (const FString& ScopeId : PermissionScopeIds) - { - if (ScopeId.IsEmpty()) - { - return false; - } - } - - for (const FString& SectionId : RequiredTemplateSectionIds) - { - if (SectionId.IsEmpty()) - { - return false; - } - } - - for (const FString& SafetyRuleId : SafetyRuleIds) - { - if (SafetyRuleId.IsEmpty()) - { - return false; - } - } - - return true; - } + bool IsStructurallyValid() const; }; USTRUCT(BlueprintType) @@ -1675,82 +1544,7 @@ struct FHyperTwistSkillCleanRoomCommandContractState UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist") FString Summary; - bool IsStructurallyValid() const - { - if (RegistryId.IsEmpty() - || ManifestVersion.IsEmpty() - || ReferenceUtc.IsEmpty() - || CommandSurfaceRootId.IsEmpty() - || TemplateVersion.IsEmpty() - || Specs.Num() == 0 - || SkillCount <= 0 - || SpecCount != Specs.Num() - || SafetyRuleCount <= 0 - || !bEverySpecUsesFirstPartyTerms - || !bEverySpecAvoidsDonorWording - || !bEverySpecPreservesOptionalAssistiveOffState - || !bEverySpecRestrictsToDerivedAssistiveOutput - || !bEverySpecRequiresProvenanceLedger - || !bEverySpecAvoidsProductTruthMutation - || !bEverySpecMayBindFutureWrapperWithoutContractRewrite - || !bEverySpecHasAuthoringHarnessCoverage - || !bEverySpecDefersEvalUntilCleanRoomSkillSpec) - { - return false; - } - - TArray SeenSpecIds; - TArray SeenSkillIds; - TArray SeenSafetyRuleIds; - bool bComputedFirstPartyTerms = true; - bool bComputedAvoidsDonorWording = true; - bool bComputedPreservesOffState = true; - bool bComputedDerivedAssistiveOnly = true; - bool bComputedRequiresProvenanceLedger = true; - bool bComputedAvoidsProductTruthMutation = true; - bool bComputedMayBindWithoutRewrite = true; - bool bComputedHasHarnessCoverage = true; - bool bComputedDefersEvalUntilSkillSpec = true; - - for (const FHyperTwistSkillCleanRoomCommandContractSpec& Spec : Specs) - { - if (!Spec.IsStructurallyValid() || SeenSpecIds.Contains(Spec.SpecId)) - { - return false; - } - - SeenSpecIds.Add(Spec.SpecId); - SeenSkillIds.AddUnique(Spec.SkillId); - bComputedFirstPartyTerms &= Spec.bUsesFirstPartyTermsOnly; - bComputedAvoidsDonorWording &= Spec.bAvoidsDonorWording; - bComputedPreservesOffState &= Spec.bPreservesOptionalAssistiveOffState; - bComputedDerivedAssistiveOnly &= Spec.bDerivedAssistiveOnly; - bComputedRequiresProvenanceLedger &= Spec.bRequiresProvenanceLedger; - bComputedAvoidsProductTruthMutation &= Spec.bNoProductTruthMutation; - bComputedMayBindWithoutRewrite &= Spec.bFutureWrapperMayBindWithoutContractRewrite; - bComputedHasHarnessCoverage &= Spec.RequiredTemplateSectionIds.Num() > 0; - bComputedDefersEvalUntilSkillSpec &= - Spec.EvalExecutionMode - == EHyperTwistSkillValidationExecutionMode::DeferredUntilCleanRoomSkillSpec; - - for (const FString& SafetyRuleId : Spec.SafetyRuleIds) - { - SeenSafetyRuleIds.AddUnique(SafetyRuleId); - } - } - - return SkillCount == SeenSkillIds.Num() - && SafetyRuleCount == SeenSafetyRuleIds.Num() - && bEverySpecUsesFirstPartyTerms == bComputedFirstPartyTerms - && bEverySpecAvoidsDonorWording == bComputedAvoidsDonorWording - && bEverySpecPreservesOptionalAssistiveOffState == bComputedPreservesOffState - && bEverySpecRestrictsToDerivedAssistiveOutput == bComputedDerivedAssistiveOnly - && bEverySpecRequiresProvenanceLedger == bComputedRequiresProvenanceLedger - && bEverySpecAvoidsProductTruthMutation == bComputedAvoidsProductTruthMutation - && bEverySpecMayBindFutureWrapperWithoutContractRewrite == bComputedMayBindWithoutRewrite - && bEverySpecHasAuthoringHarnessCoverage == bComputedHasHarnessCoverage - && bEverySpecDefersEvalUntilCleanRoomSkillSpec == bComputedDefersEvalUntilSkillSpec; - } + bool IsStructurallyValid() const; }; USTRUCT(BlueprintType) @@ -1832,77 +1626,7 @@ struct FHyperTwistSkillCleanRoomSkillSpec UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist") FString Summary; - bool IsStructurallyValid() const - { - if (SkillSpecId.IsEmpty() - || SkillId.IsEmpty() - || DisplayLabel.IsEmpty() - || CommandContractSpecId.IsEmpty() - || CommandSurfaceId.IsEmpty() - || ServiceBindingId.IsEmpty() - || OwnerLaneId.IsEmpty() - || OwnerFeatureId.IsEmpty() - || InputStateKinds.Num() == 0 - || OutputArtifactKinds.Num() == 0 - || SpecStepIds.Num() == 0 - || SafetyRuleIds.Num() == 0 - || RequiredTemplateSectionIds.Num() == 0 - || SmokeExecutionMode != EHyperTwistSkillValidationExecutionMode::DeclarationOnly - || EvalExecutionMode != EHyperTwistSkillValidationExecutionMode::DeclarationOnly - || !bUsesFirstPartyTermsOnly - || !bAvoidsDonorWording - || !bSpecReadyForFutureImplementation - || !bNotLiveImplementationYet - || !bPreservesOptionalAssistiveOffState - || !bDerivedAssistiveOnly - || !bRequiresProvenanceLedger - || !bNoProductTruthMutation) - { - return false; - } - - for (const FString& Value : InputStateKinds) - { - if (Value.IsEmpty()) - { - return false; - } - } - - for (const FString& Value : OutputArtifactKinds) - { - if (Value.IsEmpty()) - { - return false; - } - } - - for (const FString& Value : SpecStepIds) - { - if (Value.IsEmpty()) - { - return false; - } - } - - for (const FString& Value : SafetyRuleIds) - { - if (Value.IsEmpty()) - { - return false; - } - } - - for (const FString& Value : RequiredTemplateSectionIds) - { - if (Value.IsEmpty()) - { - return false; - } - } - - return true; - } + bool IsStructurallyValid() const; }; USTRUCT(BlueprintType) @@ -1976,98 +1700,7 @@ struct FHyperTwistSkillCleanRoomSkillSpecState UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist") FString Summary; - bool IsStructurallyValid() const - { - if (RegistryId.IsEmpty() - || ManifestVersion.IsEmpty() - || ReferenceUtc.IsEmpty() - || CommandSurfaceRootId.IsEmpty() - || TemplateVersion.IsEmpty() - || Specs.Num() == 0 - || SkillCount <= 0 - || SpecCount != Specs.Num() - || StepCount <= 0 - || SafetyRuleCount <= 0 - || !bEverySpecUsesFirstPartyTerms - || !bEverySpecAvoidsDonorWording - || !bEverySpecBindsToCommandContractState - || !bEverySpecReadyForFutureImplementation - || !bNoSpecClaimsLiveImplementation - || !bEverySpecPreservesOptionalAssistiveOffState - || !bEverySpecRestrictsToDerivedAssistiveOutput - || !bEverySpecRequiresProvenanceLedger - || !bEverySpecAvoidsProductTruthMutation - || !bEverySpecHasAuthoringHarnessCoverage - || !bEverySpecUsesDeclarationOnlyValidation) - { - return false; - } - - TArray SeenSpecIds; - TArray SeenSkillIds; - TArray SeenStepIds; - TArray SeenSafetyRuleIds; - bool bComputedFirstPartyTerms = true; - bool bComputedAvoidsDonorWording = true; - bool bComputedBindsToCommandContractState = true; - bool bComputedReadyForFutureImplementation = true; - bool bComputedNoLiveImplementation = true; - bool bComputedPreservesOffState = true; - bool bComputedDerivedAssistiveOnly = true; - bool bComputedRequiresProvenanceLedger = true; - bool bComputedAvoidsProductTruthMutation = true; - bool bComputedHasHarnessCoverage = true; - bool bComputedUsesDeclarationOnlyValidation = true; - - for (const FHyperTwistSkillCleanRoomSkillSpec& Spec : Specs) - { - if (!Spec.IsStructurallyValid() || SeenSpecIds.Contains(Spec.SkillSpecId)) - { - return false; - } - - SeenSpecIds.Add(Spec.SkillSpecId); - SeenSkillIds.AddUnique(Spec.SkillId); - bComputedFirstPartyTerms &= Spec.bUsesFirstPartyTermsOnly; - bComputedAvoidsDonorWording &= Spec.bAvoidsDonorWording; - bComputedBindsToCommandContractState &= !Spec.CommandContractSpecId.IsEmpty(); - bComputedReadyForFutureImplementation &= Spec.bSpecReadyForFutureImplementation; - bComputedNoLiveImplementation &= Spec.bNotLiveImplementationYet; - bComputedPreservesOffState &= Spec.bPreservesOptionalAssistiveOffState; - bComputedDerivedAssistiveOnly &= Spec.bDerivedAssistiveOnly; - bComputedRequiresProvenanceLedger &= Spec.bRequiresProvenanceLedger; - bComputedAvoidsProductTruthMutation &= Spec.bNoProductTruthMutation; - bComputedHasHarnessCoverage &= Spec.RequiredTemplateSectionIds.Num() > 0; - bComputedUsesDeclarationOnlyValidation &= - Spec.SmokeExecutionMode == EHyperTwistSkillValidationExecutionMode::DeclarationOnly - && Spec.EvalExecutionMode == EHyperTwistSkillValidationExecutionMode::DeclarationOnly; - - for (const FString& StepId : Spec.SpecStepIds) - { - SeenStepIds.AddUnique(StepId); - } - - for (const FString& SafetyRuleId : Spec.SafetyRuleIds) - { - SeenSafetyRuleIds.AddUnique(SafetyRuleId); - } - } - - return SkillCount == SeenSkillIds.Num() - && StepCount == SeenStepIds.Num() - && SafetyRuleCount == SeenSafetyRuleIds.Num() - && bEverySpecUsesFirstPartyTerms == bComputedFirstPartyTerms - && bEverySpecAvoidsDonorWording == bComputedAvoidsDonorWording - && bEverySpecBindsToCommandContractState == bComputedBindsToCommandContractState - && bEverySpecReadyForFutureImplementation == bComputedReadyForFutureImplementation - && bNoSpecClaimsLiveImplementation == bComputedNoLiveImplementation - && bEverySpecPreservesOptionalAssistiveOffState == bComputedPreservesOffState - && bEverySpecRestrictsToDerivedAssistiveOutput == bComputedDerivedAssistiveOnly - && bEverySpecRequiresProvenanceLedger == bComputedRequiresProvenanceLedger - && bEverySpecAvoidsProductTruthMutation == bComputedAvoidsProductTruthMutation - && bEverySpecHasAuthoringHarnessCoverage == bComputedHasHarnessCoverage - && bEverySpecUsesDeclarationOnlyValidation == bComputedUsesDeclarationOnlyValidation; - } + bool IsStructurallyValid() const; }; USTRUCT(BlueprintType) @@ -2138,73 +1771,7 @@ struct FHyperTwistSkillContinuityResumeSkill UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist") FString Summary; - bool IsStructurallyValid() const - { - if (SkillId.IsEmpty() - || DisplayLabel.IsEmpty() - || CommandSurfaceId.IsEmpty() - || ServiceBindingId.IsEmpty() - || OwnerLaneId.IsEmpty() - || OwnerFeatureId.IsEmpty() - || Status == EHyperTwistSkillStatus::None - || PermissionScopeIds.Num() == 0 - || InputStateKinds.Num() == 0 - || OutputArtifactKinds.Num() == 0 - || PreviewHeadlines.Num() == 0 - || AvailableItemCount < 0 - || BlockingItemCount < 0 - || !bReadsAuthoritativeStores - || !bPreservesOptionalAssistiveOffState - || !bDerivedAssistiveOnly - || !bHasValidationHarnessCoverage) - { - return false; - } - - for (const FString& Value : PermissionScopeIds) - { - if (Value.IsEmpty()) - { - return false; - } - } - - for (const FString& Value : InputStateKinds) - { - if (Value.IsEmpty()) - { - return false; - } - } - - for (const FString& Value : OutputArtifactKinds) - { - if (Value.IsEmpty()) - { - return false; - } - } - - for (const FString& Value : PreviewHeadlines) - { - if (Value.IsEmpty()) - { - return false; - } - } - - if (Status == EHyperTwistSkillStatus::ImplementedNow) - { - return bLiveSkill && bAvailableNow && !bRequiresOwnerActivation; - } - - if (Status == EHyperTwistSkillStatus::CommandContractPending) - { - return !bLiveSkill && !bAvailableNow && bRequiresOwnerActivation; - } - - return false; - } + bool IsStructurallyValid() const; }; USTRUCT(BlueprintType) @@ -2266,85 +1833,7 @@ struct FHyperTwistSkillContinuityResumeState UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist") FString Summary; - bool IsStructurallyValid() const - { - if (RegistryId.IsEmpty() - || ManifestVersion.IsEmpty() - || ReferenceUtc.IsEmpty() - || CommandSurfaceRootId.IsEmpty() - || TemplateVersion.IsEmpty() - || Skills.Num() == 0 - || SkillCount != Skills.Num() - || !bEveryLiveSkillReadsAuthoritativeStores - || !bEverySkillPreservesOptionalAssistiveOffState - || !bEveryLiveSkillHasValidationHarnessCoverage - || !bNoSkillClaimsActiveUserNoteCaptureWithoutOwnerActivation) - { - return false; - } - - TArray SeenSkillIds; - int32 ComputedLiveSkillCount = 0; - int32 ComputedAvailableNowCount = 0; - int32 ComputedPendingSkillCount = 0; - int32 ComputedResumeSessionSkillCount = 0; - int32 ComputedSearchHistorySkillCount = 0; - int32 ComputedCaptureNoteSkillCount = 0; - bool bComputedEveryLiveSkillReadsAuthoritativeStores = true; - bool bComputedEverySkillPreservesOptionalAssistiveOffState = true; - bool bComputedEveryLiveSkillHasValidationHarnessCoverage = true; - bool bComputedCaptureNoteGuard = false; - - for (const FHyperTwistSkillContinuityResumeSkill& Skill : Skills) - { - if (!Skill.IsStructurallyValid() || SeenSkillIds.Contains(Skill.SkillId)) - { - return false; - } - - SeenSkillIds.Add(Skill.SkillId); - ComputedLiveSkillCount += Skill.bLiveSkill ? 1 : 0; - ComputedAvailableNowCount += Skill.bAvailableNow ? 1 : 0; - ComputedPendingSkillCount += - Skill.Status == EHyperTwistSkillStatus::CommandContractPending ? 1 : 0; - ComputedResumeSessionSkillCount += - Skill.SkillId == TEXT("skill/resume-session") ? 1 : 0; - ComputedSearchHistorySkillCount += - Skill.SkillId == TEXT("skill/search-history") ? 1 : 0; - ComputedCaptureNoteSkillCount += - Skill.SkillId == TEXT("skill/capture-note") ? 1 : 0; - bComputedEverySkillPreservesOptionalAssistiveOffState &= - Skill.bPreservesOptionalAssistiveOffState; - - if (Skill.bLiveSkill) - { - bComputedEveryLiveSkillReadsAuthoritativeStores &= Skill.bReadsAuthoritativeStores; - bComputedEveryLiveSkillHasValidationHarnessCoverage &= - Skill.bHasValidationHarnessCoverage; - } - - if (Skill.SkillId == TEXT("skill/capture-note")) - { - bComputedCaptureNoteGuard = - !Skill.bLiveSkill && !Skill.bAvailableNow && Skill.bRequiresOwnerActivation; - } - } - - return LiveSkillCount == ComputedLiveSkillCount - && AvailableNowCount == ComputedAvailableNowCount - && PendingSkillCount == ComputedPendingSkillCount - && ResumeSessionSkillCount == ComputedResumeSessionSkillCount - && SearchHistorySkillCount == ComputedSearchHistorySkillCount - && CaptureNoteSkillCount == ComputedCaptureNoteSkillCount - && bEveryLiveSkillReadsAuthoritativeStores - == bComputedEveryLiveSkillReadsAuthoritativeStores - && bEverySkillPreservesOptionalAssistiveOffState - == bComputedEverySkillPreservesOptionalAssistiveOffState - && bEveryLiveSkillHasValidationHarnessCoverage - == bComputedEveryLiveSkillHasValidationHarnessCoverage - && bNoSkillClaimsActiveUserNoteCaptureWithoutOwnerActivation - == bComputedCaptureNoteGuard; - } + bool IsStructurallyValid() const; }; USTRUCT(BlueprintType) diff --git a/docs/ops/HYPERTWIST_REFACTORING_TOOLCHAIN_2026-06-22.md b/docs/ops/HYPERTWIST_REFACTORING_TOOLCHAIN_2026-06-22.md index 9cd5f3c..1e8c643 100644 --- a/docs/ops/HYPERTWIST_REFACTORING_TOOLCHAIN_2026-06-22.md +++ b/docs/ops/HYPERTWIST_REFACTORING_TOOLCHAIN_2026-06-22.md @@ -704,6 +704,51 @@ Latest public-manual hardening follow-up later on `2026-06-24`: - the remaining refactor pressure still appears concentrated in the older Unreal validator ownership seams documented above +Latest Unreal validator-ownership follow-up later on `2026-06-24`: + +- the next bounded Unreal refactor packet then targeted the actual remaining + large inline validator family in + `Public/HyperTwistSkills/HyperTwistSkillTypes.h` instead of the already + moved earlier seams +- the analyzer-wrapper, clean-room command-contract, clean-room skill-spec, + and continuity-resume `IsStructurallyValid()` ownership was moved out of the + public header and into + `Private/HyperTwistSkills/HyperTwistSkillTypes.cpp` +- the owned source-only structural gate improved again under that packet: + - `scripts/run-hypertwist-sentrux-source-only.sh` + - `Quality: 6169` + - all `7` checked rules passing +- a fresh inline-body scan on the public skill header then confirmed that the + top remaining inline validators had shifted away from that family; the + current largest inline bodies there are now: + - `FHyperTwistSkillWorkflowMemoryCaptureState` at `72` lines + - `FHyperTwistSkillRecallCompactViewState` at `70` lines + - `FHyperTwistSkillInvocationRecord` at `69` lines +- the touched Unreal skill files were then synced into the maintained Windows + validation root: + - `C:\HyperTwist_worktrees\phase10validate` + - `Public/HyperTwistSkills/HyperTwistSkillTypes.h` + - `Private/HyperTwistSkills/HyperTwistSkillTypes.cpp` +- the authoritative Windows Unreal build lane then rebuilt successfully on the + maintained validation root with: + - `Result: Succeeded` + - parallel executor time `399.92 seconds` + - total execution time `417.78 seconds` +- the same real build lane also compiled the directly affected skill contract + translation units in that run, including: + - `HyperTwistSkillPhaseS2APermissiveAnalyzerWrapperContractTest.cpp` + - `HyperTwistSkillPhaseS2BCleanRoomCommandContractSpecTest.cpp` + - `HyperTwistSkillPhaseS2CCleanRoomSkillSpecTest.cpp` + - `HyperTwistSkillPhaseS3AContinuityResumeContractTest.cpp` + - `HyperTwistSkillTypes.cpp` +- current highest-signal structural reading therefore tightened further: + - the owned browser/public/manual lane remains clean + - the previously inlined analyzer-wrapper and clean-room/continuity skill + validator family is no longer the main public-header pressure point + - the next Unreal refactor pressure is now more truthfully centered on the + later recall/workflow-memory skill validators and any remaining + recognition-side long validators + ## Out of scope This note does not: