fix(autostart.lic): v0.68 force Account.subscription population#2299
fix(autostart.lic): v0.68 force Account.subscription population#2299
Conversation
Updated version to 0.68 and added changelog entry for subscription handling.
|
Warning Rate limit exceeded
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 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 configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughVersion bump from 0.67 to 0.68 with added startup-time conditional logic that populates Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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
📒 Files selected for processing (1)
scripts/autostart.lic
| 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 |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Description: Verify the LIC file parses after fixing the regexp literal.
ruby -c scripts/autostart.licRepository: 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 -nRepository: 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 -nRepository: 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.licRepository: 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.licRepository: 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 -40Repository: 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.
| 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.
Updated version to 0.68 and added changelog entry for subscription handling.
Summary by CodeRabbit
Version Updates
Improvements