Sprint 289: Integration into generate_taskitems (steps 1973-1977)
EnrichedExecutionContract, TaskitemLibraryAnnotator, AnnotatedTaskitemValidator, DispatchJustificationReport, Sprint289IntegrationSummary. 25/25 tests passing. Full pipeline: spec -> classifier -> selector -> advisor -> enriched contracts. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
59
editor/src/AnnotatedTaskitemValidator.h
Normal file
59
editor/src/AnnotatedTaskitemValidator.h
Normal file
@@ -0,0 +1,59 @@
|
||||
#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 <string>
|
||||
#include <vector>
|
||||
|
||||
namespace whetstone {
|
||||
|
||||
struct ValidationReport {
|
||||
int passCount = 0;
|
||||
int failCount = 0;
|
||||
std::vector<std::string> errors;
|
||||
|
||||
bool allPassed() const { return failCount == 0; }
|
||||
};
|
||||
|
||||
class AnnotatedTaskitemValidator {
|
||||
public:
|
||||
ValidationReport validate(
|
||||
const std::vector<EnrichedExecutionContract>& 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
|
||||
Reference in New Issue
Block a user