Implement sprint 92 interop models, tools, and tests

This commit is contained in:
Bill
2026-02-24 11:34:54 -07:00
parent f4f3633b11
commit aa5a45bb75
22 changed files with 1753 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
#pragma once
// Step 1152: Canonical fixture and oracle dataset packs.
#include <string>
#include <nlohmann/json.hpp>
struct CanonicalFixtureAndOracleDatasetPacks {
std::string packId;
int fixtureCount = 0;
int oracleCount = 0;
std::string version;
bool checksummed = false;
bool publishable = false;
};
class CanonicalFixtureAndOracleDatasetPacksFactory {
public:
static CanonicalFixtureAndOracleDatasetPacks make(const std::string& packId,
int fixtureCount,
int oracleCount,
const std::string& version,
bool checksummed) {
bool publishable = !packId.empty() && fixtureCount > 0 && oracleCount > 0 &&
!version.empty() && checksummed;
return {packId, fixtureCount, oracleCount, version, checksummed, publishable};
}
static nlohmann::json toJson(const CanonicalFixtureAndOracleDatasetPacks& p) {
return {{"pack_id", p.packId},
{"fixture_count", p.fixtureCount},
{"oracle_count", p.oracleCount},
{"version", p.version},
{"checksummed", p.checksummed},
{"publishable", p.publishable}};
}
};

View File

@@ -0,0 +1,34 @@
#pragma once
// Step 1153: Divergence triage model for interop failures.
#include <string>
#include <nlohmann/json.hpp>
struct DivergenceTriageModelForInteropFailures {
std::string triageId;
std::string failureClass;
std::string severity;
std::string recommendedAction;
bool requiresEscalation = false;
bool valid = false;
};
class DivergenceTriageModelForInteropFailuresFactory {
public:
static DivergenceTriageModelForInteropFailures make(const std::string& triageId,
const std::string& failureClass,
const std::string& severity,
const std::string& recommendedAction) {
bool requiresEscalation = severity == "critical" || severity == "high";
bool valid = !triageId.empty() && !failureClass.empty() && !severity.empty() && !recommendedAction.empty();
return {triageId, failureClass, severity, recommendedAction, requiresEscalation, valid};
}
static nlohmann::json toJson(const DivergenceTriageModelForInteropFailures& t) {
return {{"triage_id", t.triageId},
{"failure_class", t.failureClass},
{"severity", t.severity},
{"recommended_action", t.recommendedAction},
{"requires_escalation", t.requiresEscalation},
{"valid", t.valid}};
}
};

View File

@@ -0,0 +1,36 @@
#pragma once
// Step 1154: Interop certification policy bindings.
#include <string>
#include <nlohmann/json.hpp>
struct InteropCertificationPolicyBindings {
std::string policyId;
double minPassRate = 0.0;
bool requiresOracleMatch = false;
bool requiresDeterministicReplay = false;
bool bindingActive = false;
bool valid = false;
};
class InteropCertificationPolicyBindingsFactory {
public:
static InteropCertificationPolicyBindings make(const std::string& policyId,
double minPassRate,
bool requiresOracleMatch,
bool requiresDeterministicReplay,
bool bindingActive) {
bool validRate = minPassRate >= 0.0 && minPassRate <= 1.0;
bool valid = !policyId.empty() && validRate && bindingActive &&
requiresOracleMatch && requiresDeterministicReplay;
return {policyId, minPassRate, requiresOracleMatch, requiresDeterministicReplay, bindingActive, valid};
}
static nlohmann::json toJson(const InteropCertificationPolicyBindings& p) {
return {{"policy_id", p.policyId},
{"min_pass_rate", p.minPassRate},
{"requires_oracle_match", p.requiresOracleMatch},
{"requires_deterministic_replay", p.requiresDeterministicReplay},
{"binding_active", p.bindingActive},
{"valid", p.valid}};
}
};

View File

@@ -0,0 +1,36 @@
#pragma once
// Step 1157: Interop publication bundle.
#include <string>
#include <nlohmann/json.hpp>
struct InteropPublicationBundle {
std::string bundleId;
std::string manifestId;
std::string referenceHarnessId;
std::string conformanceReportId;
bool signedBundle = false;
std::string status;
};
class InteropPublicationBundleFactory {
public:
static InteropPublicationBundle make(const std::string& bundleId,
const std::string& manifestId,
const std::string& referenceHarnessId,
const std::string& conformanceReportId,
bool signedBundle) {
bool complete = !bundleId.empty() && !manifestId.empty() &&
!referenceHarnessId.empty() && !conformanceReportId.empty();
std::string status = complete && signedBundle ? "publishable" : "draft";
return {bundleId, manifestId, referenceHarnessId, conformanceReportId, signedBundle, status};
}
static nlohmann::json toJson(const InteropPublicationBundle& b) {
return {{"bundle_id", b.bundleId},
{"manifest_id", b.manifestId},
{"reference_harness_id", b.referenceHarnessId},
{"conformance_report_id", b.conformanceReportId},
{"signed_bundle", b.signedBundle},
{"status", b.status}};
}
};

