Skip to content

feat: story 7.1 — rust client sdk#30

Merged
vieiralucas merged 9 commits intomainfrom
feat/7.1-rust-client-sdk
Feb 19, 2026
Merged

feat: story 7.1 — rust client sdk#30
vieiralucas merged 9 commits intomainfrom
feat/7.1-rust-client-sdk

Conversation

@vieiralucas
Copy link
Copy Markdown
Member

@vieiralucas vieiralucas commented Feb 17, 2026

Summary

  • New fila-client crate: idiomatic Rust SDK wrapping tonic-generated FilaServiceClient<Channel>
  • Four hot-path operations: enqueue, lease (streaming), ack, nack
  • Context-aware error mapping: QueueNotFound vs MessageNotFound based on operation
  • LeaseMessage flattens proto Message + MessageMetadata into ergonomic struct
  • FilaClient is Clone + Send + Sync — safe to share across tokio tasks

Acceptance Criteria Covered

Test Summary

  • 3 new integration tests (fila-client): lifecycle, nack/retry, error handling
  • 267 existing tests pass (zero regressions)
  • Clippy clean, fmt clean

New Files

  • crates/fila-client/Cargo.toml
  • crates/fila-client/src/lib.rs
  • crates/fila-client/src/client.rs
  • crates/fila-client/src/error.rs
  • crates/fila-client/tests/integration.rs

Summary by cubic

Adds a new fila-sdk crate: an idiomatic Rust SDK wrapping the tonic FilaServiceClient with connect, enqueue, streaming lease, ack, and nack. Addresses Story 7.1 with per-operation error types, an ergonomic LeaseMessage, end-to-end tests, and CI that builds the workspace so tests can spawn fila-server.

  • New Features

    • New fila-sdk crate with FilaClient::connect and ConnectOptions (addr, timeout).
    • enqueue returns message ID; lease streams LeaseMessage; ack/nack supported; LeaseMessage flattens proto types.
    • Client is Clone + Send + Sync; async API; 3 integration tests; CI builds workspace so fila-server is available.
  • Refactors

    • Replaced single ClientError with per-operation errors (ConnectError, EnqueueError, LeaseError, AckError, NackError); lease stream items use StatusError only.
    • Renamed crate to fila-sdk; updated artifacts to mark Story 7.1 and Epic 7 done; integration tests fail fast and filter None keepalive frames.
    • Formatting fixes in fila-sdk to keep code style clean.

Written for commit d052e4f. Summary will update on new commits.

new fila-client crate providing idiomatic rust sdk for fila broker.
wraps tonic-generated FilaServiceClient with ergonomic api:
connect, enqueue, lease (streaming), ack, nack.

context-aware error mapping distinguishes queue vs message not-found.
LeaseMessage struct flattens proto types for ergonomic consumption.
3 integration tests verify full lifecycle against real fila-server.
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found across 10 files

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="crates/fila-client/tests/integration.rs">

<violation number="1" location="crates/fila-client/tests/integration.rs:94">
P2: The startup poll never asserts that the server actually became reachable. If the timeout elapses, the test proceeds with an unusable client, leading to confusing downstream failures. Track whether a connection succeeded and assert after the loop.</violation>
</file>

<file name="crates/fila-client/src/client.rs">

<violation number="1" location="crates/fila-client/src/client.rs:118">
P2: Missing `message` fields in a lease response are silently dropped due to `?` inside `filter_map`. This hides protocol errors and can leave consumers unaware of a malformed response. Return an explicit error when `message` is `None` instead of filtering it out.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread crates/fila-sdk/tests/integration.rs

let stream = response.into_inner().filter_map(|result| match result {
Ok(lease_response) => {
let msg = lease_response.message?;
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot Feb 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Missing message fields in a lease response are silently dropped due to ? inside filter_map. This hides protocol errors and can leave consumers unaware of a malformed response. Return an explicit error when message is None instead of filtering it out.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At crates/fila-client/src/client.rs, line 118:

<comment>Missing `message` fields in a lease response are silently dropped due to `?` inside `filter_map`. This hides protocol errors and can leave consumers unaware of a malformed response. Return an explicit error when `message` is `None` instead of filtering it out.</comment>

<file context>
@@ -0,0 +1,173 @@
+
+        let stream = response.into_inner().filter_map(|result| match result {
+            Ok(lease_response) => {
+                let msg = lease_response.message?;
+                let metadata = msg.metadata.unwrap_or_default();
+                Some(Ok(LeaseMessage {
</file context>
Fix with Cubic

Integration tests in fila-client spawn fila-server as a subprocess.
cargo nextest run only compiles test binaries, not the main server
binary. Add cargo build --workspace to ensure all binaries are
available.
- Rename crate from fila-client to fila-sdk across workspace
- Add assertion after server startup poll to fail fast when server
  is unreachable (Cubic finding #1)
- Add comment explaining why None lease messages are filtered as
  expected keepalive frames (Cubic finding #2)
Copy link
Copy Markdown
Member Author

@vieiralucas vieiralucas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It annoys me that every method can return all the errors by the types. But that's not true. And for instance lease, the returned Result can have a QueueNotFound, but the inner one can never produce a QueueNotFound.

Each SDK method now returns only the errors it can actually produce:
- ConnectError for connect/connect_with_options
- EnqueueError (QueueNotFound + StatusError) for enqueue
- LeaseError (QueueNotFound + StatusError) for lease setup
- StatusError for lease stream items (no QueueNotFound possible)
- AckError (MessageNotFound + StatusError) for ack
- NackError (MessageNotFound + StatusError) for nack

Follows the same per-command pattern as fila-core/error.rs.
@vieiralucas vieiralucas merged commit 8bcce7a into main Feb 19, 2026
5 checks passed
@vieiralucas vieiralucas deleted the feat/7.1-rust-client-sdk branch February 19, 2026 17:13
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