Skip to content

[scripts][healer] Make Link Unity not a hard requirement to run this script#7395

Merged
MahtraDR merged 4 commits into
elanthia-online:mainfrom
MahtraDR:feat/healer-optional-unity
May 5, 2026
Merged

[scripts][healer] Make Link Unity not a hard requirement to run this script#7395
MahtraDR merged 4 commits into
elanthia-online:mainfrom
MahtraDR:feat/healer-optional-unity

Conversation

@MahtraDR
Copy link
Copy Markdown
Collaborator

@MahtraDR MahtraDR commented May 5, 2026

Summary

  • Healer no longer exits when Link Unity is unavailable
  • Unity is an optional convenience for instant wound transfer -- the normal touch flow handles everything regardless
  • Only logs Unity availability when it IS available; silence otherwise (nothing noteworthy)

Changes

  • validate_link_unity: sets @unity_available flag instead of exiting; only messages when Unity is present
  • heal_patient: gates only the link <patient> unity command on @unity_available; separate log for hands/legs-only skip
  • Updated YARD doc to reflect Unity as optional
  • Added unity parameter to build_healer test helper (defaults to true)
  • Added specs for validate_link_unity (Unity present, absent, no spurious messaging)
  • Added specs for living patient Unity gating (with/without Unity, poison/disease unaffected)

Test plan

  • bundle exec rspec spec/healer_spec.rb -- 75 examples, 0 failures
  • rubocop -A healer.lic -- no offenses
  • rubocop -A spec/healer_spec.rb -- no offenses
  • In-game test with empath who knows Unity (should behave identically to before)
  • In-game test with empath who does NOT know Unity (should start normally, heal everything via standard touch flow)

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Startup validation no longer terminates unexpectedly when Link Unity is unavailable
    • Wound transfers now automatically use standard transfer methods as a fallback when Unity is unavailable

Lower-circle empaths who haven't learned the Unity manifestation of
Empathic Link were blocked from running the healer entirely. Now the
script warns and continues with wound transfers disabled while still
handling poison, disease, parasites, and vitality healing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 5, 2026

Warning

Rate limit exceeded

@MahtraDR has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 50 minutes and 47 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: af65a29e-071e-40e3-82ee-96dc765c9b15

📥 Commits

Reviewing files that changed from the base of the PR and between 679a890 and f3bcc58.

📒 Files selected for processing (2)
  • healer.lic
  • spec/healer_spec.rb
📝 Walkthrough

Walkthrough

The PR refactors Unity link validation to be non-fatal during startup, setting an @unity_available flag instead of exiting when Link Unity is unavailable. The healing flow is then gated by this flag, allowing wound transfers to proceed via the normal touch/transfer mechanism when Unity is unavailable.

Changes

Unity Availability Gating

Layer / File(s) Summary
State Management
healer.lic (lines 179–213)
validate_link_unity now assigns @unity_available based on whether the link command output includes UNITY; the only hard-fail is for non-empaths. Script proceeds with @unity_available = false when Unity is unavailable.
Healing Logic
healer.lic (lines 767–784)
heal_patient Unity link attempt for new living patients is gated by @unity_available && has_healable_wounds?. When Unity is unavailable, the script skips the Unity step and proceeds with normal wound transfer via touch/transfer flow.
Test Helpers & Coverage
spec/healer_spec.rb (lines 79–101)
build_healer helper now accepts a unity: parameter (default true) and explicitly sets @unity_available on the constructed Healer instance.
Tests
spec/healer_spec.rb (lines 414–528)
New test coverage validates that validate_link_unity toggles @unity_available based on command output, that Unity messaging is not attempted when unavailable, and that living patient healing with both Unity available and unavailable paths are exercised.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: making Link Unity optional rather than a hard requirement for the healer script to function.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.


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 and usage tips.

@MahtraDR MahtraDR changed the title Make Link Unity optional for lower-circle empaths [scripts][healer]Make Link Unity optional for lower-circle empaths May 5, 2026
@MahtraDR MahtraDR changed the title [scripts][healer]Make Link Unity optional for lower-circle empaths [scripts][healer] Make Link Unity not a hard requirement to run this script May 5, 2026
MahtraDR and others added 2 commits May 5, 2026 20:07
Unity is a faster instant-transfer method, not a gate for wound
transfers. Without it, wounds still transfer via normal touch flow.
Updated all messaging and log lines to reflect this accurately.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Unity is a convenience shortcut, not something worth warning about
when absent. The normal touch flow is the standard mechanism.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
healer.lic (1)

