Batch 21 (20261027-A-bos-redo-21) rebuilt 40 of the 53 rejected Bos-qiao environments: hidden assertions that ran inside the candidate's process now run in a trusted parent that reads observations from a low-UID worker; gold bytes are unchanged. 9 were excluded for scope (ROS2, oversize, security core), 3 are blocked because the source requires an exec bit the platform does not freeze, 1 lacks requests/bs4 in trace6. Batch 18 (20261026-C-hwe-codegen-18) adds its last 34 of 134 tasks; the first 100 landed in 2f32624d. Claude reviewed 74/74 USABLE against current digests, canonical families, no ID or source overlap with main, plain public docs. Only the new task directories are taken; the stale pre-batch-20 copies of concur-release-capsule and resource-temp-link on the batch 21 branch and both branches' progress notes stay as main has them. Difficulty is unmeasured. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
65 lines
2.0 KiB
C++
65 lines
2.0 KiB
C++
#ifndef CANCEL_RUNTIME_HPP
|
|
#define CANCEL_RUNTIME_HPP
|
|
#include <cstdint>
|
|
#include <iosfwd>
|
|
#include <map>
|
|
#include <vector>
|
|
namespace cancelrt {
|
|
enum class Code { OK=0, RANGE=1, EXISTS=2, MISSING=3, BUSY=4 };
|
|
enum class Stop { NONE=0, DONE=1, YIELD=2, INTR=3 };
|
|
struct Reply {
|
|
Code code = Code::OK;
|
|
Stop stop = Stop::NONE;
|
|
int total = 0;
|
|
int done = 0;
|
|
int produced = 0;
|
|
int factor = 0;
|
|
int bias = 0;
|
|
int attempts = 0;
|
|
int releases = 0;
|
|
int active = 0;
|
|
std::int64_t sum = 0;
|
|
std::vector<std::int64_t> values;
|
|
std::vector<int> ids;
|
|
};
|
|
struct Job {
|
|
std::vector<std::int64_t> input;
|
|
std::vector<std::int64_t> output;
|
|
int factor = 1;
|
|
int bias = 0;
|
|
int attempts = 0;
|
|
int releases = 0;
|
|
bool active = false;
|
|
};
|
|
class Runtime {
|
|
public:
|
|
Reply create(std::int64_t id, std::int64_t total, std::int64_t seed);
|
|
Reply configure(std::int64_t id, std::int64_t factor, std::int64_t bias);
|
|
Reply write(std::int64_t id, std::int64_t offset, std::int64_t count, std::int64_t value);
|
|
Reply read(std::int64_t id, std::int64_t offset, std::int64_t count, std::int64_t view) const;
|
|
Reply inspect(std::int64_t id) const;
|
|
Reply run(std::int64_t id, std::int64_t budget, std::int64_t cancel_after);
|
|
Reply rewind(std::int64_t id);
|
|
Reply erase(std::int64_t id);
|
|
Reply list() const;
|
|
private:
|
|
enum class Kind { CREATE, CONFIGURE, WRITE, COMMIT, ACQUIRE, RELEASE, REWIND };
|
|
struct Event {
|
|
Kind kind;
|
|
std::int64_t a = 0;
|
|
std::int64_t b = 0;
|
|
std::int64_t c = 0;
|
|
};
|
|
using Journal = std::vector<Event>;
|
|
std::map<int, Journal> jobs_;
|
|
static Job replay(const Journal& journal);
|
|
static bool valid_id(std::int64_t id);
|
|
static bool bounded(std::int64_t value, std::int64_t lo, std::int64_t hi);
|
|
static Reply fail(Code code);
|
|
static Reply observe(const Job& job);
|
|
};
|
|
void print_reply(std::ostream& out, const Reply& reply);
|
|
int run_cli(std::istream& in, std::ostream& out, std::ostream& err);
|
|
}
|
|
#endif
|