Skip to content

Add %votes% count to AnySite rewards - #1787

Merged
BenCodez merged 1 commit into
masterfrom
feature/offline-typed-command-batching
Dec 4, 2026
Merged

BenCodez merged 1 commit into
masterfrom
feature/offline-typed-command-batching

Conversation

@BenCodez

@BenCodez BenCodez commented Dec 4, 2026 •

Copy link
Copy Markdown
Owner

AnySite rewards can now use %votes% in ordinary commands: 1 for an immediate invocation, or the captured queue size when queued votes are delivered. For example, crazycrates give virtual Vote %votes% %player% requests 149 keys once for a captured batch of 149 entries. No commands are automatically rewritten or collected.

The count includes all captured sites and excludes later arrivals. AnySite conditions/random rolls remain once per invocation; administrators must remove equivalent per-site grants to avoid duplicates. Existing site order, asynchronous completion, pending recovery and default configurations remain unchanged. This covers the Bukkit/Paper/Folia AnySite path; external delivery and live platform acceptance remain unverified.

Validation: new regressions fail on the base (missing immediate count and unresolved queued quantity); 34 focused tests pass. Offline normal clean package passes 3435 unit tests (one skipped) and 8 packaged-artifact checks. Tests mock the reward handler and verify option propagation, existing placeholder expansion, queue/completion boundaries, mixed sites, later arrivals, player isolation and denial/default semantics; they do not prove native command dispatch or recipient-plugin delivery. JAR: 11,132,746 bytes, above the advisory 10 MiB target. No dependency changes.

Related to #1786.

Summary by CodeRabbit

  • New Features
    • AnySite rewards can use a %votes% placeholder to reflect the number of votes in the current reward invocation.
  • Documentation
    • Added guidance on how the vote count works for immediate rewards and offline vote batches.

@coderabbitai

coderabbitai Bot commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

AnySite rewards now receive a votes value: the captured batch size during offline replay, or 1 for immediate rewards. Tests cover replay and invocation behavior. New documentation describes the placeholder and its scope.

Changes: AnySite vote counts

Layer / File(s) Summary
Offline replay count
VotingPlugin/src/main/java/com/bencodez/votingplugin/user/VotingPluginUser.java, VotingPlugin/src/test/java/com/bencodez/votingplugin/tests/user/VotingPluginUserOfflineVoteReplayTest.java, docs/anysite-vote-count.md
Offline replay snapshots the queued votes and passes the batch size to AnySite rewards. Tests cover denied rewards, captured batches, votes arriving during replay, and empty queues. The documentation describes %votes% and its offline replay behavior.
Immediate reward count
VotingPlugin/src/main/java/com/bencodez/votingplugin/user/VotingPluginUser.java, VotingPlugin/src/test/java/com/bencodez/votingplugin/tests/user/VotingPluginUserOfflineVoteReplayTest.java
Immediate AnySite rewards pass a count of 1. Tests cover the online flag and isolation of counts between players and invocations.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature

Possibly related issues

  • BenCodez/VotingPlugin#1786 — The change passes the captured queued-vote count to one AnySite reward command, which overlaps with the issue’s queued-vote delivery objective. It does not add the issue’s proposed opt-in batching configuration.
Merge Risk: Minimal · up to 0535c

This change adds a %votes% placeholder for AnySite rewards. It resolves to the captured batch size when queued votes are delivered, and to 1 for immediate rewards. Existing behavior and default configurations stay the same. No merge-blocking risk was found in the supplied evidence.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change: adding a %votes% placeholder to AnySite rewards. The raw summary and objectives confirm that %votes% resolves to 1 for immediate invocations and to the captured queue …
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.
Full details: Title check

Explanation

The title names the main change: adding a %votes% placeholder to AnySite rewards. The raw summary and objectives confirm that %votes% resolves to 1 for immediate invocations and to the captured queue size for offline vote batches. The title is concise and specific, and a teammate scanning history would understand the primary change.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1292a37a-3b2e-4627-b007-c2d997ac36a4
Commits

Reviewing files that changed from the base of the PR and between 4f593d3 and 0535c2b.

Files selected for processing: 3

  • VotingPlugin/src/main/java/com/bencodez/votingplugin/user/VotingPluginUser.java
  • VotingPlugin/src/test/java/com/bencodez/votingplugin/tests/user/VotingPluginUserOfflineVoteReplayTest.java
  • docs/anysite-vote-count.md

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

Recent review details

Context from checks skipped due to timeout: 4

  • GitHub Check: CodeRabbit
  • GitHub Check: build
  • GitHub Check: Analyze (actions)
  • GitHub Check: Analyze (java-kotlin)
Additional context used

Code guidelines: 1

AGENTS.md — auto-discovered
Path-based instructions: 1

Source excerpt: All Java project tests and test-only helpers belong under `VotingPlugin/src/test/java/com/bencodez/votingplugin/tests/`, with package `com.bencodez.votingplugin.tests` or a meaningful subpackage.

CodeRabbit inference engine (AGENTS.md)

Files:

  • VotingPlugin/src/test/java/com/bencodez/votingplugin/tests/user/VotingPluginUserOfflineVoteReplayTest.java
Learnings: 5

Learning: 2026-11-16T03:11:41.053Z

