Add owner-filtered cellular perception protocol
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (checks) (push) Failing after 39s
Foundation / checks (postgres) (push) Canceled after 0s
Foundation / checks (tsan) (push) Canceled after 0s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (ecs) (push) Canceled after 1m48s
Foundation / checks (network) (push) Canceled after 1m18s
Foundation / checks (client) (push) Canceled after 1m58s

This commit is contained in:
dingo
2026-10-11 01:06:05 -04:00
parent 10b042309e
commit 5419a579e8
7 changed files with 209 additions and 10 deletions
+28 -1
View File
@@ -115,6 +115,32 @@ void v7_reliable_action_is_stable_and_strict() {
std::fill(malformed_input.begin(), malformed_input.begin() + 8, std::uint8_t{0});
CHECK(!decode_cellular_action_input(malformed_input));
}
void v8_perception_is_bounded_and_canonical() {
const CellularPerception perception{
19, 42, {{1'000, 2'000, 3, {4, 5, 6, 7}}, {1'000, 3'000, 8, {9, 10, 11, 12}}}};
const auto bytes = encode_session(SessionMessage{perception});
CHECK(!bytes.empty() && bytes.size() == session_header_bytes + 18 + 2 * 48);
std::uint16_t version{};
const auto decoded = decode_session(bytes, &version);
CHECK(decoded && version == session_protocol_v8);
CHECK(std::get<CellularPerception>(*decoded) == perception);
CHECK(encode_session(*decoded) == bytes);
CHECK(encode_session(SessionMessage{perception}, session_protocol_v7).empty());
CHECK(!decode_session(std::span{bytes}.first(bytes.size() - 1)));
auto reversed = perception;
std::ranges::reverse(reversed.patches);
CHECK(encode_session(SessionMessage{reversed}).empty());
auto duplicate = perception;
duplicate.patches[1] = duplicate.patches[0];
CHECK(encode_session(SessionMessage{duplicate}).empty());
CHECK(encode_session(SessionMessage{CellularPerception{19, 0, {perception.patches[0]}}})
.empty());
const CellularPerception cleared{19, 0, {}};
const auto clear_bytes = encode_session(SessionMessage{cleared});
CHECK(std::get<CellularPerception>(*decode_session(clear_bytes)) == cleared);
}
} // namespace
int main() {
@@ -122,7 +148,8 @@ int main() {
round_trip_and_version_gate();
malformed_frames_are_refused();
v7_reliable_action_is_stable_and_strict();
std::puts("PASS cellular protocol: v6 intention and v7 action strict framing");
v8_perception_is_bounded_and_canonical();
std::puts("PASS cellular protocol: v6 intention, v7 action, v8 perception framing");
} catch (const std::exception& error) {
std::fprintf(stderr, "%s\n", error.what());
return 1;