Sprint 64: Cost-Aware Transpilation Planning — Steps 869-878
Adds cost modeling and budget enforcement for transpilation runs: - PortingCostModel: LOC + ambiguity → compute/review/total cost + tier (step 869) - ReviewEffortEstimator: ambiguity/risk → minutes + complexity label (step 870) - ComputeCostEstimator: prior run history → avg duration/tokens (step 871) - MultiPlanAlternativeGenerator: cheap/balanced/rigorous profiles (step 872) - BudgetPolicyEnforcer: approve/requires_token/rejected decisions (step 873) - CostQualityTradeoffReport: efficiency-based plan recommendation (step 874) - whetstone_plan_transpilation_run MCP tool (step 875) - whetstone_estimate_porting_cost MCP tool (step 876) - CostTelemetryIntegration: cost error tracking + over-budget count (step 877) - Sprint64IntegrationSummary (step 878) All 10 steps passing (94 tests). Policy: over-budget plans require explicit reviewer approval token. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
34
editor/src/graduation/PortingCostModel.h
Normal file
34
editor/src/graduation/PortingCostModel.h
Normal file
@@ -0,0 +1,34 @@
|
||||
#pragma once
|
||||
// Step 869: Porting cost model v1.
|
||||
#include <string>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
struct PortingCostEstimate {
|
||||
std::string pairId;
|
||||
float computeCost = 0.0f; // normalized 0-1
|
||||
float reviewCost = 0.0f; // normalized 0-1
|
||||
float totalCost = 0.0f;
|
||||
std::string tier; // "low", "medium", "high"
|
||||
};
|
||||
|
||||
class PortingCostModel {
|
||||
public:
|
||||
static PortingCostEstimate estimate(const std::string& pairId,
|
||||
int linesOfCode, float ambiguityScore) {
|
||||
PortingCostEstimate e;
|
||||
e.pairId = pairId;
|
||||
e.computeCost = std::min(1.0f, linesOfCode / 1000.0f);
|
||||
e.reviewCost = std::min(1.0f, ambiguityScore);
|
||||
e.totalCost = (e.computeCost + e.reviewCost) / 2.0f;
|
||||
if (e.totalCost < 0.33f) e.tier = "low";
|
||||
else if (e.totalCost < 0.66f) e.tier = "medium";
|
||||
else e.tier = "high";
|
||||
return e;
|
||||
}
|
||||
|
||||
static nlohmann::json toJson(const PortingCostEstimate& e) {
|
||||
return {{"pair_id", e.pairId}, {"compute_cost", e.computeCost},
|
||||
{"review_cost", e.reviewCost}, {"total_cost", e.totalCost},
|
||||
{"tier", e.tier}};
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user