Files
whetstone_DSL/editor/src/AnnotatedTaskitemValidator.h
Bill 03dc4dc208 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>
2026-03-02 10:21:06 -07:00

60 lines
1.7 KiB
C++

#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