Files
whetstone_DSL/editor/src/debug/SafetyEnvelopePolicy.h
Bill 1696b92bb8 Add Sprints 46-59: governance, porting foundation, and language graduation prep (Steps 689-828)
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>
2026-02-22 13:18:10 -07:00

38 lines
1.1 KiB
C++

#pragma once
// Step 1491: safety envelope policy.
#include <string>
#include <vector>
#include <nlohmann/json.hpp>
struct SafetyEnvelope {
int maxFailures = 3;
int maxRegressions = 1;
int maxTokensPerCampaign = 20000;
};
struct SafetyEnvelopeResult {
bool allowed = true;
std::vector<std::string> violations;
};
class SafetyEnvelopePolicy {
public:
static SafetyEnvelopeResult evaluate(const SafetyEnvelope& e,
int failures,
int regressions,
int tokenCost) {
SafetyEnvelopeResult r;
if (failures > e.maxFailures) r.violations.push_back("max_failures_exceeded");
if (regressions > e.maxRegressions) r.violations.push_back("max_regressions_exceeded");
if (tokenCost > e.maxTokensPerCampaign) r.violations.push_back("max_tokens_exceeded");
r.allowed = r.violations.empty();
return r;
}
static nlohmann::json toJson(const SafetyEnvelopeResult& r) {
return {{"allowed", r.allowed}, {"violations", r.violations}};
}
};