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

87 lines
2.4 KiB
C

#ifndef REVERSE_H
#define REVERSE_H
#include <stddef.h>
#include <stdint.h>
#define LOG_LIMIT 64
#define BANK_COUNT 8
#define CURSOR_SLOTS 2
#define STEP_DONE 0
#define STEP_BUDGET 1
#define STEP_OUTPUT 2
#define STEP_PORT 3
#define INVALID_ARGUMENT (-1)
typedef struct {
uint64_t sequence;
unsigned bank;
unsigned level;
int64_t value;
} Record;
typedef struct {
Record cells[LOG_LIMIT];
size_t capacity;
size_t count;
size_t head;
uint64_t next_sequence;
uint64_t overwritten;
} Journal;
typedef struct {
unsigned bank_mask;
unsigned minimum_level;
int64_t minimum_value;
int64_t maximum_value;
} Selection;
typedef struct {
uint64_t count;
int64_t sum;
int64_t minimum;
int64_t maximum;
uint64_t levels[4];
uint64_t banks[BANK_COUNT];
uint64_t fingerprint;
} Summary;
typedef struct {
Record snapshot[LOG_LIMIT];
size_t snapshot_count;
size_t low;
size_t high;
size_t next;
int initialized;
int done;
Selection selection;
uint64_t examined;
uint64_t emitted;
uint64_t invalid_reads;
size_t route[LOG_LIMIT];
size_t route_count;
size_t route_position;
} Cursor;
typedef struct {
int reason;
size_t scanned;
size_t emitted;
size_t port_calls;
Record rows[LOG_LIMIT];
} Batch;
typedef struct {
int initialized;
int done;
size_t snapshot_count;
uint64_t examined;
uint64_t emitted;
uint64_t invalid_reads;
} CursorInfo;
int journal_init(Journal *journal, size_t capacity);
int journal_append(Journal *journal, unsigned bank, unsigned level, int64_t value, uint64_t *sequence);
int journal_read(const Journal *journal, size_t ordinal, Record *record);
int journal_copy(const Journal *journal, Record *rows, size_t capacity, size_t *count);
int selection_valid(const Selection *selection);
int selection_accepts(const Selection *selection, const Record *record);
void summary_clear(Summary *summary);
void summary_add(Summary *summary, const Record *record);
int journal_summary(const Journal *journal, const Selection *selection, Summary *summary);
void cursor_clear(Cursor *cursor);
int cursor_open(Cursor *cursor, const Journal *journal, size_t low, size_t high, const Selection *selection);
int cursor_step(Cursor *cursor, size_t budget, size_t output_capacity, Batch *batch);
int cursor_info(const Cursor *cursor, CursorInfo *info);
#endif