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

106 lines
2.4 KiB
C++

#ifndef STATION_LIFECYCLE_HPP
#define STATION_LIFECYCLE_HPP
#include <array>
#include <cstdint>
#include <map>
#include <memory>
#include <vector>
namespace station {
struct Ticket {
int id;
int owner;
int kind;
int index;
int enabled;
};
struct Event {
int serial;
int code;
int ticket;
int owner;
int kind;
int index;
int value;
};
struct View {
int owner;
int state;
int subscriptions;
int device;
int shutdown_calls;
int cleanup_calls;
std::vector<int> tickets;
};
class Port {
public:
Port();
int acquire(int owner, int kind, int index);
int release(int ticket);
int enable(int ticket, bool enabled);
int publish(int owner, int index, int payload);
void terminal(int owner, int prior_state);
int inject_failure(int attempt);
int statistics(int owner, std::vector<int>& result) const;
int history(int owner, int after, std::vector<Event>& result) const;
int attempts() const;
int next_ticket() const;
int serial() const;
int deliveries() const;
std::vector<Ticket> entries() const;
const std::vector<Event>& events() const;
private:
void record(int code, int ticket, int owner, int kind, int index, int value);
std::vector<Ticket> entries_;
std::vector<Event> events_;
int attempts_;
int next_;
int serial_;
int deliveries_;
int failure_;
};
class Node {
public:
Node(Port& port, int owner, int subscriptions);
int configure();
int activate();
int deactivate();
int cleanup();
int shutdown();
int owner() const;
View view() const;
private:
void release_subscriptions();
void release_device();
void disable_subscriptions();
void terminal_callback();
Port& port_;
int owner_;
int subscriptions_;
int state_;
int device_;
int shutdown_calls_;
int cleanup_calls_;
std::vector<int> tickets_;
};
class Station {
public:
explicit Station(Port& port);
int create(int slot, int owner, int subscriptions);
int configure(int slot);
int activate(int slot);
int deactivate(int slot);
int cleanup(int slot);
int shutdown(int slot);
int stop(int slot);
int inspect(int slot, View& view) const;
private:
bool valid_slot(int slot) const;
int locate(int slot) const;
Port& port_;
std::array<std::unique_ptr<Node>, 8> nodes_;
};
}
#endif