Skip to content

Received preset encodings are value-only end to end#488

Merged
milyin merged 2 commits into
zenoh-flat-transitionfrom
encoding-conditional-handle
Jul 17, 2026
Merged

Received preset encodings are value-only end to end#488
milyin merged 2 commits into
zenoh-flat-transitionfrom
encoding-conditional-handle

Conversation

@milyin

@milyin milyin commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

What

Consumes ZettaScaleLabs/zenoh-flat-jni#6 (merged as 1e040c9): the encoding handle delivered with a received sample/query/reply is conditional on schema presence. A received preset (schema-less) encoding arrives value-only — it re-sends through the (id, schema) value arm for free, so the per-message native handle it used to carry (Rust clone+Box, JVM wrapper + atomic cell + gc-Cleaner registration, later Cleaner free — the +150 ns class measured in milyin/prebindgen#83) is never materialized. Schema-carrying (custom) encodings keep the send-ready handle from #485.

The condition lives in the binding tier (encoding_if_schema in zenoh-flat-jni, declared with prebindgen's binding-local fun!(crate::…).sig(sig!(…)) vocabulary from milyin/prebindgen#84) — zenoh-flat stays pure.

Changes

  • Sample.fromParts encH becomes nullable (Query.fromParts already was); the reply callback drops its non-null assertion on the ok-arm handle leaf.
  • EncodingHandleTest: the preset round-trip flips to assertNull(received.encoding.handle) — the new contract, asserted end to end; the custom-encoding round-trip still verifies a delivered handle + same-handle re-send.
  • CI pin bumped to the zenoh-flat-jni#6 merge commit (1e040c9).

110 jvmTest, 0 failures against merged flat-jni main.

🤖 Generated with Claude Code

milyin and others added 2 commits July 17, 2026 11:56
zenoh-flat-jni#6 makes the delivered encoding handle CONDITIONAL on
schema presence (binding-local encoding_if_schema behind prebindgen#84's
field! leaf): a received preset re-sends through the id arm for free, so
no per-message native handle — clone + Box + JVM wrapper + gc-Cleaner
registration + Cleaner free — is ever materialized for it. Schema-
carrying encodings keep the send-ready handle.

Adapt the delivery plumbing: Sample.fromParts encH becomes nullable
(Query's already was), the reply callback drops its non-null assertion,
and EncodingHandleTest's preset round-trip flips to assert the received
copy has NO handle — the new contract. CI pin bumped to the flat-jni#6
tip.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The previous pin was a branch commit deleted on merge; 1e040c9 is
ZettaScaleLabs/zenoh-flat-jni#6 on main (conditional encoding handle,
final fun!+sig! syntax).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@milyin
milyin merged commit 3ec8f2e into zenoh-flat-transition Jul 17, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant