[scripts][dependency]Remove zombie autostart merge and obsolete autostart helpers from dependency.lic#7394
Conversation
Remove the CORE_AUTOSTART-gated block that contained: - A one-way merge of Settings['autostart'] into UserVars.autostart_scripts that made purged autostarts reappear on every login (the "zombie merge" bug) - handle_obsolete_autostart() -- now handled by autostart.lic - dr_obsolete_script?() -- utility only used within the removed block - autostart() / stop_autostart() -- no longer needed, autostart management is now via the YAML 'autostarts' setting - dependency_status() -- no longer needed These functions are now provided by core lich (autostart.lic handles the autostart loop, and the CORE_AUTOSTART sentinel in global_defs.rb gates this block). The ScriptManager class (also gated by CORE_GET_SETTINGS) references handle_obsolete_autostart, but both sentinels are defined together in global_defs.rb so ScriptManager is also skipped on the new core path -- no dangling references. Update existing specs to remove tests for deleted functions and add new spec file verifying the removal is complete and structural integrity of remaining gates is preserved. Also fix stale version assertions in the existing spec (3.0.0 -> 3.0.1, 5.16.2 -> 5.17.0). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughRemoved the CORE_AUTOSTART gate and in-loop obsolete-autostart handling, added a one‑time cleanup that clears and saves Settings['autostart'], replaced autostart-related helpers with deprecated stubs, bumped dependency/min versions, and added a comprehensive IncludeResolver test harness and cascading-include specs. ChangesAutostart Gate Removal & One‑Shot Cleanup
Include Resolution & Merge Behavior Tests
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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 |
The removed zombie merge left behind Settings['autostart'] entries in lich.db3 scoped to dependency.lic. These orphaned entries can never be read or cleared by users. Add a one-shot cleanup that clears and saves the key on first login, then becomes a no-op on subsequent logins. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move orphan cleanup and removal assertions from the separate dependency_autostart_removal_spec.rb into the existing dependency_spec.rb. One spec file per source file. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Bump $DEPENDENCY_VERSION from 3.0.1 to 3.1.0 for the autostart helpers removal and orphan cleanup - Rename misleading spec description to match what it actually asserts - Update version assertion in spec Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
autostart(), stop_autostart(), and dependency_status() now print deprecation messages pointing users to YAML 'autostarts' or the ;autostart add/remove/list commands. This avoids a bare NoMethodError for scripts or console calls that still reference the old API. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
✅ Actions performedFull review triggered. |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
spec/dependency_spec.rb (1)
1057-1063: ⚡ Quick winAssert the removed helper is no longer referenced anywhere.
These examples prove the definition is gone, but they still miss the remaining
handle_obsolete_autostart(script)call inScriptManager#start_scripts. Add a call-site assertion here so this suite fails on the current legacy-path regression too.Suggested spec tightening
it 'no longer defines handle_obsolete_autostart' do expect(DEP_SOURCE).not_to match(/^\s*def handle_obsolete_autostart/) + expect(DEP_SOURCE).not_to match(/\bhandle_obsolete_autostart\s*\(/) 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 `@spec/dependency_spec.rb` around lines 1057 - 1063, Add an assertion to the spec that ensures there are no call-sites left invoking the removed helper by checking DEP_SOURCE does not include "handle_obsolete_autostart(" (or the exact call "handle_obsolete_autostart(script)") so any remaining references in ScriptManager#start_scripts (or elsewhere) will fail the test; update the spec near the other negative-match examples (which reference DEP_SOURCE) to assert DEP_SOURCE does not match /handle_obsolete_autostart\(/ or include the literal call string.
🤖 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 `@dependency.lic`:
- Around line 956-972: ScriptManager#start_scripts still calls
handle_obsolete_autostart(script) which was removed; update start_scripts to
either remove that call or replace it with an inline obsolete-script check:
inside ScriptManager#start_scripts iterate scripts and for each script run an
inline check (e.g., if obsolete name pattern or legacy flag) that echoes/logs
the deprecation and migrates the entry to the new autostarts list (or skips it)
before continuing to start the script; remove any direct references to
handle_obsolete_autostart and ensure the new inline logic uses the same
logging/messages previously provided by handle_obsolete_autostart.
---
Nitpick comments:
In `@spec/dependency_spec.rb`:
- Around line 1057-1063: Add an assertion to the spec that ensures there are no
call-sites left invoking the removed helper by checking DEP_SOURCE does not
include "handle_obsolete_autostart(" (or the exact call
"handle_obsolete_autostart(script)") so any remaining references in
ScriptManager#start_scripts (or elsewhere) will fail the test; update the spec
near the other negative-match examples (which reference DEP_SOURCE) to assert
DEP_SOURCE does not match /handle_obsolete_autostart\(/ or include the literal
call string.
🪄 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: ed4d8326-675e-4ad6-a536-59b25d4e8b4f
📒 Files selected for processing (2)
dependency.licspec/dependency_spec.rb
start_scripts still called handle_obsolete_autostart(script) after the definition was removed, which would raise NoMethodError at runtime. Remove the dead call and broaden the spec assertion to catch any reference to handle_obsolete_autostart, not just the def line. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
CORE_AUTOSTART-gated block fromdependency.lic(lines 945-1013)Settings['autostart']intoUserVars.autostart_scriptsthat made purged autostarts reappear on every login (the "zombie merge" bug)handle_obsolete_autostart(),dr_obsolete_script?(),autostart(),stop_autostart(), anddependency_status()-- all superseded by core lich'sautostart.licand YAML-based autostart managementContext
The
CORE_AUTOSTARTsentinel is defined in lich-5'sglobal_defs.rbalongsideCORE_GET_SETTINGS. When running on core lich:autostart.lichandles the autostart loop and obsolete script detectionautostartssetting replacesUserVars.autostart_scriptsfor configurationScriptManager(inside theCORE_GET_SETTINGSgate) also referenceshandle_obsolete_autostart, but since both sentinels are defined together,ScriptManageris also skipped on the new core path -- no dangling referencesOn the legacy path (without core lich),
CORE_AUTOSTARTis not defined, so these functions were previously loaded. However, since lich-5 5.17.0 is now the minimum required version and the sentinels ship with it, the gated block is dead code.Test plan
rspec spec/dependency_spec.rb spec/dependency_autostart_removal_spec.rb)spec/dependency_autostart_removal_spec.rb(19 examples) verifies:dependency_spec.rbto remove tests for deleted functions and fix stale version assertionsrubocop -Aclean on all changed files🤖 Generated with Claude Code
Summary by CodeRabbit
Updates
Changes
Tests