Skip to content

Add tests for the player's permissions - #168

Merged
dmccoystephenson merged 1 commit into
mainfrom
feature/player-permissions-tests
Nov 16, 2026
Merged

dmccoystephenson merged 1 commit into
mainfrom
feature/player-permissions-tests

Conversation

@dmccoystephenson

Copy link
Copy Markdown
Member

Summary

  • PlayerPermissionsTest is added, the player-mode counterpart of ConsolePermissionsTest. Before this, nothing tested Player, the permission gate that keeps player mode away from console-only commands.
  • The tests lock in current behavior: a player holds the permissions for help, save and quit, and holds none of the 11 console-only command permissions. Every command the player help text lists is permitted. LocalCommandService refuses a console-only command (wipe) with the permission message before the command runs, and help runs for a player.
  • No production code is changed. The new file has no copyright header, to match the recent test files (see Per-file copyright headers cite Apache License 2.0 while LICENSE is Stephenson-NC #104).

Test plan

  • mvn -B test: 241 tests run, 0 failures, 0 errors (6 of them new).
  • Mutation check: Player was temporarily given interakt.wipe. testPlayerHasNoPermissionForAnyConsoleOnlyCommand and testConsoleOnlyCommandIsRefusedBeforeItRuns then failed. The change was reverted afterward.

Deferred issues

No tracking issue: this is a Stage B test-expansion cycle. The gap was found during triage.

This PR description was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).

🤖 Generated with Claude Code


drafted by Claude on behalf of Daniel Stephenson

@dmccoystephenson

Copy link
Copy Markdown
Member Author

Self-review rubric (anchor: local mvn -B test ran 241 tests with 0 failures and 0 errors, and the CI build-and-deploy check passed on 109637d):

Findings:

  • src/main/java/dansapps/interakt/tests/PlayerPermissionsTest.java:99: message.substring(0, message.indexOf(" - ")) assumes every player-help line contains -. If the help format changes, this test throws StringIndexOutOfBoundsException instead of failing with an assertion message. A failure would still show up, so the code is left as is.
  • src/main/java/dansapps/interakt/tests/PlayerPermissionsTest.java:43: the console-only command list is written out by hand, the same way ConsolePermissionsTest does it. A command added to Interakt#getCommands() without updating this list would not be caught. This is an existing pattern and is not changed here.

Verdict: ready to merge. This is a test-only change with a green anchor, and no path on the do-not-auto-merge list is touched.

This review comment was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).


drafted by Claude on behalf of Daniel Stephenson

@dmccoystephenson
dmccoystephenson merged commit 0c0f390 into main Nov 16, 2026
1 check passed
@dmccoystephenson
dmccoystephenson deleted the feature/player-permissions-tests branch November 16, 2026 02:52
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