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

83 lines
2.0 KiB
C

#ifndef BATCH_H
#define BATCH_H
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#define BF_CHANNELS 8u
#define BF_CAPACITY 64u
#define BF_MAX_BATCH 1000000u
#define BF_MIN_VALUE (-1000000)
#define BF_MAX_VALUE 1000000
#define BF_MAX_WEIGHT 1000u
#define BF_LINE_SIZE 1024u
typedef enum {
BF_OK = 0,
BF_STATE = 1,
BF_RANGE = 2,
BF_FULL = 3
} bf_result;
typedef struct {
uint32_t channel;
int32_t value;
uint32_t weight;
uint32_t filtered;
} bf_row;
typedef struct {
uint64_t rows;
uint64_t units;
int64_t weighted_total;
int32_t minimum;
int32_t maximum;
} bf_bucket;
typedef struct {
bf_bucket channels[BF_CHANNELS];
uint64_t accepted;
uint64_t ignored;
uint32_t batches;
uint32_t last_batch;
} bf_totals;
typedef struct {
bf_totals committed;
bf_row staged[BF_CAPACITY];
size_t staged_count;
uint32_t active_batch;
int active;
} bf_ledger;
typedef struct {
bf_totals totals;
size_t staged_count;
uint32_t active_batch;
int active;
} bf_view;
typedef enum {
BF_CMD_BEGIN,
BF_CMD_ADD,
BF_CMD_COMMIT,
BF_CMD_CANCEL,
BF_CMD_SNAPSHOT,
BF_CMD_INVALID
} bf_opcode;
typedef struct {
bf_opcode opcode;
uint32_t batch;
bf_row row;
} bf_command;
typedef enum {
BF_PARSE_OK,
BF_PARSE_EMPTY,
BF_PARSE_INVALID
} bf_parse_result;
void bf_init(bf_ledger *ledger);
bf_result bf_begin(bf_ledger *ledger, uint32_t batch);
bf_result bf_add(bf_ledger *ledger, bf_row row);
bf_result bf_commit(bf_ledger *ledger);
bf_result bf_cancel(bf_ledger *ledger);
void bf_snapshot(const bf_ledger *ledger, bf_view *view);
bf_parse_result bf_parse_line(const char *line, bf_command *command);
int bf_read_line(FILE *stream, char *line, size_t capacity);
const char *bf_operation_name(bf_opcode opcode);
void bf_print_result(FILE *stream, size_t ordinal, bf_opcode opcode, bf_result result);
void bf_print_view(FILE *stream, size_t ordinal, const bf_view *view);
int bf_execute(FILE *input, FILE *output, FILE *diagnostic);
#endif