Skip to content

feat(streaming): add Kafka two-pass analysis service - #55

Merged
phodal merged 1 commit into
masterfrom
codex/issue-51-kafka-streaming
Aug 4, 2026
Merged

feat(streaming): add Kafka two-pass analysis service#55
phodal merged 1 commit into
masterfrom
codex/issue-51-kafka-streaming

Conversation

@phodal

@phodal phodal commented Aug 4, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • New Features

    • Added Kafka-based streaming analysis for code changes.
    • Produces raw AST, resolved AST, and diagnostic events.
    • Supports project state tracking, file updates and deletions, duplicate suppression, and exactly-once processing.
    • Added Java source analysis with same-package reference resolution.
    • Added Docker Compose configuration for local Kafka setup.
  • Documentation

    • Added setup instructions, event formats, topic details, configuration options, and operational guidance.
  • Tests

    • Added coverage for event routing, deduplication, state retention, resolution, and diagnostics.

@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 8cde375d-6091-4615-bea3-534305e73d67

📥 Commits

Reviewing files that changed from the base of the PR and between 83083ef and 03a20cf.

📒 Files selected for processing (15)
  • README.md
  • chapi-streaming/README.md
  • chapi-streaming/build.gradle.kts
  • chapi-streaming/compose.yaml
  • chapi-streaming/src/main/kotlin/chapi/streaming/ChapiStreamingApplication.kt
  • chapi-streaming/src/main/kotlin/chapi/streaming/analysis/SourceAnalyser.kt
  • chapi-streaming/src/main/kotlin/chapi/streaming/analysis/StreamingAnalysisEngine.kt
  • chapi-streaming/src/main/kotlin/chapi/streaming/analysis/StreamingState.kt
  • chapi-streaming/src/main/kotlin/chapi/streaming/kafka/ChapiStreamingProcessor.kt
  • chapi-streaming/src/main/kotlin/chapi/streaming/kafka/ChapiStreamingTopology.kt
  • chapi-streaming/src/main/kotlin/chapi/streaming/kafka/KafkaStreamingState.kt
  • chapi-streaming/src/main/kotlin/chapi/streaming/model/StreamingEvents.kt
  • chapi-streaming/src/test/kotlin/chapi/streaming/analysis/StreamingAnalysisEngineTest.kt
  • chapi-streaming/src/test/kotlin/chapi/streaming/kafka/ChapiStreamingTopologyTest.kt
  • settings.gradle.kts

📝 Walkthrough

Walkthrough

Adds the chapi-streaming Kafka Streams module. It analyzes code-change events, maintains project state, emits raw and resolved AST events, publishes diagnostics, supports deletes and deduplication, and documents local Kafka operation and configuration.

Changes

Kafka streaming analysis pipeline

Layer / File(s) Summary
Module contracts and runtime setup
settings.gradle.kts, chapi-streaming/build.gradle.kts, chapi-streaming/compose.yaml, chapi-streaming/src/main/kotlin/chapi/streaming/model/StreamingEvents.kt, chapi-streaming/src/main/kotlin/chapi/streaming/analysis/SourceAnalyser.kt, chapi-streaming/src/main/kotlin/chapi/streaming/analysis/StreamingState.kt, chapi-streaming/src/main/kotlin/chapi/streaming/ChapiStreamingApplication.kt, README.md, chapi-streaming/README.md
Adds the Gradle module, Kafka runtime setup, serialized event models, Java analyzer registration, state abstractions, application lifecycle, local Kafka configuration, and streaming API documentation.
Stateful source analysis
chapi-streaming/src/main/kotlin/chapi/streaming/analysis/StreamingAnalysisEngine.kt, chapi-streaming/src/test/kotlin/chapi/streaming/analysis/StreamingAnalysisEngineTest.kt
Validates and deduplicates events, updates project snapshots, performs raw and resolved analysis, handles deletes and failures, and emits diagnostics. Tests cover package resolution, re-resolution, package boundaries, and duplicate events.
Kafka topology and persistent processing
chapi-streaming/src/main/kotlin/chapi/streaming/kafka/*, chapi-streaming/src/test/kotlin/chapi/streaming/kafka/ChapiStreamingTopologyTest.kt
Builds the Kafka topology, persists processed events and project sources, validates record keys, and routes raw AST, resolved AST, and diagnostic outputs. Topology tests cover routing, deduplication, source retention, resolution, and invalid keys.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Producer
  participant ChapiStreamingProcessor
  participant StreamingAnalysisEngine
  participant KafkaStreamingState
  participant OutputTopics
  Producer->>ChapiStreamingProcessor: publish keyed CodeChangeEvent
  ChapiStreamingProcessor->>KafkaStreamingState: check event and load project state
  ChapiStreamingProcessor->>StreamingAnalysisEngine: analyze event
  StreamingAnalysisEngine->>KafkaStreamingState: update sources and processed-event state
  StreamingAnalysisEngine-->>ChapiStreamingProcessor: return AST and diagnostic events
  ChapiStreamingProcessor->>OutputTopics: publish raw, resolved, and diagnostic events
Loading
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/issue-51-kafka-streaming

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@phodal
phodal merged commit 03a20cf into master Aug 4, 2026
0 of 4 checks passed
@phodal
phodal temporarily deployed to github-pages August 4, 2026 14:49 — with GitHub Pages Inactive

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 03a20cf266

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

private val currentTimeMillis: () -> Long = System::currentTimeMillis,
) {
fun process(event: CodeChangeEvent): AnalysisBatch {
if (state.isProcessed(event.eventId)) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Do not deduplicate blank event IDs

When the first event with a blank eventId reaches validation, it is recorded under the empty string; every subsequent blank-ID event handled by the same task then hits this check and is silently discarded, even when it belongs to a different project or file. This suppresses the required validation diagnostics after one malformed message, so blank IDs should not be stored or checked as normal deduplication keys.

Useful? React with 👍 / 👎.

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