Skip to content

Conversation

@nischitpra
Copy link
Collaborator

@nischitpra nischitpra commented Oct 30, 2025

Summary by CodeRabbit

  • Bug Fixes
    • Improved handling of invalid block data to prevent publishing incomplete or malformed messages.
    • Enhanced error detection with early validation checks to catch problematic data before processing.
    • Increased system reliability through better filtering and validation of published data.
    • Added comprehensive logging for data validation issues.

@coderabbitai
Copy link

coderabbitai bot commented Oct 30, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

The changes add nil-block filtering to the Kafka publisher. publishBlockData now initializes blockMessages as a dynamic slice, skips nil blocks with warnings, and returns nil if no valid messages remain. createBlockDataMessage adds an early nil-check.

Changes

Cohort / File(s) Summary
Kafka publisher nil-block handling
internal/storage/kafka_publisher.go
Modifies publishBlockData to filter out nil blocks by appending valid messages to a dynamically-sized slice instead of indexing by original position. Logs warnings for skipped nil blocks and returns nil if no valid messages remain. Adds early nil-check in createBlockDataMessage to return an error if the input block is nil. Preserves duration metric logging and error handling for message creation failures.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

  • Single-file change with consistent nil-checking pattern applied across two functions
  • Defensive programming additions are straightforward but require verification that slice append behavior doesn't affect message ordering or downstream processing expectations
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch np/nil_block

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 98849e3 and 2cf5905.

📒 Files selected for processing (1)
  • internal/storage/kafka_publisher.go (2 hunks)

Comment @coderabbitai help to get the list of available commands and usage tips.

@nischitpra nischitpra merged commit 385f7d7 into main Oct 30, 2025
4 of 5 checks passed
@nischitpra nischitpra deleted the np/nil_block branch October 30, 2025 19:27
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.

2 participants