Skip to content

feat: add blocking_subscribe field to PUT/GET contract requests#50

Merged
iduartgomez merged 2 commits intomainfrom
feat/blocking-subscribe
Feb 6, 2026
Merged

feat: add blocking_subscribe field to PUT/GET contract requests#50
iduartgomez merged 2 commits intomainfrom
feat/blocking-subscribe

Conversation

@iduartgomez
Copy link
Contributor

Problem

When clients use subscribe=true on PUT/GET operations, subscriptions happen asynchronously (fire-and-forget). The client gets an immediate response but has no guarantee the subscription succeeded. This was identified in issues freenet/freenet-core#2506 and freenet/freenet-core#2539.

The blocking subscription infrastructure already exists in freenet-core (start_subscription_request_blocking(), start_subscription_after_put() with a blocking_subscription: bool parameter), but it was always hardcoded to false with TODO comments saying the value should come from ContractRequest once stdlib is updated.

Solution

Add a blocking_subscribe: bool field to both ContractRequest::Put and ContractRequest::Get:

  • FlatBuffers schema: Added blocking_subscribe:bool; to Put and Get tables. FlatBuffers bools default to false, making this fully backward-compatible on the wire.
  • Rust enum: Added #[serde(default)] blocking_subscribe: bool to both variants, ensuring backward-compatible JSON deserialization.
  • Serialization: Updated TryFromFbs, into_owned(), and test match arms.
  • Generated code: Regenerated via flatc (not manually edited).

When blocking_subscribe is false (default), behavior is identical to today. When true and subscribe is also true, freenet-core will wait for the subscription to complete before returning the PUT/GET response to the client.

Testing

  • cargo test passes in freenet-stdlib
  • Companion PR in freenet-core threads the new field through the operation state machines

Fixes

Related to freenet/freenet-core#2506 and freenet/freenet-core#2539

Add a `blocking_subscribe: bool` field to both `ContractRequest::Put`
and `ContractRequest::Get` to allow clients to request blocking
(synchronous) subscriptions. When true, the operation response waits
for the subscription to complete rather than firing it asynchronously.

The field defaults to `false` in both FlatBuffers (wire format) and
serde (JSON), preserving full backward compatibility with existing
clients.

Changes:
- FlatBuffers schema: added `blocking_subscribe:bool` to Put and Get tables
- ContractRequest enum: added field with `#[serde(default)]`
- Updated TryFromFbs, into_owned, Display implementations
- Regenerated FlatBuffers bindings
@iduartgomez iduartgomez enabled auto-merge (squash) February 6, 2026 13:03
@iduartgomez iduartgomez disabled auto-merge February 6, 2026 13:03
@iduartgomez iduartgomez merged commit 5db4f83 into main Feb 6, 2026
8 of 9 checks passed
@iduartgomez iduartgomez deleted the feat/blocking-subscribe branch February 6, 2026 13:04
iduartgomez added a commit to freenet/river that referenced this pull request Feb 6, 2026
Add `blocking_subscribe: false` to all ContractRequest::Put and
ContractRequest::Get constructors to match the new field added in
freenet-stdlib 0.1.33 (freenet/freenet-stdlib#50).
iduartgomez added a commit to freenet/river that referenced this pull request Feb 6, 2026
Add `blocking_subscribe: false` to all ContractRequest::Put and
ContractRequest::Get constructors to match the new field added in
freenet-stdlib 0.1.33 (freenet/freenet-stdlib#50).
iduartgomez added a commit to freenet/river that referenced this pull request Feb 6, 2026
Add `blocking_subscribe: false` to all ContractRequest::Put and
ContractRequest::Get constructors to match the new field added in
freenet-stdlib 0.1.33 (freenet/freenet-stdlib#50).
iduartgomez added a commit to freenet/river that referenced this pull request Feb 6, 2026
…ld (#80)

Add `blocking_subscribe: false` to all ContractRequest::Put and
ContractRequest::Get constructors to match the new field added in
freenet-stdlib 0.1.33 (freenet/freenet-stdlib#50).
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