198-201: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Timeout path still hard-exits, so Unity is not fully optional at startup.

At Line 198, a transient link timeout still calls exit, which can stop empath healing entirely even though Unity is intended to be optional. Prefer falling back to @unity_available = false and continuing (while keeping the explicit non-empath exit path).

Proposed fix
-    unless lines
-      Lich::Messaging.msg('bold', 'Healer: ERROR - Could not check link abilities (timeout).')
-      exit
-    end
+    unless lines
+      `@unity_available` = false
+      Lich::Messaging.msg('bold', 'Healer: Could not verify Link Unity (timeout) — using normal touch transfer.')
+      return
+    end
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@healer.lic` around lines 198 - 201, The timeout branch currently calls exit
which hard-stops startup; change that path so instead of calling exit you set
`@unity_available` = false and continue startup (keep the
Lich::Messaging.msg('bold', 'Healer: ERROR - Could not check link abilities
(timeout).') log intact); ensure any other explicit non-empath exit logic
elsewhere still calls exit as before but this transient link timeout only flips
`@unity_available` and does not abort the process.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@spec/healer_spec.rb`:
- Around line 496-497: The negative expectation on DRC.bput is too permissive
because Unity calls use four arguments; update the matcher for the DRC bput
expectation (the call to expect(DRC).not_to receive(:bput)) to assert a
4-argument signature so Unity-style calls can't slip through—e.g., change the
with(...) to match the first arg (/link.*unity/i) and include three subsequent
argument matchers (anything, anything, anything) for the full command + 3
response patterns.

---

Outside diff comments:
In `@healer.lic`:
- Around line 198-201: The timeout branch currently calls exit which hard-stops
startup; change that path so instead of calling exit you set `@unity_available` =
false and continue startup (keep the Lich::Messaging.msg('bold', 'Healer: ERROR
- Could not check link abilities (timeout).') log intact); ensure any other
explicit non-empath exit logic elsewhere still calls exit as before but this
transient link timeout only flips `@unity_available` and does not abort the
process.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 106798bc-51a3-454b-8b1d-c8e0c6da1c31

📥 Commits

Reviewing files that changed from the base of the PR and between 9c77ab7 and 679a890.

📒 Files selected for processing (2)
  • healer.lic
  • spec/healer_spec.rb

Comment thread spec/healer_spec.rb Outdated
- Link timeout now sets @unity_available = false and returns instead
  of killing the healer. The non-empath check still exits.
- Tighten negative Unity bput expectations to match the full
  LINK_RESPONSES signature so regressions can't slip through.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@MahtraDR
Copy link
Copy Markdown
Collaborator Author

MahtraDR commented May 5, 2026

@coderabbitai Both findings addressed in f3bcc58:

1. Timeout hard-exit (major): validate_link_unity timeout now sets @unity_available = false and returns instead of calling exit. The non-empath check still exits as before.

2. Loose spec matcher (minor): Both negative Unity bput expectations (lines 395 and 496) now use *Healer::LINK_RESPONSES to match the full 4-argument call signature.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 5, 2026

Tip

For best results, initiate chat on the files or code changes.

@MahtraDR Thanks for the detailed confirmation! Both fixes look exactly right:

  1. Timeout handling — Gracefully degrading to @unity_available = false on timeout is the correct approach; the script keeps running and falls back to touch-transfer, while the non-empath hard-exit is preserved as intended.
  2. Spec matcher — Spreading *Healer::LINK_RESPONSES ensures the bput expectation captures the full call signature, making the negative assertion precise and future-proof if LINK_RESPONSES ever changes.

Great work on the fix! (ノ◕ヮ◕)ノ*:・゚✧

@MahtraDR MahtraDR merged commit 3f05b7b into elanthia-online:main May 5, 2026
4 checks passed
@MahtraDR MahtraDR deleted the feat/healer-optional-unity branch May 5, 2026 08:33
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