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>
44 lines
1.2 KiB
C++
44 lines
1.2 KiB
C++
#pragma once
|
|
// Step 1521: debug action validator model.
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include <nlohmann/json.hpp>
|
|
|
|
struct DebugActionValidation {
|
|
bool allowed = true;
|
|
std::vector<std::string> violations;
|
|
};
|
|
|
|
class DebugActionValidator {
|
|
public:
|
|
static DebugActionValidation validate(const std::string& action,
|
|
bool touchesForbiddenPath,
|
|
bool changesManyFiles,
|
|
bool bypassesTests) {
|
|
DebugActionValidation v;
|
|
if (action.empty()) {
|
|
v.allowed = false;
|
|
v.violations.push_back("action_empty");
|
|
}
|
|
if (touchesForbiddenPath) {
|
|
v.allowed = false;
|
|
v.violations.push_back("forbidden_path");
|
|
}
|
|
if (changesManyFiles) {
|
|
v.allowed = false;
|
|
v.violations.push_back("change_scope_exceeded");
|
|
}
|
|
if (bypassesTests) {
|
|
v.allowed = false;
|
|
v.violations.push_back("test_bypass_forbidden");
|
|
}
|
|
return v;
|
|
}
|
|
|
|
static nlohmann::json toJson(const DebugActionValidation& v) {
|
|
return {{"allowed", v.allowed}, {"violations", v.violations}};
|
|
}
|
|
};
|