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

57 lines
2.2 KiB
C

#include "json.h"
#include <stdio.h>
static int write_uint(FILE *stream, const char *key, unsigned long value, int last)
{
if (fprintf(stream, "\"%s\":%lu%s", key, value, last ? "" : ",") < 0) return -1;
return 0;
}
static int begin(FILE *stream, const char *kind)
{
if (fprintf(stream, "{\"kind\":\"%s\",", kind) < 0) return -1;
return 0;
}
static int end(FILE *stream)
{
if (fputs("}\n", stream) == EOF) return -1;
return 0;
}
int json_observation(FILE *stream, const Observation *out)
{
if (stream == NULL || out == NULL) return -1;
if (out->outcome > 1) return -1;
if (out->reads == 0 || out->reads > 256) return -1;
if (out->checkpoints + 1 != out->reads) return -1;
if (out->streak > out->reads) return -1;
if (begin(stream, "observation")) return -1;
if (write_uint(stream, "id", out->id, 0)) return -1;
if (write_uint(stream, "outcome", out->outcome, 0)) return -1;
if (write_uint(stream, "reads", out->reads, 0)) return -1;
if (write_uint(stream, "checkpoints", out->checkpoints, 0)) return -1;
if (write_uint(stream, "last", out->last, 0)) return -1;
if (write_uint(stream, "streak", out->streak, 1)) return -1;
return end(stream);
}
int json_summary(FILE *stream, const Stats *stats)
{
if (stream == NULL || stats == NULL) return -1;
if (stats->jobs == 0) return -1;
if (stats->ready + stats->exhausted != stats->jobs) return -1;
if (stats->total_checkpoints + stats->jobs != stats->total_reads) return -1;
if (begin(stream, "summary")) return -1;
if (write_uint(stream, "jobs", stats->jobs, 0)) return -1;
if (write_uint(stream, "ready", stats->ready, 0)) return -1;
if (write_uint(stream, "exhausted", stats->exhausted, 0)) return -1;
if (write_uint(stream, "total_reads", stats->total_reads, 0)) return -1;
if (write_uint(stream, "total_checkpoints", stats->total_checkpoints, 0)) return -1;
if (write_uint(stream, "max_reads", stats->max_reads, 0)) return -1;
if (write_uint(stream, "max_reads_id", stats->max_reads_id, 0)) return -1;
if (write_uint(stream, "p50_reads", stats_percentile(stats, 50), 0)) return -1;
if (write_uint(stream, "p90_reads", stats_percentile(stats, 90), 1)) return -1;
return end(stream);
}