Skip to content

feat: expand Java events to full cross-SDK taxonomy - #538

Merged
pratyush618 merged 6 commits into
masterfrom
feat/java-event-taxonomy
Jul 24, 2026
Merged

feat: expand Java events to full cross-SDK taxonomy#538
pratyush618 merged 6 commits into
masterfrom
feat/java-event-taxonomy

Conversation

@kartikeya-27

@kartikeya-27 kartikeya-27 commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Grows EventName from the 4 job-outcome constants to the 26-name cross-SDK taxonomy, keeping the existing API intact (first four constants keep their ordinals; Worker.Builder.on(EventName, Consumer<OutcomeEvent>) is unchanged).

  • Every constant carries its dotted wire name via wireName(); fromWire() also accepts the legacy success/retry/dead/cancelled aliases. fromKind() (JNI contract) is untouched.
  • New sealed TaskitoEvent interface with typed records (EnqueuedEvent, WorkerEvent, QueueEvent, WorkflowEvent, GateEvent, NodeCompensationEvent, PredicateEvent); OutcomeEvent implements it.
  • New queue-level subscription: taskito.onEvent(EventName, Consumer<TaskitoEvent>). Worker emitters chain to the queue hub, so queue-level listeners see worker events too.
  • job.failed fires per attempt before the retry decision; worker lifecycle events on start/online/stop/offline; enqueue, pause/resume, workflow submit/cancel/terminal/gate, and saga compensation all emit.
  • Webhook deliveries now use the dotted wire names ("event": "job.completed", was "success"); stored legacy subscriptions keep matching, and job-outcome bodies gain duration_ms. Non-outcome events deliver per-type snake_case bodies.
  • Emitter is lock-free thread-safe: every event name is pre-bound to a CopyOnWriteArrayList at construction, so dispatch never races registration.
  • Reserved: WORKER_UNHEALTHY (declared, not yet emitted) and WORKFLOW_COMPLETED_WITH_FAILURES (finalizer reports completed/failed today).

No JNI/Rust changes. 472 tests green, strict javadoc build green.

Part of #535.

Summary by CodeRabbit

  • New Features

    • Added SDK-wide event subscriptions for job, queue, worker, workflow, gate, and predicate activity.
    • Added lifecycle notifications for enqueueing, rejections, queue pause/resume, workflow execution, compensation, and worker status changes.
    • Added dotted event names for dashboards and webhooks, with support for legacy event aliases.
    • Expanded webhook payloads for non-job events and included job duration details where available.
  • Bug Fixes

    • Improved event delivery reliability when listeners fail.
    • Ensured worker failure notifications are emitted before retry outcomes.

@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@pratyush618, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 24 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 7f8f9a4c-1c9d-49d6-ad2c-d94aa6677914

📥 Commits

Reviewing files that changed from the base of the PR and between 0c1edab and 763a1a9.

📒 Files selected for processing (4)
  • sdks/java/src/main/java/org/byteveda/taskito/events/EventName.java
  • sdks/java/src/main/java/org/byteveda/taskito/events/OutcomeEvent.java
  • sdks/java/src/main/java/org/byteveda/taskito/worker/Worker.java
  • sdks/java/src/main/java/org/byteveda/taskito/workflows/WorkflowTracker.java
📝 Walkthrough

Walkthrough

The Java SDK adds a typed event taxonomy and emitter, exposes queue and worker subscriptions, emits enqueue, lifecycle, workflow, and compensation events, and updates dashboard/webhook handling to use wire names with legacy alias compatibility. Tests cover dispatch, payloads, ordering, and integrations.

Changes

SDK event system

