Skip to content

feat(java): enqueue decision gates and recipes#354

Merged
pratyush618 merged 2 commits into
masterfrom
feat/java-enqueue-decisions
Jul 2, 2026
Merged

feat(java): enqueue decision gates and recipes#354
pratyush618 merged 2 commits into
masterfrom
feat/java-enqueue-decisions

Conversation

@pratyush618

Copy link
Copy Markdown
Collaborator

What

Generalizes enqueue predicates into a richer gate that returns a decision, and adds reusable recipes — while keeping the boolean predicate(...) API working.

  • Sealed EnqueueDecision (org.byteveda.taskito.predicates): Allow / Skip(reason) / Defer(delay) / Reject(reason), with factories (incl. deferUntil(Instant)).
  • EnqueueGate functional interface — decide(PredicateContext) → EnqueueDecision. Taskito.gate(taskName, gate) registers one; predicate(...) now folds into a gate (true → Allow, false → Reject) so both share one gates map.
  • Evaluated at the single enqueue point after interceptors and onEnqueue middleware (so gates see the payload that will actually be enqueued — first non-Allow wins): RejectPredicateRejectedException; Skip → no job; Defer → applies the delay to the final options.
  • API: enqueue() throws EnqueueSkippedException on Skip; tryEnqueue() returns Optional<String> (empty on skip). Batch enqueueMany requires Allow (Skip/Defer can't be expressed per-item in one all-or-nothing batch → error), Reject fails the batch.
  • RecipesbusinessHours / timeWindow / dayOfWeek (defer to next open window), payloadMatches / featureFlag (skip), over a BooleanFlag seam.

Test

EnqueueDecisionTest (each outcome + tryEnqueue/enqueue behavior) and RecipesTest (each recipe).

./gradlew build green (JDK 17 build leg + 21/25 test legs).

@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 23 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

Run ID: c2f8a428-82b6-46b4-85e7-d819872d4b75

📥 Commits

Reviewing files that changed from the base of the PR and between c0bc4cc and abe33a5.

📒 Files selected for processing (9)
  • 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/errors/EnqueueSkippedException.java
  • sdks/java/src/main/java/org/byteveda/taskito/predicates/BooleanFlag.java
  • sdks/java/src/main/java/org/byteveda/taskito/predicates/EnqueueDecision.java
  • sdks/java/src/main/java/org/byteveda/taskito/predicates/EnqueueGate.java
  • sdks/java/src/main/java/org/byteveda/taskito/predicates/Recipes.java
  • sdks/java/src/test/java/org/byteveda/taskito/EnqueueDecisionTest.java
  • sdks/java/src/test/java/org/byteveda/taskito/RecipesTest.java
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/java-enqueue-decisions

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

@pratyush618 pratyush618 self-assigned this Jul 2, 2026
@pratyush618
pratyush618 merged commit 51d1ba0 into master Jul 2, 2026
18 checks passed
@pratyush618
pratyush618 deleted the feat/java-enqueue-decisions branch July 2, 2026 05:07
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