Sprints 46-58 implement the cross-language porting foundation: language-to-IR adapters, equivalence checking, gate validation, legacy ingestion, managed/dynamic families, low-level/logic-actor semantics, debug workflow tooling, AST-native family tools, Rust/CPP raising tools, system-level orchestration, query family, and porting gates. Sprint 59 adds the governance layer (policy packs, review boards, waiver packets, ambiguity triage, decision ledger) with the whetstone_review_porting_decision MCP tool. Also includes: sprint plans 46-130, MCP taskitem pipeline scripts, CLAUDE.md, docs, and full test matrix (steps 689-828). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
39 lines
1.1 KiB
C++
39 lines
1.1 KiB
C++
#pragma once
|
|
// Step 713: error model mapping policy.
|
|
|
|
#include <string>
|
|
|
|
#include <nlohmann/json.hpp>
|
|
|
|
#include "SemanticCoreIR.h"
|
|
|
|
struct CppErrorModelDecision {
|
|
std::string profile;
|
|
std::string resultType; // expected, status_or, exceptions
|
|
bool panicTranslatedToTerminate = false;
|
|
};
|
|
|
|
class CppErrorModelMapping {
|
|
public:
|
|
static CppErrorModelDecision map(const SemanticCoreIR& ir,
|
|
const std::string& profile = "safe-first") {
|
|
CppErrorModelDecision d;
|
|
d.profile = profile;
|
|
if (profile == "interop-first") d.resultType = "status_or";
|
|
else if (profile == "perf-first") d.resultType = "expected";
|
|
else d.resultType = "expected";
|
|
|
|
const std::string dump = ir.contracts.dump();
|
|
d.panicTranslatedToTerminate = dump.find("panic") != std::string::npos;
|
|
return d;
|
|
}
|
|
|
|
static nlohmann::json toJson(const CppErrorModelDecision& d) {
|
|
return {
|
|
{"profile", d.profile},
|
|
{"resultType", d.resultType},
|
|
{"panicTranslatedToTerminate", d.panicTranslatedToTerminate}
|
|
};
|
|
}
|
|
};
|