Skip to content

Find living characters by real name - #108

Merged
ryanbarlow97 merged 2 commits into
mainfrom
stage6/find-by-name
Oct 13, 2026
Merged

ryanbarlow97 merged 2 commits into
mainfrom
stage6/find-by-name

Conversation

@ryanbarlow97

@ryanbarlow97 ryanbarlow97 commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Implements TLibs 2.5.0's CharacterIdentity.findByName(String) for stage 6a's typed-name vehicle whitelist, and pins TLibs 2.5.0.

  • CharacterIdentityService.findByName runs on the main thread, overlays every loaded account (the same live overlay info uses, so unsaved renames count), then scans the in-memory CharacterDirectory. No files are read per call.
  • CharacterDirectory.findByName returns every ALIVE character whose real name (CharacterInfo.name()) equals the trimmed query, ignoring case, as an immutable list. Dead and missing characters are excluded; quarantined accounts are skipped, as info skips them.
  • Aliases, masks and temporary aliases never match: only the canonical real name is compared.

Tests cover masked and aliased online players (match only on the real name), unsaved renames, offline saved characters, dead and missing characters excluded, several matches across accounts, quarantined accounts, no disk reads, and the main-thread check.

Gate: tfmc-mvn -o -B clean verify, 2,229 tests, 0 failures, 100% line coverage gate met. Intended release 2.19.0 (not tagged; installed locally only). CI will fail to resolve TLibs 2.5.0 until TLibs is released.

Depends on: TF-Minecraft/TLibs#45
Docs: TF-Minecraft/Docs#207

🤖 Generated with Claude Code

ryanbarlow97 and others added 2 commits October 13, 2026 01:01
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Implement CharacterIdentity.findByName: overlay every loaded account, as
info does, then scan the in-memory directory for ALIVE characters whose
real name equals the trimmed query, ignoring case. Aliases, masks and
temporary aliases never match, quarantined accounts are skipped and no
files are read.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added the size:S 10-29 effective changed lines (tests excluded in mixed PRs). label Oct 13, 2026
@coderabbitai

coderabbitai Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

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: 6e50aebd-c91d-4c09-8a13-acad96b8928e
📥 Commits

Reviewing files that changed from the base of the PR and between 802fc42 and 480190b.

📒 Files selected for processing (5)
  • pom.xml
  • src/main/java/net/tfminecraft/rpcharacters/identity/CharacterDirectory.java
  • src/main/java/net/tfminecraft/rpcharacters/identity/CharacterIdentityService.java
  • src/test/java/net/tfminecraft/rpcharacters/identity/CharacterDirectoryTest.java
  • src/test/java/net/tfminecraft/rpcharacters/identity/CharacterIdentityServiceTest.java

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

📝 Summary

Summary by CodeRabbit

  • New Features
    • Added character name search across loaded and offline owners. Searches ignore case and surrounding whitespace, return living characters only, and exclude quarantined accounts.
    • Search results reflect unsaved name changes and do not include aliases or masked display names.
  • Chores
    • Updated the library version.

The change adds real-name lookup for living characters to the character directory and identity service. The service refreshes directory entries from online accounts before lookup. Tests cover matching behaviour and thread enforcement. The TLibs dependency version changes to 2.5.0.

Changes: Character name lookup

Layer / File(s) Summary
Directory name lookup
src/main/java/net/tfminecraft/rpcharacters/identity/CharacterDirectory.java, src/test/java/net/tfminecraft/rpcharacters/identity/CharacterDirectoryTest.java
CharacterDirectory adds trimmed, case-insensitive name lookup for living characters. Tests cover filtering, immutable results, directory updates, and in-memory lookup.
Identity service lookup
src/main/java/net/tfminecraft/rpcharacters/identity/CharacterIdentityService.java, src/test/java/net/tfminecraft/rpcharacters/identity/CharacterIdentityServiceTest.java
CharacterIdentityService refreshes directory entries from online accounts before lookup. Tests cover loaded and offline characters, unsaved renames, deceased characters, and main-thread enforcement.

TLibs version update

Layer / File(s) Summary
TLibs version
pom.xml
The configured TLibs version changes from 2.4.1 to 2.5.0.

Priority: ⬇️ Low

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

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant CharacterIdentityService
  participant OnlineAccounts
  participant CharacterDirectory
  CharacterIdentityService->>OnlineAccounts: Read loaded characters
  OnlineAccounts-->>CharacterIdentityService: Return loaded characters
  CharacterIdentityService->>CharacterDirectory: Refresh entries
  CharacterIdentityService->>CharacterDirectory: Find matching name
  CharacterDirectory-->>CharacterIdentityService: Return matching characters
Loading
Merge Risk: 🔵 Low · up to 48019

The new name lookup looks self-contained and tested. CI builds will fail until TLibs 2.5.0 is published, so release that artifact before merging.

✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • 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

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

@ryanbarlow97
ryanbarlow97 merged commit c2d7b4d into main Oct 13, 2026
4 of 5 checks passed
@ryanbarlow97
ryanbarlow97 deleted the stage6/find-by-name branch October 13, 2026 09:58
@ryanbarlow97

Copy link
Copy Markdown
Contributor Author

Muse (independent reviewer) reviewed this PR after merge, against the stage 6a design: verdict OK. One minor note: findByName refreshes every loaded account before it scans, which suits its human-paced callers (staff takeover, typed whitelist entry) but not hot paths. A Javadoc note is a follow-up; v2.19.0 stands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 effective changed lines (tests excluded in mixed PRs).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant