amos 9d633e9e67 Batch 15 (20261023-C-hwe-scale-15): 320 HWE-derived repair tasks
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>
2026-10-27 01:55:56 +08:00

116 lines
3.6 KiB
C++

#include "cache_api.hpp"
#include <iostream>
#include <sstream>
#include <string>
using namespace readercache;
static void number(long long value) {
std::cout << ' ' << value;
}
static void observe(int status, long long value, long long version, Cache& cache, Pool& pool) {
std::cout << status;
number(value);
number(version);
auto counters = pool.counters();
for (long long count : counters) {
number(count);
}
auto views = cache.views();
number(static_cast<long long>(views.size()));
for (const auto& view : views) {
number(view.handle);
number(view.phase);
number(view.resource);
number(view.value);
number(view.version);
number(view.readers);
number(view.writer);
}
auto tickets = cache.tickets();
number(static_cast<long long>(tickets.size()));
for (const auto& ticket : tickets) {
number(ticket.ticket);
number(ticket.handle);
number(ticket.value);
number(ticket.version);
}
number(static_cast<long long>(pool.events().size()));
for (const auto& event : pool.events()) {
number(event.kind);
number(event.object);
number(event.argument);
}
std::cout << '\n';
}
static bool no_more(std::istringstream& input) {
std::string extra;
return !(input >> extra);
}
int main() {
Pool pool;
Cache cache(pool);
std::string line;
while (std::getline(std::cin, line)) {
pool.clear_events();
std::istringstream input(line);
std::string operation;
int handle = 0;
int ticket = 0;
long long argument = 0;
long long value = -777;
long long version = -888;
int status = 1;
if (line.find_first_of("\v\f") != std::string::npos) {
observe(status, value, version, cache, pool);
continue;
}
if (!(input >> operation)) {
observe(status, value, version, cache, pool);
continue;
}
if (operation == "C") {
if ((input >> handle >> argument) && no_more(input)) {
status = cache.create(handle, argument);
}
} else if (operation == "W") {
if ((input >> handle >> argument) && no_more(input)) {
status = cache.write(handle, argument);
}
} else if (operation == "B") {
if ((input >> handle >> ticket) && no_more(input)) {
status = cache.begin(handle, ticket, value, version);
}
} else if (operation == "E") {
if ((input >> ticket) && no_more(input)) {
status = cache.end(ticket);
}
} else if (operation == "X") {
if ((input >> handle) && no_more(input)) {
status = cache.close(handle);
}
} else if (operation == "S") {
if ((input >> handle) && no_more(input)) {
status = cache.start_write(handle);
}
} else if (operation == "K") {
if ((input >> handle >> argument) && no_more(input)) {
status = cache.commit(handle, argument);
}
} else if (operation == "A") {
if ((input >> handle) && no_more(input)) {
status = cache.abort(handle);
}
} else if (operation == "F") {
if (no_more(input)) {
pool.fail_next_initialization();
status = 0;
}
} else if (operation == "Q") {
if (no_more(input)) {
status = 0;
}
}
observe(status, value, version, cache, pool);
}
return 0;
}