Skip to content

feat: 30.2 — unified api surface#4

Merged
vieiralucas merged 2 commits intomainfrom
feat/30.2-unified-api
Mar 25, 2026
Merged

feat: 30.2 — unified api surface#4
vieiralucas merged 2 commits intomainfrom
feat/30.2-unified-api

Conversation

@vieiralucas
Copy link
Copy Markdown
Member

@vieiralucas vieiralucas commented Mar 25, 2026

Summary

Update Ruby SDK to match the unified proto API from Story 30.1:

  • Proto: Copied new service.proto and regenerated Ruby code. BatchEnqueue RPC removed. EnqueueRequest now contains repeated EnqueueMessage. AckRequest/NackRequest use repeated AckMessage/NackMessage. ConsumeResponse only has repeated Message messages.
  • enqueue: Wraps single message in EnqueueMessage, sends via unified Enqueue RPC, parses per-message EnqueueResult (with typed EnqueueError).
  • enqueue_many: Replaces batch_enqueue. Same semantics, no "batch" prefix. Returns Array<EnqueueResult>.
  • ack/nack: Wrap in repeated AckMessage/NackMessage, parse first AckResult/NackResult with typed error codes.
  • consume: Only reads repeated messages field (singular message field removed from proto).
  • Batcher: Uses unified Enqueue RPC for all batch sizes (no more BatchEnqueue split).
  • BatchEnqueueResult -> EnqueueResult: Renamed, no "batch" prefix.
  • Version bumped to 0.4.0.

Test plan

  • TestEnqueueResult unit tests pass (success/error result construction)
  • TestEnqueueMany integration tests pass (multiple, single, empty, mixed success/failure)
  • TestAutoBatching integration tests pass (single, concurrent, nonexistent queue)
  • TestLingerBatching integration tests pass
  • TestDisabledBatching integration tests pass
  • TestBatchModeValidation unit tests pass
  • TestCloseFlush integration tests pass
  • TestClient integration tests pass (enqueue/consume/ack, nack redeliver, nonexistent queue)
  • TLS/auth tests unaffected

Summary by cubic

Updates the Ruby SDK to the unified proto API (Story 30.2), replacing batch RPCs with a single Enqueue path and adding typed, batched Ack/Nack. Introduces enqueue_many, renames the batch result to EnqueueResult, improves batcher/error handling, and bumps to v0.4.0.

  • New Features

    • Unified proto: EnqueueRequest takes repeated EnqueueMessage; ConsumeResponse only has messages; typed error codes for enqueue/ack/nack; StreamEnqueue RPC scaffolded.
    • Client API: added enqueue_many; enqueue wraps a single EnqueueMessage; ack/nack send batched requests, parse typed errors, and raise RPCError when no result is returned.
    • Batcher: always uses Enqueue; centralized result/error handling; minor refactors and lint fixes.
  • Migration

    • Replace batch_enqueue(...) with enqueue_many(...).
    • Replace BatchEnqueueResult with EnqueueResult.
    • consume now only reads the messages field.
    • ack/nack keep the same call shape but now raise typed errors (and RPCError if the server returns no result).

Written for commit 88a334a. Summary will update on new commits.

- copy new service.proto (BatchEnqueue RPC removed, EnqueueRequest now
  takes repeated EnqueueMessage, AckRequest/NackRequest take repeated
  messages, ConsumeResponse only has repeated messages field)
- regenerate ruby proto code from new service.proto
- replace batch_enqueue method with enqueue_many (no "batch" prefix)
- enqueue wraps single message in EnqueueMessage + EnqueueRequest
- ack/nack wrap in repeated AckMessage/NackMessage, parse first result
- consume uses only repeated messages field (singular field removed)
- rename BatchEnqueueResult to EnqueueResult
- batcher uses unified Enqueue RPC for all batch sizes
- update all tests to match new api surface
- bump version to 0.4.0
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.

1 issue found across 9 files

Prompt for AI agents (unresolved 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="lib/fila/client.rb">

<violation number="1" location="lib/fila/client.rb:155">
P2: A nil result silently returns success instead of raising an error. Since this sends exactly one message, receiving zero results is an error condition. This is inconsistent with `enqueue_single` which correctly raises `RPCError` when result is nil.</violation>
</file>

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

Comment thread lib/fila/client.rb Outdated
- ack/nack: raise RPCError on nil result instead of silently returning
  (identified by cubic — nil means zero results, which is an error for
  single-message operations)
- batcher: extract result_to_outcome and broadcast_error from flush_batch
  to satisfy AbcSize/CyclomaticComplexity/MethodLength/PerceivedComplexity
- batcher: remove redundant begin block in pop_with_timeout
- batcher: add rubocop:disable for Metrics/ClassLength (126 lines, thread
  management + two modes is inherently complex)
- test_batch: fix array indentation and prefer single-quoted strings
@vieiralucas vieiralucas merged commit 507dd00 into main Mar 25, 2026
3 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