Layer / File(s) Summary
Event contracts and taxonomy
sdks/java/src/main/java/org/byteveda/taskito/events/*
Adds TaskitoEvent, expanded EventName wire mappings, and typed records for queue, worker, workflow, gate, enqueue, predicate, and compensation events.
Emitter and queue event emission
sdks/java/src/main/java/org/byteveda/taskito/DefaultTaskito.java, sdks/java/src/main/java/org/byteveda/taskito/Taskito.java, sdks/java/src/main/java/org/byteveda/taskito/events/Emitter.java
Adds event subscriptions, typed dispatch with parent forwarding, and emissions for enqueue, predicate rejection, queue pause/resume, and workflow submission/cancellation.
Worker and workflow lifecycle propagation
sdks/java/src/main/java/org/byteveda/taskito/worker/*, sdks/java/src/main/java/org/byteveda/taskito/workflows/*
Wires shared emitters into workers and workflow trackers, emitting worker, job failure, gate, workflow, and saga compensation events.
Wire-name and webhook delivery integration
sdks/java/src/main/java/org/byteveda/taskito/dashboard/api/*, sdks/java/src/main/java/org/byteveda/taskito/webhooks/*
Uses dotted wire names, accepts legacy aliases, subscribes webhooks to typed events, and generates event-specific payloads.
Event behavior and integration validation
sdks/java/src/test/java/org/byteveda/taskito/{events,core,worker,workflows,contrib,dashboard}/*
Adds coverage for event contracts, dispatch behavior, queue and worker ordering, workflow lifecycle events, webhook compatibility, payloads, and dashboard event types.

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

Possibly related PRs

  • ByteVeda/taskito#537: Implements the corresponding expanded event taxonomy and event hub in another SDK.
  • ByteVeda/taskito#341: Adds the predicate-gating paths where PredicateEvent is now emitted.
  • ByteVeda/taskito#335: Adds saga compensation behavior extended here with compensation lifecycle events.

Suggested labels: tests, workflows

Suggested reviewers: pratyush618

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 35.56% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: expanding Java events to a broader cross-SDK taxonomy.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/java-event-taxonomy

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.

@pratyush618
pratyush618 force-pushed the feat/java-event-taxonomy branch from 18eb887 to 0c1edab Compare July 24, 2026 08:36
@pratyush618

Copy link
Copy Markdown
Collaborator

@CodeRabbit full review

@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown
✅ Action performed

Full review finished.

@coderabbitai coderabbitai 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.

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@sdks/java/src/main/java/org/byteveda/taskito/events/EventName.java`:
- Around line 7-10: Update the EventName class Javadoc to describe the enum as
the runtime event taxonomy or available event names, rather than claiming every
value is currently emitted. Preserve the documentation about dotted cross-SDK
wire names and stable terminal-outcome ordinals, and explicitly avoid implying
that WORKER_UNHEALTHY or WORKFLOW_COMPLETED_WITH_FAILURES are emitted.

In `@sdks/java/src/main/java/org/byteveda/taskito/events/OutcomeEvent.java`:
- Line 4: Update the public constructors of OutcomeEvent to validate name before
assigning or exposing it through TaskitoEvent. Reject null and any unsupported
event names using the existing event-name validation mechanism, while preserving
valid-name behavior and ensuring invalid events cannot reach Emitter.emit.

In `@sdks/java/src/main/java/org/byteveda/taskito/worker/Worker.java`:
- Around line 493-496: Update the Worker.start flow around backend.startWorker,
bridge.bind, and the WORKER_STARTED/WORKER_ONLINE emissions so startWorker and
bridge.bind complete successfully before either lifecycle event is published.
Ensure WORKER_STARTED is not emitted when startWorker or binding fails, while
preserving the existing event order after successful startup.

In `@sdks/java/src/main/java/org/byteveda/taskito/workflows/WorkflowTracker.java`:
- Line 530: In the gate-handling flow around emit(new GateEvent(runId,
node.name)), register the gate timeout before emitting the WORKFLOW_GATE_REACHED
event. Preserve the existing timeout setup and cleanup behavior so synchronous
Worker.approveGate() calls can cancel the installed timer through forget().
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 9b6b9c63-7670-40c7-a3c4-6eeed08dc950

📥 Commits

Reviewing files that changed from the base of the PR and between 881a7f2 and 0c1edab.

📒 Files selected for processing (33)
  • sdks/java/src/main/java/org/byteveda/taskito/DefaultTaskito.java
  • sdks/java/src/main/java/org/byteveda/taskito/Taskito.java
  • sdks/java/src/main/java/org/byteveda/taskito/dashboard/api/OpsHandlers.java
  • sdks/java/src/main/java/org/byteveda/taskito/dashboard/api/WebhooksHandlers.java
  • sdks/java/src/main/java/org/byteveda/taskito/events/Emitter.java
  • sdks/java/src/main/java/org/byteveda/taskito/events/EnqueuedEvent.java
  • sdks/java/src/main/java/org/byteveda/taskito/events/EventName.java
  • sdks/java/src/main/java/org/byteveda/taskito/events/GateEvent.java
  • sdks/java/src/main/java/org/byteveda/taskito/events/NodeCompensationEvent.java
  • sdks/java/src/main/java/org/byteveda/taskito/events/OutcomeEvent.java
  • sdks/java/src/main/java/org/byteveda/taskito/events/PredicateEvent.java
  • sdks/java/src/main/java/org/byteveda/taskito/events/QueueEvent.java
  • sdks/java/src/main/java/org/byteveda/taskito/events/TaskitoEvent.java
  • sdks/java/src/main/java/org/byteveda/taskito/events/WorkerEvent.java
  • sdks/java/src/main/java/org/byteveda/taskito/events/WorkflowEvent.java
  • sdks/java/src/main/java/org/byteveda/taskito/events/package-info.java
  • sdks/java/src/main/java/org/byteveda/taskito/webhooks/Webhook.java
  • sdks/java/src/main/java/org/byteveda/taskito/webhooks/WebhookManager.java
  • sdks/java/src/main/java/org/byteveda/taskito/worker/Worker.java
  • sdks/java/src/main/java/org/byteveda/taskito/worker/WorkerDispatchBridge.java
  • sdks/java/src/main/java/org/byteveda/taskito/workflows/SagaOrchestrator.java
  • sdks/java/src/main/java/org/byteveda/taskito/workflows/WorkflowTracker.java
  • sdks/java/src/test/java/org/byteveda/taskito/contrib/WebhookTest.java
  • sdks/java/src/test/java/org/byteveda/taskito/core/QueueEventsTest.java
  • sdks/java/src/test/java/org/byteveda/taskito/dashboard/DashboardOpsTest.java
  • sdks/java/src/test/java/org/byteveda/taskito/events/EmitterTest.java
  • sdks/java/src/test/java/org/byteveda/taskito/events/EventNameTest.java
  • sdks/java/src/test/java/org/byteveda/taskito/events/OutcomeEventTest.java
  • sdks/java/src/test/java/org/byteveda/taskito/webhooks/WebhookPayloadTest.java
  • sdks/java/src/test/java/org/byteveda/taskito/worker/WorkerTest.java
  • sdks/java/src/test/java/org/byteveda/taskito/workflows/WorkflowGateTest.java
  • sdks/java/src/test/java/org/byteveda/taskito/workflows/WorkflowSagaTest.java
  • sdks/java/src/test/java/org/byteveda/taskito/workflows/WorkflowTest.java

Comment thread sdks/java/src/main/java/org/byteveda/taskito/events/EventName.java Outdated
Comment thread sdks/java/src/main/java/org/byteveda/taskito/worker/Worker.java Outdated
Comment thread sdks/java/src/main/java/org/byteveda/taskito/workflows/WorkflowTracker.java Outdated
@pratyush618
pratyush618 merged commit 14a244d into master Jul 24, 2026
19 checks passed
@pratyush618
pratyush618 deleted the feat/java-event-taxonomy branch July 24, 2026 10:41
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