feat(client-rust): add write_array_elements default-fill helper and document semantics

Handles the new MxSparseArray wire type (proto field 19 on MxValue::Kind):
- value.rs: map SparseArrayValue to MxValueProjection::Unset (write-only; never emitted on read path)
- session.rs: add write_array_elements() that builds the sparse proto value and delegates to write()
- tests: three unit tests asserting proto shape, empty-elements case, and read-path Unset projection
- README: document write_array_elements default-fill semantics and bare-name [] normalisation
This commit is contained in:
Joseph Doherty
2026-06-18 03:02:15 -04:00
parent b7f29f3048
commit 3a8f2bed4e
4 changed files with 191 additions and 9 deletions
+5 -1
View File
@@ -173,7 +173,11 @@ impl MxValueProjection {
Some(Kind::TimestampValue(value)) => Self::Timestamp(*value),
Some(Kind::ArrayValue(value)) => Self::Array(MxArrayValue::from_proto(value.clone())),
Some(Kind::RawValue(value)) => Self::Raw(value.clone()),
None => Self::Unset,
// SparseArrayValue is write-only: the gateway expands it before forwarding
// to the worker and never emits it in events or read replies. Map it to
// Unset so any read-side code that encounters a stale or mis-routed
// sparse value degrades gracefully rather than panicking.
Some(Kind::SparseArrayValue(_)) | None => Self::Unset,
}
}
}