Files
whetstone_DSL/editor/src/graduation/BlastRadiusAnalyzer.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

48 lines
1.6 KiB
C++

#pragma once
// Step 843: Blast-radius analyzer by feature family.
#include <string>
#include <vector>
#include <nlohmann/json.hpp>
struct BlastRadiusEntry {
std::string featureFamily;
std::vector<std::string> affectedPairs;
int impactScore = 0;
};
struct BlastRadiusReport {
std::string triggerFeature;
std::vector<BlastRadiusEntry> entries;
int totalAffectedPairs = 0;
std::string riskLevel;
};
class BlastRadiusAnalyzer {
public:
static BlastRadiusReport analyze(const std::string& triggerFeature,
const std::vector<BlastRadiusEntry>& entries) {
BlastRadiusReport r;
r.triggerFeature = triggerFeature;
r.entries = entries;
for (const auto& e : entries)
r.totalAffectedPairs += static_cast<int>(e.affectedPairs.size());
if (r.totalAffectedPairs == 0) r.riskLevel = "none";
else if (r.totalAffectedPairs < 3) r.riskLevel = "low";
else if (r.totalAffectedPairs < 8) r.riskLevel = "medium";
else r.riskLevel = "high";
return r;
}
static nlohmann::json toJson(const BlastRadiusReport& r) {
nlohmann::json arr = nlohmann::json::array();
for (const auto& e : r.entries) {
nlohmann::json pairs = nlohmann::json::array();
for (const auto& p : e.affectedPairs) pairs.push_back(p);
arr.push_back({{"family", e.featureFamily}, {"pairs", pairs},
{"impact", e.impactScore}});
}
return {{"trigger", r.triggerFeature}, {"total_affected", r.totalAffectedPairs},
{"risk_level", r.riskLevel}, {"entries", arr}};
}
};