Skip to content

Add admin commands to set or clear artifact muffle - #40

Merged
Drefvelin merged 2 commits into
mainfrom
feat/admin-artifact-muffle
Oct 1, 2026
Merged

Drefvelin merged 2 commits into
mainfrom
feat/admin-artifact-muffle

Conversation

@Drefvelin

@Drefvelin Drefvelin commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Add /magic artifact setmuffle <percent> and /magic artifact unmuffle for the held artifact.
  • Refresh artifact lore and reset the care timestamp when changing muffle.
  • Cover validation, persistence, lore updates, and tab completion.

Validation

  • mvn -B --no-transfer-progress clean verify -DskipTests=false -Dmaven.test.skip=false passed (445 tests and the 100% coverage gate).
  • The repository has no dev branch; this PR targets the latest main.

@coderabbitai

coderabbitai Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 7cf92f46-b554-4587-b955-466dbd3efc16

📥 Commits

Reviewing files that changed from the base of the PR and between 7c9dde1 and 0ead7e9.

📒 Files selected for processing (3)
  • src/main/java/net/tfminecraft/magic/artifact/ArtifactCareStore.java
  • src/test/java/net/tfminecraft/magic/CommandTest.java
  • src/test/java/net/tfminecraft/magic/artifact/ArtifactCareTest.java

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 6ea2e688-01c7-466c-aa91-61349cdee8f7

📥 Commits

Reviewing files that changed from the base of the PR and between 6102ac2 and 7c9dde1.

📒 Files selected for processing (3)
  • src/main/java/net/tfminecraft/magic/artifact/ArtifactCareStore.java
  • src/main/java/net/tfminecraft/magic/command/MagicCommand.java
  • src/main/resources/messages.yml

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


📝 Summary

Summary by CodeRabbit

  • New Features
    • Added /magic artifact setmuffle <percent> to set an artifact’s muffle level from 0% to 100%.
    • Added /magic artifact unmuffle to clear an artifact’s muffle level.
    • Added command completion and feedback for both options.

Walkthrough

Adds /magic artifact setmuffle and /magic artifact unmuffle. The commands validate the sender and held artifact, update its care data, and report the result.

Changes

Artifact Muffle Commands

Layer / File(s) Summary
Store muffle care data
src/main/java/net/tfminecraft/magic/artifact/ArtifactCareStore.java
Adds setMuffle to clamp and store the muffle value, update the care timestamp, and apply metadata and lore.
Set or clear muffle from commands
src/main/java/net/tfminecraft/magic/command/MagicCommand.java, src/main/resources/messages.yml
Adds command dispatch, validation, care-store updates, feedback, usage text, and tab completions for both subcommands.

Priority: ⬇️ Low

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

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  actor Player
  participant MagicCommand
  participant ArtifactCareStore
  Player->>MagicCommand: Run setmuffle or unmuffle
  MagicCommand->>ArtifactCareStore: Set muffle value and timestamp
  ArtifactCareStore-->>MagicCommand: Return update result
  MagicCommand->>Player: Update held item and report result
Loading

Suggested reviewers: ryanbarlow97

Merge Risk: ⚪ Minimal · up to 7c9dd

This adds admin commands to set or clear the held artifact's muffle value, with input validation, usage text and tab completion. No concrete merge-blocking risk was found.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 7c9dd

The commands preserve existing administrator checks and modify only the invoking player's held artifact. No unauthorized mutation was demonstrated, but concurrency and partial-failure behavior remain incompletely established.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • observed — Each command invocation targets the invoking player's main-hand artifact and writes it back to that same inventory slot. The handler accepts neither a target player nor an arbitrary artifact identifier.

Trust Boundaries and Controls

  • observed — The new operations inherit the existing administrator boundary, including its legacy permission alias. Existing setfill already permits held-artifact mutation through the same gate; the PR adds a capability within that permission class without adding a lower-privilege authorization route.
  • observed — Command input rejects NaN, infinity, and out-of-range percentages before reaching the store. The public store method itself relies on a clamp that preserves NaN; this is a weaker internal contract, not a demonstrated bypass through the new command.

Resilience and Maintainability Implications

  • inferred — Repeating the same authorized command resets the care interval again rather than preserving the original timestamp. A failure after metadata commit could leave an applied care change without completed lore refresh or command confirmation; no security escalation from that partial state was established.

Hardening Proposals

  • proposed — Enforce the finite-value invariant inside the public setter so future callers cannot persist NaN into care state and capacity calculations. This would strengthen the internal contract; the current command already validates finite input.
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


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

coderabbitai[bot]
coderabbitai Bot previously approved these changes Oct 1, 2026
@Drefvelin
Drefvelin merged commit d089e13 into main Oct 1, 2026
1 of 2 checks passed
@Drefvelin
Drefvelin deleted the feat/admin-artifact-muffle branch October 1, 2026 13:04
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