#pragma once // Step 1975: AnnotatedTaskitemValidator // Validates enrichment of EnrichedExecutionContracts. // ValidationReport { passCount, failCount, errors (include taskDescription) }. // If enrichmentRequired=true, any unenriched contract is an error. // Also validates capabilityScore in [0,1] for enriched contracts. #include "EnrichedExecutionContract.h" #include #include namespace whetstone { struct ValidationReport { int passCount = 0; int failCount = 0; std::vector errors; bool allPassed() const { return failCount == 0; } }; class AnnotatedTaskitemValidator { public: ValidationReport validate( const std::vector& contracts, bool enrichmentRequired) const { ValidationReport report; for (const auto& c : contracts) { const std::string desc = c.taskDescription.empty() ? "(unnamed task)" : c.taskDescription; bool pass = true; // Check enrichment requirement if (enrichmentRequired && !c.isEnriched()) { report.errors.push_back("task not enriched: " + desc); pass = false; } // Validate fields on enriched contracts if (c.isEnriched()) { if (c.capabilityScore < 0.0f || c.capabilityScore > 1.0f) { report.errors.push_back( "capabilityScore out of range [0,1] for: " + desc); pass = false; } } if (pass) ++report.passCount; else ++report.failCount; } return report; } }; } // namespace whetstone