One user-space repair task per eligible HWE debug-diag / compile-deploy base ID: 320 admitted (C 218, C++ 97, build scripts 5), 1 skipped by the content filter. Each ships a public spec with a check-to-basis table, at least two defects with single-fix fixtures, a symptom-masking fixture and an alternative correct implementation. Claude re-checked all 320: structure, the HWE quality items and trace6 Docker calibration receipts against current digests (320/320 USABLE). Difficulty is unmeasured. Known follow-up: 212 tasks use 120 ad-hoc family names; the next batch maps them to the canonical list. The batch's 1,256-line progress log stays in its factory report and the 36-local branch batch15-hwe. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
61 lines
2.5 KiB
C++
61 lines
2.5 KiB
C++
#include "ratio.hpp"
|
|
#include <istream>
|
|
#include <ostream>
|
|
namespace ratio {
|
|
void print_configuration(std::ostream& output, char kind, int slot, const Configuration& value) {
|
|
output << kind << ' ' << slot << ' ' << static_cast<int>(value.result)
|
|
<< ' ' << value.generation << '\n';
|
|
}
|
|
void print_feed(std::ostream& output, int slot, const Feed& value) {
|
|
output << 'F' << ' ' << slot << ' ' << static_cast<int>(value.result)
|
|
<< ' ' << value.mapped << ' ' << value.weight << '\n';
|
|
}
|
|
void print_snapshot(std::ostream& output, int slot, const Snapshot& value) {
|
|
const Statistics& stats = value.stats;
|
|
output << 'S' << ' ' << slot << ' ' << static_cast<int>(value.result)
|
|
<< ' ' << value.generation << ' ' << stats.samples << ' ' << stats.weight
|
|
<< ' ' << stats.raw_total << ' ' << stats.mapped_total
|
|
<< ' ' << stats.raw_mean() << ' ' << stats.mapped_mean()
|
|
<< ' ' << stats.minimum << ' ' << stats.maximum << ' ' << stats.clipped << '\n';
|
|
}
|
|
void print_totals(std::ostream& output, const Totals& value) {
|
|
output << 'T' << ' ' << value.configured << ' ' << value.stats.samples
|
|
<< ' ' << value.stats.weight << ' ' << value.stats.raw_total
|
|
<< ' ' << value.stats.mapped_total << ' ' << value.stats.clipped << '\n';
|
|
}
|
|
int run(std::istream& input, std::ostream& output) {
|
|
Ledger ledger;
|
|
Parser parser;
|
|
std::string line;
|
|
while (std::getline(input, line)) {
|
|
const Command command = parser.parse(line);
|
|
switch (command.verb) {
|
|
case Verb::empty:
|
|
break;
|
|
case Verb::invalid:
|
|
output << "E 1\n";
|
|
break;
|
|
case Verb::configure:
|
|
print_configuration(output, 'C', command.slot, ledger.configure(command.slot, command.profile));
|
|
break;
|
|
case Verb::feed:
|
|
print_feed(output, command.slot, ledger.feed(command.slot, command.raw, command.weight));
|
|
break;
|
|
case Verb::snapshot:
|
|
print_snapshot(output, command.slot, ledger.snapshot(command.slot));
|
|
break;
|
|
case Verb::drop:
|
|
print_configuration(output, 'D', command.slot, ledger.drop(command.slot));
|
|
break;
|
|
case Verb::clear:
|
|
print_configuration(output, 'Z', command.slot, ledger.clear(command.slot));
|
|
break;
|
|
case Verb::totals:
|
|
print_totals(output, ledger.totals());
|
|
break;
|
|
}
|
|
}
|
|
return input.bad() || !output ? 2 : 0;
|
|
}
|
|
}
|