CultNet contract: a decoder refuses commitCount below two; a change for an ended subscription is dropped. cultnet-rs: pin that a one-change announcement ignores a full buffer
All checks were successful
CultMesh portability and performance / ubuntu-latest reactive semantics and leases (pull_request) Successful in 33m55s

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-11-28 04:57:46 +01:00
commit c5d8f8047c
2 changed files with 14 additions and 2 deletions

View file

@ -141,7 +141,7 @@ A malformed put or delete is `message_invalid`, not a per-operation code: the pe
shard view and advances the replica cursor to that sequence.
- Realtime subscriptions publish domain changes, not storage envelopes.
- A subscription's `database_change_raw` messages may carry `commitId` and `commitCount`: the changes of one cache
commit that this subscription delivers (`commitCount` of them, at least two). Both fields are optional and additive; a
commit that this subscription delivers (`commitCount` of them, at least two; a decoder refuses less). Both fields are optional and additive; a
peer that does not know them ignores them and applies each change alone. A replica that knows them applies the
commit's changes as one commit, so the replica judges the result (a swap of two unique-index values) and not the state
between records. A replica whose cache refuses a commit is faulted, never silent. `commitId` is opaque and valid only
@ -149,7 +149,7 @@ A malformed put or delete is `message_invalid`, not a per-operation code: the pe
never forwards a commit that its last snapshot to the subscription already reflects (the database server adopts next). A replica may bound how many
changes it buffers across incomplete commits (the C# client: `MaxBufferedChanges`, 1,000,000). One bound covers every
commit, whatever made it, a `Reconcile` diff included: a commit announcing more faults the replica loudly, and a faulted
consumer resubscribes for a snapshot, which is one message and has no such bound. A server does not split a commit to
consumer resubscribes for a snapshot, which is one message and has no such bound. A change for a subscription the client has ended or never began is dropped, never applied or buffered, whether it is a single change or part of a commit. A server does not split a commit to
fit a replica's bound. The C# subscription server and database server tag commits; other runtimes adopt next.
- The C# writer sets every key of a `database_change_raw` message, nil where unset: a removed change carries `document`
nil, an added or updated one `recordKey` and `schemaId` nil. The schema accepts those nils; an added or updated change

View file

@ -398,3 +398,15 @@ fn decode_refuses_an_unsubscribe_or_change_without_its_ids() {
])))
.contains("subscriptionId"));
}
#[test]
fn a_one_change_announcement_never_counts_against_a_full_buffer() {
let mut assembler = live("sub");
for index in 0..MAX_PENDING_COMMITS {
let id = format!("c{index}");
assert!(assembler.accept(change(&format!("m{index}"), "sub", "k", Some((&id, 2)))).is_empty());
}
let events = assembler.accept(change("single", "sub", "k1", Some(("one", 1))));
assert_eq!(keys(&events[0]), ["k1"], "a single change is not a buffered commit, so the full cap does not refuse it");
assert!(assembler.fault().is_none());
}