feat: replace grpc transport with fibp (fila binary protocol)#5
Merged
vieiralucas merged 4 commits intomainfrom Mar 26, 2026
Merged
feat: replace grpc transport with fibp (fila binary protocol)#5vieiralucas merged 4 commits intomainfrom
vieiralucas merged 4 commits intomainfrom
Conversation
rewrite the javascript sdk transport layer from grpc to fibp: - new src/transport.ts: tcp connection via net.socket/tls.connect, length-prefixed binary frame encoding/decoding, correlation id multiplexing (map + promises), auth frame for api key, stream support for consume push delivery - client.ts: lazy connection, fibp request/response for enqueue/ack/nack, async iterable consume via openstream - batcher.ts: adapted to fibp connection instead of grpc client - errors.ts: adds unauthenticatederror, removes grpc status code dep - test helpers rewritten to use fibp + protobufjs for admin ops (createqueue, listqueues readiness probe) - new test/transport.unit.test.ts: 18 unit tests for frame encoding, payload round-trips, and wire format correctness - removes @grpc/grpc-js and @grpc/proto-loader dependencies entirely; adds protobufjs (already transitive) for admin protobuf payloads - removes generated/ grpc type stubs directory - bumps version to 0.3.0
There was a problem hiding this comment.
3 issues found across 78 files
Note: This PR contains a large number of files. cubic only reviews up to 75 files per PR, so some files may not have been reviewed.
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="test/helpers.ts">
<violation number="1" location="test/helpers.ts:187">
P2: Handle failure when creating the persistent admin connection; otherwise a connect error can leak the spawned server process and temp directory.</violation>
</file>
<file name="src/client.ts">
<violation number="1" location="src/client.ts:406">
P2: Inline error-frame parsing skips the `msg_len` field and reads to end of payload, which can include trailing bytes. Use the existing `decodeErrorPayload` helper from `transport.ts` that correctly bounds the message read.</violation>
</file>
<file name="src/transport.ts">
<violation number="1" location="src/transport.ts:602">
P1: The wire error `code` from the ERROR frame is discarded and replaced with `ErrCode.INTERNAL`. This means frame-level errors (e.g., authentication failures) always surface as generic internal errors, preventing the client from throwing typed errors like `UnauthenticatedError`.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
- transport: preserve wire error code in rpc errors (not hardcoded INTERNAL) - client: add rpcerror catch+remap for transport-level errors on enqueue/ack/nack/consume - errors: add rpcerror.detail to store raw message without code prefix - batcher: remap transport-level rpcerror to typed errors before rejecting batch items - helpers: handle connectadmin failure to avoid server process + tempdir leak
vieiralucas
added a commit
to faiscadev/fila
that referenced
this pull request
Mar 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
@grpc/grpc-jsand@grpc/proto-loaderdependencies entirely; addsprotobufjs(previously transitive) for admin op payloads onlysrc/transport.tswith the full FIBP implementation: TCP/TLS connection, handshake, frame encode/decode, correlation ID multiplexing, auth frame, streaming push deliveryClient,enqueue,consume,ack,nack,close,enqueueMany, all optionsChanges
New files:
src/transport.ts— FIBP connection, frame encoding/decoding, all wire format helperstest/transport.unit.test.ts— 18 unit tests covering frame format, payload round-trips, and wire format correctness (no server required)Modified files:
src/client.ts— rewritten to useFibpConnectioninstead of gRPC channel; lazy connect on first operationsrc/batcher.ts— adapted to useFibpConnectioninstead ofFilaServiceClientsrc/errors.ts— addsUnauthenticatedError, removes gRPC status code dependencysrc/index.ts— exportsUnauthenticatedErrortest/helpers.ts— rewritten to use FIBP +protobufjsfor admin ops (createQueue,listQueuesreadiness probe); removes gRPC admin clienttest/auth.test.ts— updated to useUnauthenticatedErrorinstead ofRPCErrorwith gRPCUNAUTHENTICATEDcode; removes gRPC importspackage.json— removes grpc deps, adds protobufjs, bumps to 0.3.0tsconfig.json— removesgenerated/from includeREADME.md— updated for FIBP transport, new error class, protocol sectionDeleted:
generated/— gRPC TypeScript type stubs, no longer neededTest plan
npm test— 25 tests (18 transport + 7 batcher)npm run typecheck— cleannpm run lint— cleanFILA_SERVER_BINis set — CI provisions the server binary🤖 Generated with Claude Code
Summary by cubic
Replaced the gRPC transport with FIBP (Fila Binary Protocol) over raw TCP/TLS to reduce deps and simplify the wire path. Public API stays the same; adds UnauthenticatedError for auth failures, preserves server error codes in RPCError (with detail), and sets all test server startup timeouts to 30s.
Migration
Clientmethods work as before.UNAUTHENTICATED, catchUnauthenticatedErrorinstead.Dependencies
@grpc/grpc-jsand@grpc/proto-loader; addedprotobufjs.generated/stubs; version bumped to 0.3.0.Written for commit ed658d1. Summary will update on new commits.