Skip to content

fix(autostart.lic): v0.68 force Account.subscription population#2299

Open
mrhoribu wants to merge 2 commits intomasterfrom
fix/autostart-v0.68
Open

fix(autostart.lic): v0.68 force Account.subscription population#2299
mrhoribu wants to merge 2 commits intomasterfrom
fix/autostart-v0.68

Conversation

@mrhoribu
Copy link
Copy Markdown
Contributor

@mrhoribu mrhoribu commented Apr 20, 2026

Updated version to 0.68 and added changelog entry for subscription handling.

Summary by CodeRabbit

  • Version Updates

    • Updated to version 0.68
  • Improvements

    • Improved account subscription information retrieval and initialization during application startup for better performance
    • Enhanced detection of your game environment to ensure subscription data is correctly accessed and properly loaded
    • Better reporting of subscription status information for improved visibility into your current account details and status

Updated version to 0.68 and added changelog entry for subscription handling.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 20, 2026

Warning

Rate limit exceeded

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

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 53 minutes and 38 seconds.

⌛ 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: 3b252b94-cbea-4f6f-8e4f-6968de3f5674

📥 Commits

Reviewing files that changed from the base of the PR and between 56894d7 and 32b11a0.

📒 Files selected for processing (1)
  • scripts/autostart.lic
📝 Walkthrough

Walkthrough

Version bump from 0.67 to 0.68 with added startup-time conditional logic that populates Account.subscription for newer Lich5 by issuing game-specific XML commands before existing initialization sequences.

Changes

Cohort / File(s) Summary
Script Version & Startup Logic
scripts/autostart.lic
Bumped version to 0.68 and added changelog entry. Introduced conditional block at startup that checks if Lich::Common::Account.subscription is nil, issues game-specific XML commands (DR* vs GS*), waits for response, and reports detected subscription value.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: a version bump to 0.68 and a fix ensuring Account.subscription is populated in autostart.lic.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/autostart-v0.68

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.

Copy link
Copy Markdown
Contributor

