Skip to content

feat: audit log every successful chunk claim - #38

Merged
tastybento merged 1 commit into
developfrom
feature/claim-audit-logging
Aug 16, 2026
Merged

feat: audit log every successful chunk claim#38
tastybento merged 1 commit into
developfrom
feature/claim-audit-logging

Conversation

@tastybento

Copy link
Copy Markdown
Member

Summary

  • Logs a detailed audit line on every successful chunk claim: player name, UUID, exact position, look direction, action type (LEFT_CLICK_AIR vs LEFT_CLICK_BLOCK etc.), whether a block was clicked (vs air ray-trace), sneaking state, target chunk coords, distance from nearest border of the claimed chunk, confirmation setting, chunk count, and credit before/after
  • Changes attemptClaim return type from void to ClaimResult so the caller can react to the outcome

Context

A player reported two chunks being claimed while they were mining a cobble generator "nowhere near the chunk border" with no other island members online. With require-confirmation: true, an accidental claim requires four separate LEFT_CLICK_AIR events with sneaking on the 2nd and 4th — extremely unlikely but not impossible if the player was closer to a border than they realized.

The audit trail will capture the exact trigger conditions if this happens again. Key fields for investigation:

  • borderDist — was the player actually within 5 blocks of a locked chunk?
  • action — was it LEFT_CLICK_AIR (cobble-generator gap)?
  • sneaking — was the confirmation path involved?
  • clickedBlock — was there a block under the crosshair?

Example log output

CHUNK CLAIM: player=AiboPals uuid=abc-123 at=[108.5, 65.0, 200.3] yaw=90 pitch=15 action=LEFT_CLICK_AIR clickedBlock=false sneaking=true chunk=(7,13) offset=(1,0) borderDist=3.5 confirm=true count=8 credit=147->131

Test plan

  • All 727 existing tests pass (including 22 ChunkClaimListenerTest tests)
  • Deploy to test server, claim a chunk, verify audit line appears in console/log

🤖 Generated with Claude Code

https://claude.ai/code/session_01B94CWZDoiM9VevWtXb4RxF

Log player name, UUID, position, look direction, action type, whether a
block was clicked (vs air ray-trace), sneaking state, target chunk,
distance to the nearest border of the claimed chunk, confirmation
setting, chunk count, and credit before/after.

Motivated by a report of two chunks being claimed while the player was
mining a cobble generator "nowhere near the border". The audit trail
will reveal the exact trigger (LEFT_CLICK_AIR gap, border distance,
sneaking state) if this happens again.

Also changes attemptClaim to return ClaimResult so the caller can
react to the outcome.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B94CWZDoiM9VevWtXb4RxF
@sonarqubecloud

Copy link
Copy Markdown

@tastybento
tastybento merged commit fb70605 into develop Aug 16, 2026
3 checks passed
@tastybento
tastybento deleted the feature/claim-audit-logging branch August 16, 2026 23:45
@tastybento tastybento mentioned this pull request Aug 16, 2026
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