Fix M9.4-M9.7 review findings in the dev session stack
- TLS: replace send() with a bounded queue/flush; an interrupted record is retried with identical arguments and later frames wait behind it, so no queued frame is lost or reordered; close() flushes first. - Carriers: server-issued 'I','N' | 48-bit epoch | 64-bit ordinal ids replace the aliasing low-32-bit packing; client sequences are kept separately for replies; out-of-range epochs are refused, never truncated. - Grants: a durable, fsynced, fail-closed consumed-grant ledger (--session-grant-ledger, /objects/dev-session-grants.v1 in dev) keeps single-use grants consumed across process and pod restarts. - Liveness: protocol v1 (undeployed) gains Heartbeat and the timeout close reason; both sides heartbeat when idle and treat 5 s of silence as dead. - Client sends are bounded and unresolved tracking starts at send time. - ci-client configures with an explicit C compiler. Each finding has a regression test; ADR-0083, the schema, operations doc and VALIDATION record the corrections. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -126,6 +126,12 @@ void round_trips() {
|
||||
const auto c = decode_close(frame(encode(CloseReason::stale_epoch)));
|
||||
CHECK(c && *c == CloseReason::stale_epoch);
|
||||
CHECK(decode_close(frame(encode(CloseReason::capacity))) == CloseReason::capacity);
|
||||
CHECK(decode_close(frame(encode(CloseReason::timeout))) == CloseReason::timeout);
|
||||
const auto beat = encode_heartbeat();
|
||||
CHECK(beat.size() == frame_header_bytes && decode_heartbeat(frame(beat)));
|
||||
CHECK(refused(decode_heartbeat(frame(with_header(MessageType::heartbeat, 1, 0, 1, 1))),
|
||||
ProtocolError::trailing_bytes));
|
||||
CHECK(refused(decode_heartbeat(frame(encode(CloseReason::normal))), ProtocolError::wrong_type));
|
||||
const auto out = decode_intent_outcome(
|
||||
frame(encode(IntentOutcome{4, IntentFinality::committed_no_effect, 120, 9})));
|
||||
CHECK(out && out->sequence == 4 && out->finality == IntentFinality::committed_no_effect &&
|
||||
@@ -177,7 +183,7 @@ void frame_rejection() {
|
||||
CHECK(refused(decode_frame(with_header(MessageType{0}, 1, 0, 0, 0)),
|
||||
ProtocolError::unknown_type));
|
||||
// NOLINTNEXTLINE(clang-analyzer-optin.core.EnumCastOutOfRange)
|
||||
CHECK(refused(decode_frame(with_header(MessageType{9}, 1, 0, 0, 0)),
|
||||
CHECK(refused(decode_frame(with_header(MessageType{10}, 1, 0, 0, 0)),
|
||||
ProtocolError::unknown_type));
|
||||
CHECK(refused(decode_frame(with_header(MessageType::intent, 1, 1, 36, 36)),
|
||||
ProtocolError::reserved_flags));
|
||||
@@ -207,7 +213,7 @@ void frame_rejection() {
|
||||
status[frame_header_bytes + 8] = 8;
|
||||
CHECK(refused(decode_intent_result(frame(status)), ProtocolError::invalid_value));
|
||||
auto reason = encode(CloseReason::normal);
|
||||
reason[frame_header_bytes] = 10;
|
||||
reason[frame_header_bytes] = 11;
|
||||
CHECK(refused(decode_close(frame(reason)), ProtocolError::invalid_value));
|
||||
CHECK(refused(decode_welcome(frame(encode(Welcome{}))), ProtocolError::invalid_value));
|
||||
// A well-formed encoding of an invalid view is rejected by the presentation rules.
|
||||
@@ -261,6 +267,7 @@ void fuzz() {
|
||||
encode(IntentResult{1, IntentStatus::outside_window, 2}),
|
||||
encode(CloseReason::rate_limited),
|
||||
encode(IntentOutcome{3, IntentFinality::committed_no_effect, 4, 5}),
|
||||
encode_heartbeat(),
|
||||
encode(view_header, environment()),
|
||||
encode(view_header, organisms(3))};
|
||||
std::size_t accepted = 0;
|
||||
@@ -313,6 +320,10 @@ void fuzz() {
|
||||
if (const auto m = decode_intent_outcome(*f))
|
||||
again = encode(*m);
|
||||
break;
|
||||
case MessageType::heartbeat:
|
||||
if (decode_heartbeat(*f))
|
||||
again = encode_heartbeat();
|
||||
break;
|
||||
case MessageType::environment_view:
|
||||
if (const auto m = decode_environment_view(*f))
|
||||
again = encode(m->first, m->second);
|
||||
|
||||
Reference in New Issue
Block a user