Skip to content

[scripts][dependency]Remove zombie autostart merge and obsolete autostart helpers from dependency.lic#7394

Merged
MahtraDR merged 8 commits into
elanthia-online:mainfrom
MahtraDR:fix/remove-autostart-zombie-merge
May 5, 2026
Merged

[scripts][dependency]Remove zombie autostart merge and obsolete autostart helpers from dependency.lic#7394
MahtraDR merged 8 commits into
elanthia-online:mainfrom
MahtraDR:fix/remove-autostart-zombie-merge

Conversation

@MahtraDR
Copy link
Copy Markdown
Collaborator

@MahtraDR MahtraDR commented May 4, 2026

Summary

  • Remove the CORE_AUTOSTART-gated block from dependency.lic (lines 945-1013)
  • The block contained a one-way merge of Settings['autostart'] into UserVars.autostart_scripts that made purged autostarts reappear on every login (the "zombie merge" bug)
  • Also removes now-obsolete helper functions: handle_obsolete_autostart(), dr_obsolete_script?(), autostart(), stop_autostart(), and dependency_status() -- all superseded by core lich's autostart.lic and YAML-based autostart management

Context

The CORE_AUTOSTART sentinel is defined in lich-5's global_defs.rb alongside CORE_GET_SETTINGS. When running on core lich:

  • autostart.lic handles the autostart loop and obsolete script detection
  • The YAML autostarts setting replaces UserVars.autostart_scripts for configuration
  • ScriptManager (inside the CORE_GET_SETTINGS gate) also references handle_obsolete_autostart, but since both sentinels are defined together, ScriptManager is also skipped on the new core path -- no dangling references

On the legacy path (without core lich), CORE_AUTOSTART is 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

  • All 123 existing + new specs pass (rspec spec/dependency_spec.rb spec/dependency_autostart_removal_spec.rb)
  • New spec/dependency_autostart_removal_spec.rb (19 examples) verifies:
    • CORE_AUTOSTART gate and zombie merge code are fully removed
    • All five removed helper functions are absent
    • Remaining gates (CORE_GET_SETTINGS, CORE_DR_STARTUP, CORE_SCRIPT_LOADER, CORE_MAP_OVERRIDES) are still intact
    • Structural integrity: ScriptManager gate and CORE_DR_STARTUP gate are adjacent with no code between them
  • Updated existing dependency_spec.rb to remove tests for deleted functions and fix stale version assertions
  • rubocop -A clean on all changed files

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Updates

    • Version bumped to 3.1.0; minimum Lich version requirement updated to 5.17.0
  • Changes

    • One-time cleanup clears legacy autostart settings; legacy autostart commands now emit deprecation warnings
    • Improved include/dependency resolution to handle deep nesting, duplicates, circular references, and complex scenarios with deterministic ordering
  • Tests

    • Expanded tests covering include resolution, autostart cleanup, deprecation warnings, and version checks

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>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 4, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 534baee7-567c-4d47-8d1c-cddf79d80f44

📥 Commits

Reviewing files that changed from the base of the PR and between e809590 and a521360.

📒 Files selected for processing (2)
  • dependency.lic
  • spec/dependency_spec.rb

📝 Walkthrough

Walkthrough

Removed 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.

Changes

Autostart Gate Removal & One‑Shot Cleanup

Layer / File(s) Summary
Version Bump
dependency.lic
$DEPENDENCY_VERSION updated 3.0.13.1.0.
Core Removal
dependency.lic
Removed CORE_AUTOSTART gate and the exported helpers handle_obsolete_autostart(script) and dr_obsolete_script?(name).
One‑Shot Cleanup
dependency.lic
Added one-time startup block: if Settings['autostart'] exists, print messages, set Settings['autostart'] = nil, and call Settings.save.
Deprecated Stubs
dependency.lic
Kept exported helpers with same signatures but replaced implementations with deprecation stubs that print notices: autostart(script_names, _global = true), stop_autostart(script_names), dependency_status.
ScriptManager Change
dependency.lic
Removed per-script next if handle_obsolete_autostart(script) check from ScriptManager#start_scripts loop.
Tests / Assertions Updated
spec/dependency_spec.rb
Replaced CORE_AUTOSTART expectations with assertions that the gate and obsolete helpers are removed; added tests for the one-shot cleanup, for deprecation messages from stubbed helpers, and updated version/min-version assertions.

Include Resolution & Merge Behavior Tests

Layer / File(s) Summary
Test Harness Added
spec/dependency_spec.rb
Introduced IncludeResolver class and helpers to simulate include files and drive include-resolution tests.
Include Resolution Algorithm
spec/dependency_spec.rb
Added comprehensive cascading-include specs covering depth-first ordering, diamond graphs without duplicates, circular/self-references, missing/nil include keys, deep nesting, and a large real-world include graph.
Union Keys / Merge Behavior
spec/dependency_spec.rb
Added tests for union_keys behavior (array union + deduplication, precedence, and fallthrough for non-array values).
Extraction / Sentinel Tests
spec/dependency_spec.rb
Adjusted gate extraction tests to remove CORE_AUTOSTART from extractable gates and to assert other sentinel gates remain extractable; narrowed extraction used by spec harness.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

🚥 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 describes the main change: removal of the zombie autostart merge and obsolete autostart helpers from dependency.lic.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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

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 and others added 3 commits May 4, 2026 17:37
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>
@MahtraDR MahtraDR changed the title Remove zombie autostart merge and obsolete autostart helpers from dependency.lic [scripts][dependency]Remove zombie autostart merge and obsolete autostart helpers from dependency.lic May 4, 2026
MahtraDR and others added 2 commits May 4, 2026 19:15
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>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 5, 2026

✅ Actions performed

Full review triggered.

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

🧹 Nitpick comments (1)
spec/dependency_spec.rb (1)

1057-1063: ⚡ Quick win

Assert 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 in ScriptManager#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

📥 Commits

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

📒 Files selected for processing (2)
  • dependency.lic
  • spec/dependency_spec.rb

Comment thread dependency.lic
@elanthia-online elanthia-online deleted a comment from coderabbitai Bot May 5, 2026
@elanthia-online elanthia-online deleted a comment from coderabbitai Bot May 5, 2026
@elanthia-online elanthia-online deleted a comment from coderabbitai Bot May 5, 2026
@elanthia-online elanthia-online deleted a comment from coderabbitai Bot May 5, 2026
MahtraDR and others added 2 commits May 5, 2026 19:22
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>
@MahtraDR MahtraDR merged commit 8ac5da8 into elanthia-online:main May 5, 2026
4 checks passed
@MahtraDR MahtraDR deleted the fix/remove-autostart-zombie-merge branch May 5, 2026 23:19
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