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>
133 lines
3.3 KiB
C++
133 lines
3.3 KiB
C++
#include "internal.hpp"
|
|
namespace ag {
|
|
bool parent_valid(Number value)
|
|
{
|
|
return value >= 0 && value <= 3;
|
|
}
|
|
bool group_valid(Number value)
|
|
{
|
|
return value >= 0 && value <= 7;
|
|
}
|
|
bool name_valid(Number value)
|
|
{
|
|
return value >= 0 && value <= 15;
|
|
}
|
|
bool value_valid(Number value)
|
|
{
|
|
return value >= -100000 && value <= 100000;
|
|
}
|
|
bool bytes_valid(Number value)
|
|
{
|
|
return value >= 0 && value <= 64;
|
|
}
|
|
bool publication_valid(Number parent, Number group, Number first, Number count,
|
|
Number writable)
|
|
{
|
|
if (!parent_valid(parent)) {
|
|
return false;
|
|
}
|
|
if (!group_valid(group)) {
|
|
return false;
|
|
}
|
|
if (!name_valid(first)) {
|
|
return false;
|
|
}
|
|
if (count < 1 || count > 4) {
|
|
return false;
|
|
}
|
|
if (first > 16 - count) {
|
|
return false;
|
|
}
|
|
if (writable != 0 && writable != 1) {
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
Change change_error(Code code)
|
|
{
|
|
Change result;
|
|
result.code = code;
|
|
return result;
|
|
}
|
|
Reading reading_error(Code code)
|
|
{
|
|
Reading result;
|
|
result.code = code;
|
|
return result;
|
|
}
|
|
Writing writing_error(Code code)
|
|
{
|
|
Writing result;
|
|
result.code = code;
|
|
return result;
|
|
}
|
|
GroupInfo group_error(Code code)
|
|
{
|
|
GroupInfo result;
|
|
result.code = code;
|
|
return result;
|
|
}
|
|
Listing listing_error(Code code)
|
|
{
|
|
Listing result;
|
|
result.code = code;
|
|
return result;
|
|
}
|
|
Projection project(const std::vector<Event>& events)
|
|
{
|
|
Projection view;
|
|
for (const Event& e : events) {
|
|
if (e.kind == 0) {
|
|
view.groups[e.parent][e.id] = {true,e.generation,e.first,e.count,e.writable};
|
|
view.epochs[e.parent][e.id] = e.generation;
|
|
for (Number n=e.first; n<e.first+e.count; ++n) {
|
|
view.cells[e.parent][n] = {true,e.id,e.generation,0,e.writable};
|
|
}
|
|
} else if (e.kind == 1) {
|
|
auto& g=view.groups[e.parent][e.id];
|
|
for (Number n=g.first; n<g.first+g.count; ++n) {
|
|
view.cells[e.parent][n].live=false;
|
|
}
|
|
g.live=false;
|
|
} else {
|
|
view.cells[e.parent][e.first].value=e.value;
|
|
}
|
|
}
|
|
return view;
|
|
}
|
|
Registry::Registry() : state_(new State) {}
|
|
Registry::~Registry() = default;
|
|
Change Registry::publish(Number parent, Number id, Number first, Number count,
|
|
Number writable)
|
|
{
|
|
if (!publication_valid(parent,id,first,count,writable)) {
|
|
return change_error(Code::RANGE);
|
|
}
|
|
Projection view=project(state_->events);
|
|
if (view.groups[parent][id].live) {
|
|
return change_error(Code::EXISTS);
|
|
}
|
|
for (Number offset=0; offset<count; ++offset) {
|
|
if (view.cells[parent][first+offset].live) {
|
|
return change_error(Code::EXISTS);
|
|
}
|
|
}
|
|
Number generation=view.epochs[parent][id]+1;
|
|
state_->events.push_back({0,parent,id,first,count,writable,generation,0});
|
|
return {Code::OK,generation,count};
|
|
}
|
|
Change Registry::remove(Number parent, Number id)
|
|
{
|
|
if (!parent_valid(parent) || !group_valid(id)) {
|
|
return change_error(Code::RANGE);
|
|
}
|
|
Projection view=project(state_->events);
|
|
auto g=view.groups[parent][id];
|
|
if (!g.live) {
|
|
return change_error(Code::ABSENT);
|
|
}
|
|
state_->events.push_back({1,parent,id,0,0,0,0,0});
|
|
return {Code::OK,g.generation,g.count};
|
|
}
|
|
}
|