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

86 lines
2.3 KiB
C

#ifndef TOPIC_RUNTIME_H
#define TOPIC_RUNTIME_H
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#define TOPIC_EVENT_LIMIT 2000
#define TOPIC_COMPONENT_LIMIT 96
#define TOPIC_BATCH_LIMIT 16
#define TOPIC_QUEUE_LIMIT 32
#define TOPIC_ALLOCATION_LIMIT 2048
typedef enum {
EVENT_PUBLISH,
EVENT_FLUSH
} EventKind;
typedef struct {
EventKind kind;
char device[TOPIC_COMPONENT_LIMIT + 1];
char channel[TOPIC_COMPONENT_LIMIT + 1];
uint32_t sequence;
} TopicEvent;
typedef struct {
TopicEvent events[TOPIC_EVENT_LIMIT];
size_t count;
size_t batch;
size_t fail_at;
} TopicPlan;
typedef struct {
char *address;
size_t size;
unsigned long token;
int live;
} Allocation;
typedef struct {
char *address;
size_t length;
unsigned long token;
size_t ordinal;
} PendingDelivery;
typedef struct {
size_t attempts;
size_t allocated;
size_t allocation_failures;
size_t released;
size_t live_blocks;
size_t live_bytes;
size_t release_errors;
size_t enqueued;
size_t delivered;
size_t lifetime_errors;
size_t queue_errors;
} TopicAudit;
typedef struct {
Allocation allocations[TOPIC_ALLOCATION_LIMIT];
size_t allocation_count;
unsigned long next_token;
size_t fail_at;
PendingDelivery queue[TOPIC_QUEUE_LIMIT];
size_t queued;
TopicAudit audit;
FILE *output;
int first_delivery;
} TopicRuntime;
void topic_runtime_init(TopicRuntime *runtime, size_t fail_at, FILE *output);
int topic_format(TopicRuntime *runtime, char **output, const char *device,
const char *channel, uint32_t sequence);
int topic_release(TopicRuntime *runtime, char *address);
Allocation *topic_allocation(TopicRuntime *runtime, const char *address);
int topic_enqueue(TopicRuntime *runtime, char *address);
void topic_complete(TopicRuntime *runtime);
void topic_observer_open(TopicRuntime *runtime);
void topic_observer_close(TopicRuntime *runtime, int publisher_rc);
void topic_runtime_dispose(TopicRuntime *runtime);
int topic_read_plan(FILE *input, TopicPlan *plan, char *error, size_t capacity);
int topic_parse_options(int argc, char **argv, TopicPlan *plan,
const char **path, char *error, size_t capacity);
int publisher_run(TopicRuntime *runtime, const TopicPlan *plan);
#endif