View File

@@ -0,0 +1,36 @@
#pragma once
// Step 1149: Interop testbed manifest model.
#include <string>
#include <vector>
#include <nlohmann/json.hpp>
struct InteropTestbedManifestModel {
std::string manifestId;
std::string migrationClass;
std::vector<std::string> languages;
int testCaseCount = 0;
bool requiresReferenceImpl = false;
bool valid = false;
};
class InteropTestbedManifestModelFactory {
public:
static InteropTestbedManifestModel make(const std::string& manifestId,
const std::string& migrationClass,
const std::vector<std::string>& languages,
int testCaseCount,
bool requiresReferenceImpl) {
bool valid = !manifestId.empty() && !migrationClass.empty() &&
languages.size() >= 2 && testCaseCount > 0;
return {manifestId, migrationClass, languages, testCaseCount, requiresReferenceImpl, valid};
}
static nlohmann::json toJson(const InteropTestbedManifestModel& m) {
return {{"manifest_id", m.manifestId},
{"migration_class", m.migrationClass},
{"languages", m.languages},
{"test_case_count", m.testCaseCount},
{"requires_reference_impl", m.requiresReferenceImpl},
{"valid", m.valid}};
}
};

View File

@@ -0,0 +1,36 @@
#pragma once
// Step 1150: Reference implementation harness for IR/evidence specs.
#include <string>
#include <vector>
#include <nlohmann/json.hpp>
struct ReferenceImplementationHarnessForIREvidenceSpecs {
std::string harnessId;
std::string irSpecVersion;
std::string evidenceSpecVersion;
std::vector<std::string> supportedLanguages;
bool deterministicReplay = false;
bool ready = false;
};
class ReferenceImplementationHarnessForIREvidenceSpecsFactory {
public:
static ReferenceImplementationHarnessForIREvidenceSpecs make(const std::string& harnessId,
const std::string& irSpecVersion,
const std::string& evidenceSpecVersion,
const std::vector<std::string>& supportedLanguages,
bool deterministicReplay) {
bool ready = !harnessId.empty() && !irSpecVersion.empty() && !evidenceSpecVersion.empty() &&
!supportedLanguages.empty() && deterministicReplay;
return {harnessId, irSpecVersion, evidenceSpecVersion, supportedLanguages, deterministicReplay, ready};
}
static nlohmann::json toJson(const ReferenceImplementationHarnessForIREvidenceSpecs& h) {
return {{"harness_id", h.harnessId},
{"ir_spec_version", h.irSpecVersion},
{"evidence_spec_version", h.evidenceSpecVersion},
{"supported_languages", h.supportedLanguages},
{"deterministic_replay", h.deterministicReplay},
{"ready", h.ready}};
}
};

View File

@@ -0,0 +1,37 @@
#pragma once
// Step 1151: Third-party conformance replay runner.
#include <string>
#include <nlohmann/json.hpp>
struct ThirdPartyConformanceReplayRunner {
std::string runId;
std::string vendorId;
int scenarioCount = 0;
int passedCount = 0;
double passRate = 0.0;
bool conformant = false;
};
class ThirdPartyConformanceReplayRunnerFactory {
public:
static ThirdPartyConformanceReplayRunner make(const std::string& runId,
const std::string& vendorId,
int scenarioCount,
int passedCount) {
int safeScenarios = scenarioCount < 0 ? 0 : scenarioCount;
int safePassed = passedCount < 0 ? 0 : passedCount;
if (safePassed > safeScenarios) safePassed = safeScenarios;
double passRate = safeScenarios == 0 ? 0.0 : static_cast<double>(safePassed) / safeScenarios;
bool conformant = safeScenarios > 0 && passRate >= 0.90;
return {runId, vendorId, safeScenarios, safePassed, passRate, conformant};
}
static nlohmann::json toJson(const ThirdPartyConformanceReplayRunner& r) {
return {{"run_id", r.runId},
{"vendor_id", r.vendorId},
{"scenario_count", r.scenarioCount},
{"passed_count", r.passedCount},
{"pass_rate", r.passRate},
{"conformant", r.conformant}};
}
};