amos f611da1e57 Batch 24: add 23 calibrated tasks written from Bos seed directions
Batch 24 (20261102-C-bos-seed-24) screened all 3078 Bos seed queries.
Only 23 themes were in scope (pure user-space reliability, at most one
task per theme); the rest were single operations or explanations,
installs and networking, system administration, ROS2, board-only or GUI
requests. Two finished drafts were withdrawn as too close to existing
tasks. Seeds supply direction only: all sources, contracts and tests are
new, and no task shares more than 14 characters with its seed text.

Each task passed the local gate and the trace6 Docker gate (5 runs per
sample class). Claude rebuilt the catalog from the calibration receipts:
23/23 USABLE. 16 of 23 are C/C++.

Only the task directories are taken; the batch worktree's lowered disk
floor in rollout/core.py stays out of main.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 17:21:50 +08:00

76 lines
1.9 KiB
C++

#include "clock.hpp"
#include <limits>
#include <sstream>
namespace shared_clock {
Engine::Engine() {
reset();
}
void Engine::reset() {
page_.reset();
policy_ = Policy{};
sequence_ = 0;
last_id_ = 0;
last_delay_ = 0;
}
Status Engine::configure(Policy policy) {
if (policy.max_delay > MAX_SPAN) {
return Status::Range;
}
policy_ = policy;
return Status::Ok;
}
Policy Engine::policy() const {
return policy_;
}
Status Engine::submit(const std::string& record, unsigned failpoint) {
Sample sample;
Status status = parse_record(record, sample);
if (status != Status::Ok) {
return status;
}
Estimate estimate;
status = evaluate(sample, policy_, estimate);
if (status != Status::Ok) {
return status;
}
if (sample.id <= last_id_) {
return Status::Rejected;
}
if (sequence_ == std::numeric_limits<std::uint64_t>::max()) {
return Status::Range;
}
Snapshot snapshot;
snapshot.sequence = sequence_ + 1;
snapshot.local = estimate.local;
snapshot.remote = estimate.remote;
snapshot.offset = estimate.offset;
snapshot.delay = estimate.delay;
snapshot.id = estimate.id;
status = page_.publish(snapshot, failpoint);
if (status != Status::Ok) {
return status;
}
sequence_ = snapshot.sequence;
last_id_ = sample.id;
last_delay_ = estimate.delay;
return Status::Ok;
}
Status Engine::latest(Snapshot& out) const {
return page_.read(out);
}
Status Engine::project(Tick now, Tick max_age, Projection& out) const {
return shared_clock::project(page_, now, max_age, out);
}
std::vector<std::uint8_t> Engine::page_bytes() const {
return page_.bytes();
}
std::string Engine::summary() const {
if (!sequence_) {
return "empty";
}
std::ostringstream text;
text << "id=" << last_id_ << ";sequence=" << sequence_ << ";delay=" << last_delay_;
return text.str();
}
}