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>
53 lines
2.0 KiB
C++
53 lines
2.0 KiB
C++
#pragma once
|
|
// Step 1467: debugging metrics packet.
|
|
|
|
#include <string>
|
|
|
|
#include <nlohmann/json.hpp>
|
|
|
|
struct DebugMetricsPacket {
|
|
std::string sessionId;
|
|
int iterationsToGreen = 0;
|
|
int timeToGreenMs = 0;
|
|
int tokenCostPerFix = 0;
|
|
int symptomToRootCauseCompression = 0;
|
|
int patchAcceptanceRatePct = 0;
|
|
int regressionEscapeRatePct = 0;
|
|
};
|
|
|
|
class DebugMetricsModel {
|
|
public:
|
|
static DebugMetricsPacket compute(const std::string& sessionId,
|
|
int iterations,
|
|
int durationMs,
|
|
int tokenCost,
|
|
int symptomCount,
|
|
int rootCauseCount,
|
|
int acceptedPatches,
|
|
int proposedPatches,
|
|
int regressions,
|
|
int totalRuns) {
|
|
DebugMetricsPacket m;
|
|
m.sessionId = sessionId;
|
|
m.iterationsToGreen = iterations;
|
|
m.timeToGreenMs = durationMs;
|
|
m.tokenCostPerFix = tokenCost;
|
|
m.symptomToRootCauseCompression = (rootCauseCount == 0) ? 0 : (100 * symptomCount / rootCauseCount);
|
|
m.patchAcceptanceRatePct = (proposedPatches == 0) ? 0 : (100 * acceptedPatches / proposedPatches);
|
|
m.regressionEscapeRatePct = (totalRuns == 0) ? 0 : (100 * regressions / totalRuns);
|
|
return m;
|
|
}
|
|
|
|
static nlohmann::json toJson(const DebugMetricsPacket& m) {
|
|
return {
|
|
{"session_id", m.sessionId},
|
|
{"iterations_to_green", m.iterationsToGreen},
|
|
{"time_to_green_ms", m.timeToGreenMs},
|
|
{"token_cost_per_fix", m.tokenCostPerFix},
|
|
{"symptom_to_root_cause_compression", m.symptomToRootCauseCompression},
|
|
{"patch_acceptance_rate_pct", m.patchAcceptanceRatePct},
|
|
{"regression_escape_rate_pct", m.regressionEscapeRatePct}
|
|
};
|
|
}
|
|
};
|