Skip to content

Fix display panels not recovering from script errors after external edits - #91

Merged
rubensworks merged 2 commits into
master-1.21-ltsfrom
fix/script-error-recovery
Oct 19, 2026
Merged

rubensworks merged 2 commits into
master-1.21-ltsfrom
fix/script-error-recovery

Conversation

@rubensworks

Copy link
Copy Markdown
Member

If a script was broken and then fixed in an external editor, a display panel using it kept showing the old error forever.

Cause: the file watcher thread applied external changes directly, so the error's resolution listeners ran off the server thread. The panel's listener looks up its network via the world, and Level.getBlockEntity returns null off-thread, so the variable was never refreshed and kept rethrowing its cached error. Edits from the terminal were fine since they run on the server thread.

Fix: the watcher now only queues the changed disk, and ScriptingData.tick() (server tick) reloads it. This also stops script listeners and caches from being touched by the watcher thread in general.

Tests:

  • New game test testScriptsDisplayScriptErrorResolvedAfterExternalFix writes the fix to the file on disk. It fails on master and passes with this change.
  • ScriptingDataTest helpers now tick while waiting for external changes.
  • Verified in a dev client: broken script shows the ReferenceError, writing the fixed file externally makes the panel show the new value.

Generated by Claude Code

…dits

Script changes made by an external editor were applied on the file watcher
thread. Resolving the cached error there could not find the part's network,
as the world can not be accessed off-thread, so the variable kept its error.
Externally changed disks are now reloaded on the server tick.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018MRyTdV3fSV5Q5NPGep4q9
…directly

Initializing the scripting data before its first tick, as tests do, made
the tick initialize it again. This replaced the watch service and started
a second watcher thread, so changes in some directories could be missed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018MRyTdV3fSV5Q5NPGep4q9
@coveralls

Copy link
Copy Markdown

Coverage Report for CI Build 39276759378

Coverage increased (+0.4%) to 45.662%

Details

  • Coverage increased (+0.4%) from the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • 41 coverage regressions across 2 files.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

41 previously-covered lines in 2 files lost coverage.

File Lines Losing Coverage Coverage
org/cyclops/integratedscripting/core/network/ScriptingData.java 39 78.86%
org/cyclops/integratedscripting/gametest/GameTestsScripts.java 2 97.8%

Coverage Stats

Coverage Status
Relevant Lines: 3330
Covered Lines: 1651
Line Coverage: 49.58%
Relevant Branches: 1315
Covered Branches: 470
Branch Coverage: 35.74%
Branches in Coverage %: Yes
Coverage Strength: 24.13 hits per line

💛 - Coveralls

@rubensworks
rubensworks merged commit 699853d into master-1.21-lts Oct 19, 2026
23 checks passed
@rubensworks
rubensworks deleted the fix/script-error-recovery branch October 19, 2026 16:26
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.

3 participants