@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

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@scripts/autostart.lic`:
- Around line 85-95: The subscription-detection block runs on every autostart
and contains a broken regexp for GS; wrap the entire block that checks
Lich::Common::Account.subscription in a guard that only runs at startup (check
script.vars.empty?) and fix the GS regexp passed to Lich::Util.issue_command by
escaping the closing slash in the XML tag so the literal is valid (adjust the
/<output class="mono"/>/ pattern accordingly); keep the existing DR branch using
XMLData.game and the Lich::Common::Account.subscription lookup and ensure the
respond/waitrt?/case/when/.../end structure is wholly inside the
script.vars.empty? guard.
🪄 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: 7172259a-88cc-4f8b-9383-cdb99274f705

📥 Commits

Reviewing files that changed from the base of the PR and between c7f5d11 and 56894d7.

📒 Files selected for processing (1)
  • scripts/autostart.lic

Comment thread scripts/autostart.lic
Comment on lines +85 to +95
if defined?(Lich::Common::Account) && Lich::Common::Account.subscription.nil?
respond "Retrieving Account subscription information due to currently undetected!"
waitrt?
case XMLData.game
when /^DR/i
Lich::Util.issue_command("PLAYED", /^Account Info for /, /<prompt/, include_end: true, timeout: 5, silent: false, usexml: true, quiet: true)
when /^GS/i
Lich::Util.issue_command("ACCOUNT", /<output class="mono"/>/, /<prompt/, include_end: true, timeout: 5, silent: false, usexml: true, quiet: true)
end
respond "Account subscription detected as #{Lich::Common::Account.subscription}"
end
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Verify the LIC file parses after fixing the regexp literal.
ruby -c scripts/autostart.lic

Repository: elanthia-online/scripts

Length of output: 430


🏁 Script executed:

# Read the context around lines 85-95 to verify the subscription block
sed -n '80,100p' scripts/autostart.lic | cat -n

Repository: elanthia-online/scripts

Length of output: 1041


🏁 Script executed:

# Read the context around line 129 to understand the break statement issue
sed -n '125,135p' scripts/autostart.lic | cat -n

Repository: elanthia-online/scripts

Length of output: 548


🏁 Script executed:

# Check the full file structure to understand script.vars.empty? usage patterns
rg -n "script\.vars\.empty\?" scripts/autostart.lic

Repository: elanthia-online/scripts

Length of output: 92


🏁 Script executed:

# Create a test file with the proposed fixes applied
cat > /tmp/autostart_test.lic << 'EOF'
if script.vars.empty? && defined?(Lich::Common::Account) && Lich::Common::Account.subscription.nil?
  respond "Retrieving Account subscription information due to currently undetected!"
  waitrt?
  case XMLData.game
  when /^DR/i
    Lich::Util.issue_command("PLAYED", /^Account Info for /, /<prompt/, include_end: true, timeout: 5, silent: false, usexml: true, quiet: true)
  when /^GS/i
    Lich::Util.issue_command("ACCOUNT", %r{<output class="mono"/>}, /<prompt/, include_end: true, timeout: 5, silent: false, usexml: true, quiet: true)
  end
  respond "Account subscription detected as #{Lich::Common::Account.subscription}"
end

# Include the line 129 context to test if both errors resolve
if script.vars.empty?
  sleep 0.5
  200.times { sleep 0.1; break if !running?('repository') }
end
EOF
ruby -c /tmp/autostart_test.lic

Repository: elanthia-online/scripts

Length of output: 76


🏁 Script executed:

# Also verify the guard is used consistently elsewhere in the file
rg -B2 -A2 "script\.vars\.empty\?" scripts/autostart.lic | head -40

Repository: elanthia-online/scripts

Length of output: 195


Fix the GS regexp syntax and guard the subscription lookup for startup-only.

Line 92 has a syntax error: the / in "/> terminates the regexp literal. Additionally, the subscription block runs for all autostart invocations, including administrative commands like list, add, remove, and help when the subscription is nil, causing unexpected game commands to be issued. Guard the entire block with script.vars.empty? so the lookup only runs during startup.

Proposed fix
-if defined?(Lich::Common::Account) && Lich::Common::Account.subscription.nil?
+if script.vars.empty? && defined?(Lich::Common::Account) && Lich::Common::Account.subscription.nil?
   respond "Retrieving Account subscription information due to currently undetected!"
   waitrt?
   case XMLData.game
   when /^DR/i
     Lich::Util.issue_command("PLAYED", /^Account Info for /, /<prompt/, include_end: true, timeout: 5, silent: false, usexml: true, quiet: true)
   when /^GS/i
-    Lich::Util.issue_command("ACCOUNT", /<output class="mono"/>/, /<prompt/, include_end: true, timeout: 5, silent: false, usexml: true, quiet: true)
+    Lich::Util.issue_command("ACCOUNT", %r{<output class="mono"/>}, /<prompt/, include_end: true, timeout: 5, silent: false, usexml: true, quiet: true)
   end
   respond "Account subscription detected as #{Lich::Common::Account.subscription}"
 end
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if defined?(Lich::Common::Account) && Lich::Common::Account.subscription.nil?
respond "Retrieving Account subscription information due to currently undetected!"
waitrt?
case XMLData.game
when /^DR/i
Lich::Util.issue_command("PLAYED", /^Account Info for /, /<prompt/, include_end: true, timeout: 5, silent: false, usexml: true, quiet: true)
when /^GS/i
Lich::Util.issue_command("ACCOUNT", /<output class="mono"/>/, /<prompt/, include_end: true, timeout: 5, silent: false, usexml: true, quiet: true)
end
respond "Account subscription detected as #{Lich::Common::Account.subscription}"
end
if script.vars.empty? && defined?(Lich::Common::Account) && Lich::Common::Account.subscription.nil?
respond "Retrieving Account subscription information due to currently undetected!"
waitrt?
case XMLData.game
when /^DR/i
Lich::Util.issue_command("PLAYED", /^Account Info for /, /<prompt/, include_end: true, timeout: 5, silent: false, usexml: true, quiet: true)
when /^GS/i
Lich::Util.issue_command("ACCOUNT", %r{<output class="mono"/>}, /<prompt/, include_end: true, timeout: 5, silent: false, usexml: true, quiet: true)
end
respond "Account subscription detected as #{Lich::Common::Account.subscription}"
end
🧰 Tools
🪛 GitHub Actions: Rubocop

[error] 92-92: Rubocop (Lint/Syntax) failed: unexpected ','; expected an expression after the operator. (Using Ruby 4.0 parser; configure TargetRubyVersion). Offense at: Lich::Util.issue_command("ACCOUNT", //, /<prompt/, include_end: true, timeout: 5, silent: false, usexml: true, quiet: true)

🪛 GitHub Actions: Valid Ruby Syntax

[error] 92-92: Ruby syntax error in scripts/autostart.lic during ruby -c $file: "unexpected ','; expected an expression after the operator".


[error] Command failed with exit code 1. CI step Run for file in scripts/autostart.lic; do ... ruby -c $file ... done failed due to the syntax error.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/autostart.lic` around lines 85 - 95, The subscription-detection block
runs on every autostart and contains a broken regexp for GS; wrap the entire
block that checks Lich::Common::Account.subscription in a guard that only runs
at startup (check script.vars.empty?) and fix the GS regexp passed to
Lich::Util.issue_command by escaping the closing slash in the XML tag so the
literal is valid (adjust the /<output class="mono"/>/ pattern accordingly); keep
the existing DR branch using XMLData.game and the
Lich::Common::Account.subscription lookup and ensure the
respond/waitrt?/case/when/.../end structure is wholly inside the
script.vars.empty? guard.

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