Skip to content

fix: address cubic review findings from PR #4#5

Merged
vieiralucas merged 1 commit intomainfrom
fix/cubic-pr4-findings
Mar 25, 2026
Merged

fix: address cubic review findings from PR #4#5
vieiralucas merged 1 commit intomainfrom
fix/cubic-pr4-findings

Conversation

@vieiralucas
Copy link
Copy Markdown
Member

@vieiralucas vieiralucas commented Mar 25, 2026

Summary

Addresses all 4 Cubic findings from PR #4 that were merged without fixes:

  • client.go:190 — AccumulatorModeDisabled detection missed pointer values (*AccumulatorModeDisabled). Switched to type switch covering both value and pointer types.
  • accumulator.go:124runAuto drain loop had no cap on batch size, risking gRPC ResourceExhausted under high throughput. Added maxAutoBatchSize (1000) cap, consistent with runLinger's maxSize behavior.
  • enqueue.go:71EnqueueMany did not validate response result count matched input. Now allocates results based on input length and fills missing slots with explicit errors.
  • proto/service.proto — Removed field numbers (from pre-unification EnqueueRequest, AckRequest, NackRequest, ConsumeResponse) had no reserved directives. Added reserved to prevent accidental reuse.

Test plan

  • go build ./... passes
  • go vet ./... passes
  • Full test suite passes locally (all integration tests green)
  • CI passes on this branch

Summary by cubic

Fixes four issues from PR #4 to improve correctness and stability. Prevents unintended accumulator start, caps auto batch size, validates EnqueueMany results, and reserves removed proto fields to avoid future conflicts.

  • Bug Fixes
    • Accumulator disable check now handles both value and pointer types, so the accumulator doesn’t start when disabled.
    • Auto-mode drain loop capped with maxAutoBatchSize (1000) to avoid gRPC message size issues.
    • EnqueueMany now allocates results by input length and surfaces errors when the server returns fewer results.
    • Protobuf: added reserved numbers for removed fields in EnqueueRequest, ConsumeResponse, AckRequest, and NackRequest to prevent accidental reuse.

Written for commit 6e16884. Summary will update on new commits.

- client.go: handle both value and pointer AccumulatorModeDisabled in
  type assertion to prevent accumulator from starting unexpectedly
- accumulator.go: cap runAuto drain loop at maxAutoBatchSize (1000) to
  prevent exceeding gRPC 4MB max message size under high throughput
- enqueue.go: validate EnqueueMany response result count matches input
  message count, fill missing results with explicit errors
- proto: add reserved directives for removed field numbers in
  EnqueueRequest, ConsumeResponse, AckRequest, NackRequest to prevent
  accidental field number reuse
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.

No issues found across 5 files

@vieiralucas vieiralucas merged commit 6448979 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