Skip to content

Navigation Menu

Sign in
Sign up

refactor: switch admin create_queue from protobuf to binary encoding - #7

Merged
vieiralucas merged 2 commits into
main from
refactor/binary-admin-encoding
Mar 27, 2026
Merged

refactor: switch admin create_queue from protobuf to binary encoding #7
vieiralucas merged 2 commits into
main from
refactor/binary-admin-encoding

Conversation

@vieiralucas

@vieiralucas vieiralucas commented Mar 27, 2026
edited by cubic-dev-ai Bot
Loading

Copy link
Copy Markdown
Member

Summary

  • Update FibpAdminClient test helper from hand-encoded protobuf to binary wire format
  • Replace writeVarint with writeU16/writeU32 helpers for binary encoding
  • encodeCreateQueueRequest now produces queue_len:u16 + queue + on_enqueue_len:u16 + on_failure_len:u16 + visibility_timeout_ms:u32

Test plan

  • ./gradlew compileJava compileTestJava passes (verified locally)
  • Integration tests pass against a FIBP server with binary admin encoding (PR #153)
  • No protobuf encoding remains in test infrastructure

Summary by cubic

Switch the test FibpAdminClient CreateQueue request from hand-rolled protobuf to the binary wire format. Aligns admin tests with the server’s binary encoding, removes protobuf from test code, and adds UTF-8 length validation to prevent u16 overflow.

  • Refactors

    • Encode CreateQueue as: queue_len:u16 + queue:utf8 + on_enqueue_len:u16 + on_enqueue:utf8 + on_failure_len:u16 + on_failure:utf8 + visibility_timeout_ms:u32.
    • Replace varint writer with writeU16 and writeU32.
  • Bug Fixes

    • Validate queue name UTF-8 length (<= 65535); throw IOException if exceeded.

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

test admin client now uses binary wire format for create_queue
(queue_len:u16 + queue + on_enqueue_len:u16 + on_failure_len:u16 +
visibility_timeout_ms:u32) instead of hand-encoded protobuf. replace
writeVarint with writeU16/writeU32 helpers.

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

1 issue found across 1 file

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="src/test/java/dev/faisca/fila/FibpAdminClient.java">
<violation number="1" location="src/test/java/dev/faisca/fila/FibpAdminClient.java:143">
P2: Validate queue name UTF-8 length before writing u16 length to avoid silent overflow and malformed binary payloads.</violation>
</file>

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

Comment thread src/test/java/dev/faisca/fila/FibpAdminClient.java
names whose utf-8 encoding exceeds 65535 bytes would silently overflow
the u16 length field. now throws ioexception with a clear message.

Copy link
Copy Markdown
Member Author

Fixed in bb8683f. encodeCreateQueueRequest now checks nameBytes.length > 0xFFFF before writing the u16 field and throws IOException with a clear message if the UTF-8 encoding exceeds 65535 bytes.

vieiralucas merged commit b1a03a4 into main Mar 27, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@cubic-dev-ai cubic-dev-ai[bot] cubic-dev-ai[bot] left review comments

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

AltStyle によって変換されたページ (->オリジナル) /