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

63 lines
1.7 KiB
C++

#ifndef FINITE_STORE_HPP
#define FINITE_STORE_HPP
#include "resource_job.hpp"
#include <array>
#include <iosfwd>
#include <map>
#include <optional>
namespace resource {
struct CatalogEntry {
int key=0;
bool open_failure=false;
int read_failure=-1;
std::size_t chunk=1;
std::string bytes;
};
struct Event {
int kind;
int first;
int second;
};
struct StreamState {
int key;
bool borrowed;
bool live;
std::size_t cursor;
};
class FiniteStore final: public Provider {
public:
explicit FiniteStore(std::vector<CatalogEntry> entries);
int borrow(int key);
void expect_opens(int count);
int open(int key) override;
int read(int handle,char *output,std::size_t capacity) override;
void close(int handle) override;
std::size_t owned_live() const;
std::size_t borrowed_live() const;
void describe_live(std::ostream &out) const;
int early_reads() const;
int invalid_calls() const;
const std::vector<Event> &events() const;
const CatalogEntry *catalog(int key) const;
const StreamState *stream(int handle) const;
private:
int create_stream(int key,bool borrowed);
std::map<int,CatalogEntry> entries_;
std::map<int,StreamState> streams_;
std::vector<Event> events_;
int next_handle_=100;
int expected_opens_=0;
int attempted_opens_=0;
int early_reads_=0;
int invalid_calls_=0;
};
struct CaseInput {
std::vector<CatalogEntry> catalog;
std::vector<std::array<int,3>> sources;
};
bool read_case_count(std::istream &in,int &count);
bool read_case(std::istream &in,CaseInput &output);
void print_observation(std::ostream &out,const Result &result,const FiniteStore &store);
}
#endif