Learnt from: CR
Repo: BenCodez/VotingPlugin PR: 0
File: .github/skills/code-review/SKILL.md:0-0
Timestamp: 2026-11-16T03:11:41.053Z
Learning: Source excerpt:
# VotingPlugin code review

## 3. Trace changed behavior and its contracts

### VotingPlugin voting and network behavior

- Trace vote receipt through service-site resolution, validation, routing, storage,
  totals/points, rewards, and broadcasts. Check duplicates, offline delivery,
  disconnects, replay, and partial failure for lost or repeated effects. Inspect
  the actual Votifier/AdvancedCore/SimpleAPI boundary rather than assuming another
  component performs validation or guarantees exactly-once delivery.

Applied to files:

  • VotingPlugin/src/main/java/com/bencodez/votingplugin/user/VotingPluginUser.java
  • VotingPlugin/src/test/java/com/bencodez/votingplugin/tests/user/VotingPluginUserOfflineVoteReplayTest.java
Learning: 2026-11-16T03:12:12.291Z

Learnt from: CR
Repo: BenCodez/VotingPlugin PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-11-16T03:12:12.291Z
Learning: Applies to VotingPlugin/src/test/java/com/bencodez/votingplugin/tests/** : Source excerpt:
# Maintainer and AI-agent guide

## Build and verification

All Java project tests and test-only helpers belong under `VotingPlugin/src/test/java/com/bencodez/votingplugin/tests/`, with package `com.bencodez.votingplugin.tests` or a meaningful subpackage. Keep paths and package declarations aligned, and update cross-test imports, resources, and build selectors when moving tests. Preserve package-phase artifact checks and test discovery. Do not widen production APIs to make tests accessible; use narrowly scoped test-only reflection for non-public seams. Platform API fixtures that must retain an external runtime class identity (such as `net.minecraft.network.chat.Component`) stay in that platform package and must not contain test cases.

Applied to files:

  • VotingPlugin/src/test/java/com/bencodez/votingplugin/tests/user/VotingPluginUserOfflineVoteReplayTest.java
Learning: 2026-11-16T03:12:12.291Z

Learnt from: CR
Repo: BenCodez/VotingPlugin PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-11-16T03:12:12.291Z
Learning: Source excerpt:
# Maintainer and AI-agent guide

## Build and verification

All Java project tests and test-only helpers belong under `VotingPlugin/src/test/java/com/bencodez/votingplugin/tests/`, with package `com.bencodez.votingplugin.tests` or a meaningful subpackage. Keep paths and package declarations aligned, and update cross-test imports, resources, and build selectors when moving tests. Preserve package-phase artifact checks and test discovery. Do not widen production APIs to make tests accessible; use narrowly scoped test-only reflection for non-public seams. Platform API fixtures that must retain an external runtime class identity (such as `net.minecraft.network.chat.Component`) stay in that platform package and must not contain test cases.

Applied to files:

  • VotingPlugin/src/test/java/com/bencodez/votingplugin/tests/user/VotingPluginUserOfflineVoteReplayTest.java
Learning: 2026-11-16T03:11:41.053Z

Learnt from: CR
Repo: BenCodez/VotingPlugin PR: 0
File: .github/skills/code-review/SKILL.md:0-0
Timestamp: 2026-11-16T03:11:41.053Z
Learning: Source excerpt:
# VotingPlugin code review

## 3. Trace changed behavior and its contracts

### VotingPlugin voting and network behavior

- Trace proxy/backend ownership, pending-vote caches, acknowledgements,
  deduplication, shared storage, and mixed-version peers. Check player-absent
  behavior for plugin messaging and reconnect behavior for applicable transports.
  Review only methods implemented in the pinned snapshot; do not assume a planned
  transport or an open PR has already shipped.

Applied to files:

  • VotingPlugin/src/test/java/com/bencodez/votingplugin/tests/user/VotingPluginUserOfflineVoteReplayTest.java
Learning: 2026-11-16T03:12:12.291Z

Learnt from: CR
Repo: BenCodez/VotingPlugin PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-11-16T03:12:12.291Z
Learning: Source excerpt:
# Maintainer and AI-agent guide

## Proxy vote lifecycle and durability invariants

- For graceful lifecycle, retry, scheduler, reload, shutdown-handoff, and restart-replay paths, preserve exactly-once
  vote effects across totals, points, streaks, VoteParty, rewards, broadcasts, backend delivery, and completion
  acknowledgement. Stable vote IDs and durable completion fences must prevent duplicates caused by those recoverable
  paths. Do not claim universal exactly-once semantics for arbitrary external side effects: if a reward/command succeeds
  and the process hard-crashes before its completion record is durably persisted, recovery may repeat that effect. Treat
  that as the documented hard-crash transaction boundary, not as an acceptable graceful-lifecycle loss/duplication path.

Applied to files:

  • docs/anysite-vote-count.md

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 4, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-12-04T01:36:11.866858Z 0535c2b PR opened
🔒 Security Review ✅ Completed 2026-12-04T01:37:39.251279Z 0535c2b PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@BenCodez
BenCodez merged commit 361a890 into master Dec 4, 2026
6 checks passed
@BenCodez
BenCodez deleted the feature/offline-typed-command-batching branch December 4, 2026 01:39
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