Add M10.9a load measurement, governor and overload shedding
Foundation / checks (deploy) (push) Successful in 3m20s
Foundation / checks (ecs) (push) Successful in 1m59s
Foundation / checks (client) (push) Failing after 10m0s
Foundation / checks (network) (push) Successful in 13m9s
Foundation / checks (tsan) (push) Successful in 8m1s
Foundation / checks (checks) (push) Successful in 32m2s
Foundation / checks (postgres) (push) Failing after 26m39s
Foundation / postgres-tools (push) Skipped
Foundation / server-image (push) Skipped
Foundation / image (push) Skipped

ADR-0097 (M10.9 load and abuse qualification; only evolution-dev
reference-worker runs qualify). evo-server measures each simulated tick's
work (host step plus the M10 bridge, with the session layer's share kept
separately) and feeds a portable LoadGovernor: grant logins are refused
at a 2 s p95 of 15 ms or any tick debt, replication is shed in up to
three levels at 20 ms or debt >= 2 (radius cap 7/7/5/3, far updates
x1/x2/x2/x4, no fresh baselines, own markers unaffected), and both relax
after 5 s of calm. Handoff tickets are still admitted. /metrics gains
evo_m10_* gauges when the listener is enabled.

Adds the missing ADR index entries for ADR-0094 to ADR-0096. Refreshes
the dev session window.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dingo
2026-10-07 06:34:40 -04:00
co-authored by Claude Opus 5.5
parent 265163a9a6
commit b8cb9db297
22 changed files with 676 additions and 34 deletions
+63
View File
@@ -5,6 +5,7 @@
#include "network_test.hpp"
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <map>
#include <set>
#include <vector>
@@ -385,9 +386,71 @@ void dense_report() {
}
} // namespace
// M10.9a overload shedding (ADR-0097): the encoded radius shrinks and far updates slow without a
// fresh baseline or a change of the stored interest; the view grows back when the level drops.
void shedding() {
auto server = *ReplicationServer::create(limits());
World world;
CHECK(server.open(1, 5) && server.set_interest(1, {0, 0, slice, 7}));
SnapshotAssembler client{identity, 5};
const auto source = [&](const SessionInterest&) { return world.source(); };
std::uint64_t tick = 0;
std::uint64_t baseline = 0;
const auto step = [&] {
const auto out = server.tick(++tick, source, {});
const auto& chunks = for_session(out, 1);
baseline = chunks.front().baseline;
for (const auto& a : deliver(client, chunks))
server.acknowledge(1, a);
return client.latest()->environment.size();
};
while (step() < 225 && tick < 10) {
}
CHECK(client.latest()->environment.size() == 225);
const auto square = [&](std::int64_t r) {
return std::ranges::all_of(client.latest()->environment, [&](const auto& c) {
return std::max(std::abs(c.voxel.x), std::abs(c.voxel.y)) <= r;
});
};
server.set_shed(2);
CHECK(server.shed() == 2 && step() == 121 && square(5) && baseline != 0);
CHECK(server.interest(1).value_or(SessionInterest{}).radius == 7); // The stored interest.
server.set_shed(9);
CHECK(server.shed() == 3 && step() == 49 && square(3) && baseline != 0);
// Level 3: near radius 2, far updates every 16 ticks. A cell at distance 3 changed twice
// arrives at once (last sent long ago), then not again for 16 ticks.
const auto at = [&](std::int64_t x, std::int64_t y) {
return std::ranges::find_if(client.latest()->environment,
[&](const auto& c) { return c.voxel.x == x && c.voxel.y == y; })
->quantity[0];
};
for (int i = 0; i < 16; ++i)
step();
world.quantity[{3, 0}] = 41;
world.quantity[{2, 0}] = 42;
step();
CHECK(at(3, 0) == 41 && at(2, 0) == 42);
world.quantity[{3, 0}] = 51;
world.quantity[{2, 0}] = 52;
step();
CHECK(at(2, 0) == 52 && at(3, 0) == 41); // Near: every tick. Far: deferred.
int waited = 1;
while (at(3, 0) != 51 && waited < 40) {
step();
++waited;
}
CHECK(waited == 16);
// Back to level 0: the full square returns, still from acknowledged baselines.
server.set_shed(0);
for (int i = 0; i < 6 && client.latest()->environment.size() < 225; ++i)
step();
CHECK(client.latest()->environment.size() == 225 && baseline != 0);
}
void replication_tests() {
codec_v2();
convergence_and_deltas();
shedding();
concealment();
client_robustness();
dense_report();