Commit graph

12097 commits

Author SHA1 Message Date
Rasmus Praestholm
9621e21fc8
Merge pull request #5322 from SiliconSaga/review/post-di-phase5
review: safe JoinServer handoff, ScreenGrabber visibility, deprecate CoreRegistry constructor
2026-04-19 14:37:28 -04:00
Cervator
5bb95e6cf8 fix: remove CoreRegistry.put for ScreenGrabber, already registered at game context level
BSA review: injecting into CoreRegistry is counter to the DI migration.
ScreenGrabber is already registered in the game-level ServiceRegistry
by LwjglRenderingSubsystemFactory.registerWorldRenderer(), so it should
be resolvable from CoreRegistry without manual injection. The black
save preview is a separate framebuffer timing issue tracked in #5321.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-10 23:32:30 -04:00
Rasmus Praestholm
68b01f53db
Merge pull request #5320 from SiliconSaga/review/post-di-phase4
review: remove null CoreRegistry, guard null binds/providers, fix Mermaid
2026-04-10 23:25:43 -04:00
BenjaminAmos
a84ad04572
Merge pull request #5324 from decker757/refactor-usage-of-blacklist-and-whitelist
refactor: replace blacklist/whitelist terminology with denylist/allowlist
2026-04-10 20:48:29 +01:00
Ernest Tan
21358f3991 docs: add Javadoc to ServerConnectListManagerTest, make tempDir private, restored misc.xml 2026-04-11 01:42:58 +08:00
Ernest Tan
a52e4d8243 fix: use try-with-resources for list file I/O to prevent handle leaks 2026-04-11 01:14:45 +08:00
Ernest Tan
a52b9acd13 fix: independent legacy file migration, PathManager teardown, and Checkstyle fixes 2026-04-11 01:01:33 +08:00
Ernest Tan
e811483ff0 Updated SelectGameScreen.java to not silently fail when the migration begins 2026-04-11 00:27:58 +08:00
Ernest Tan
3326c847e4 Updated docs to reference the concept of allowlisting and denylisting 2026-04-11 00:21:55 +08:00
Ernest Tan
6cfe5171ec Updated .gitignore to accomodate denylist and allowlist JSON 2026-04-11 00:18:28 +08:00
Ernest Tan
44e4842090 Updated SelectGameScreen.java to create allowlist/denylist instead of the traditional whitelist/denylist JSON files 2026-04-11 00:17:22 +08:00
Ernest Tan
b7281a6483 Added migrateLegacyFiles() feature to migrate pre-existing blacklist/whitelist.json to denylist/allowlist.json 2026-04-11 00:10:37 +08:00
Ernest Tan
580d97f33f Updated ServerConnectListManager.java to replace blacklist/whitelist variable and method names and logs to denylist/allowlist 2026-04-11 00:00:40 +08:00
Cervator
1d98bace4e fix: return true after error state change in JoinServer
After changeState(mainMenu) on failure, returning false left the load
step active, causing the error path to repeat on the next tick. Return
true to end the step, matching the pattern in InitialiseWorld.

CodeRabbit review feedback on PR #5322.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-04 22:38:19 -04:00
Cervator
f8dbec7519 fix: make ScreenGrabber visible from CoreRegistry for save preview images
ScreenGrabber was registered only in WorldRendererImpl's private child
context, invisible from the shared game context. ReadWriteStorageManager
resolves it via CoreRegistry.get(ScreenGrabber.class) when saving the
game preview image, which returned null — resulting in black preview
screenshots. Propagate the instance to CoreRegistry after init().

CodeRabbit flagged this on PR #5299 (outside-diff-range, major).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-04 21:02:48 -04:00
Cervator
f9ff93c3e0 refactor: deprecate CoreRegistry-based ReadWriteStorageManager constructor
Mark the old constructor that resolves dependencies via CoreRegistry as
@Deprecated. The @Inject constructor is the correct DI path. No callers
use the old constructor directly — it exists only as a fallback.

BSA flagged this on PR #5299.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-04 19:43:25 -04:00
Cervator
e960afe224 docs: clarify seed origin in InitialiseWorld
Add comment clarifying that the world seed is carried by the
GameManifest from the UI (via GameManifestProvider), with a random
fallback if not specified.

BSA asked "Where is the seed being set now?" on PR #5299.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-04 17:40:59 -04:00
Cervator
4dffbe8365 fix: use FutureTask for safe thread handoff in JoinServer
Three issues in the client join path:

1. Dead thread was treated as success — if the environment switch
   threw an exception, the thread died and step() returned true.
   Now uses FutureTask which surfaces exceptions via get().

2. Unsafe .stream().findFirst().get() for BeanContext extraction
   replaced with orElseThrow() and a clear error message.

3. CoreRegistry.setContext() was called from the worker thread.
   Now the FutureTask returns the Context and the main thread
   sets CoreRegistry after get() completes successfully.

CodeRabbit flagged this on PR #5299 (outside-diff-range, critical).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-04 17:30:38 -04:00
Cervator
55e12c3d2b fix: address Copilot review — rename locals, consistent provider access
Rename short variable names (chunks, network) to descriptive names
(chunkProviderInstance, networkSystemInstance) for consistency across
createSaveTransaction() and isRunModeAllowSaving(). Assign
chunkProvider.get() to a local in isRunModeAllowSaving() to avoid
redundant calls.

Copilot review feedback on PR #5320.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-02 23:54:42 -04:00
Cervator
7ace487dc5 fix: address CodeRabbit review — clear stale CoreRegistry, guard isRunModeAllowSaving
- TerasologyEngine: explicitly clear CoreRegistry in constructor to
  prevent stale context leakage between build() and initialize().
- ReadWriteStorageManager: guard null providers in isRunModeAllowSaving()
  which is called before createSaveTransaction() and could NPE during
  state transitions.

CodeRabbit review feedback on PR #5320.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-02 23:22:02 -04:00
Cervator
935710c1f1 fix: separate null checks for ChunkProvider and NetworkSystem
Split the combined null check into separate checks with specific error
messages so the failing provider is immediately identifiable.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-02 23:07:20 -04:00
Cervator
77fb651735 fix: guard provider access in ReadWriteStorageManager.createSaveTransaction
ChunkProvider and NetworkSystem providers are dereferenced unconditionally
in createSaveTransaction(). A save triggered during a state transition
could NPE if the providers are not yet resolved. Guard with null checks
and fail with a clear message.

CodeRabbit flagged this on PR #5299 (outside-diff-range, major).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-02 23:07:20 -04:00
Cervator
7b52863add fix: resolve Mermaid subgraph ID collision in Engine-States.md
LoadingStepUpdate was used as both a node label and a subgraph ID,
which share the same Mermaid namespace. Move the label to the subgraph
declaration so the ID is only defined once.

CodeRabbit flagged this on PR #5299 (outside-diff-range, minor).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-02 23:07:19 -04:00
Cervator
13ecaa7e24 fix: guard against null mouse wheel binds in BindsSubsystem
mouseWheelUpBind and mouseWheelDownBind can be null after clearBinds()
and may not be re-assigned if no wheel bindings are registered. Add
null checks before accessing getId().

CodeRabbit flagged this on PR #5299 (outside-diff-range, minor).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-02 23:07:19 -04:00
Cervator
4f0cc095e2 fix: remove CoreRegistry.setContext(null) in TerasologyEngine constructor
The constructor called CoreRegistry.setContext(rootContext) before
rootContext was created, passing null. The correct setContext call
happens in initialize() after rootContext is constructed. Removed the
premature call and updated the comment.

CodeRabbit flagged this on PR #5299 (outside-diff-range, critical).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-02 23:07:19 -04:00
Rasmus Praestholm
a1d4f8abf2
Merge pull request #5313 from SiliconSaga/review/post-di
DI PR post-review follow-up 1
2026-04-02 11:37:11 -05:00
Rasmus Praestholm
1636db1aa3
Merge pull request #5318 from SiliconSaga/review/post-di-phase3
review: fix deserialize bugs, duplicate handlers, type safety, and Javadoc
2026-04-02 08:13:10 -05:00
Cervator
2ed7b370a8 fix: remove unused EntityManager imports, align Javadoc style
Remove unused EntityManager imports left behind after switching to
EngineEntityManager. Align @param Javadoc style (capitalize, drop
trailing periods) to match existing conventions in the file.

CheckStyle + CodeRabbit review feedback on PR #5318.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-31 22:02:00 -04:00
Cervator
617c252361 docs: update EngineSubsystem lifecycle Javadoc for ServiceRegistry
The Javadoc still said "add anything into the root context" when the
methods now receive a ServiceRegistry. Updated to say "register
services" and "build the root context" to match the DI migration.

CodeRabbit flagged this on PR #5299 (minor).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-31 21:28:36 -04:00
Cervator
5fadcc380a refactor: accept EngineEntityManager directly in EntityAwareWorldProvider
Replace EntityManager parameter with EngineEntityManager in the @Inject
constructor, eliminating the runtime downcast. Updated the two
WorldProviderCoreWorkAround subclasses to match. Gestalt DI auto-maps
PojoEntityManager to all its interfaces including EngineEntityManager.

CodeRabbit flagged this on PR #5299 (minor).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-31 21:26:38 -04:00
Cervator
e7ddacc108 fix: remove duplicate populateWithDefaultHandlers call in TypeHandlerLibraryImpl
forModuleEnvironment() creates an instance via the @Inject constructor
(which already calls populateWithDefaultHandlers), then called it again,
duplicating all default handler/factory registrations. The handlers
append to a list without deduplication.

CodeRabbit flagged this on PR #5299 (outside-diff-range, major).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-31 21:17:41 -04:00
Cervator
2ed6da9cb2 fix: null-check setter and pass value in ObjectFieldMapTypeHandler.deserialize
Two bugs in deserialize for private fields:
1. findSetter(field) can return null — no null check (NPE risk)
2. setter.invoke(result) passed no value argument — the setter was
   called with zero args, silently failing to set the field

Fixed to match the serialize side's pattern: null-check the setter,
log an error if missing, and pass fieldValue.get() as the argument.

CodeRabbit flagged this on PR #5299 (outside-diff-range, critical).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-31 20:37:01 -04:00
Cervator
2f1639238c refactor: use addAndTrack consistently for all load process registration
Use addAndTrack() in initHost() and initClient() as well, not just the
post-context-switch steps. This makes maxProgress tracking consistent
across all phases and removes the now-redundant loop in init() that
was double-counting.

BSA review feedback on PR #5313.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-31 18:56:26 -04:00
Cervator
70a8e95851 test: add non-ContextImpl parent fallback test for ContextImpl
Documents the instanceof-based behavior: when the parent is not a
ContextImpl, context.get() resolves via the parent fallback but @Inject
resolution throws DependencyResolutionException since there is no parent
BeanContext to search.

CodeRabbit nitpick on PR #5313.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-31 18:52:23 -04:00
Cervator
055c2da9b9 fix: address BSA review feedback on Phase 1 PR
- Fix progress bar double-counting: extract addAndTrack() helper that
  adds a load process and increments maxProgress in one step, replacing
  the full-queue iteration that re-counted pre-existing steps.
- ContextImplTest: fix copyright year (2026), remove commentary about
  previous behavior per BSA's guidance to describe expected behavior only.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-31 18:52:23 -04:00
Cervator
4fe9c2a444 fix: re-push loading screen after NUI manager swap, fix progress bar overflow
Two related fixes in StateLoading:

1. After SwitchToContextStep replaces the NUI manager with the DI-created
   instance, re-push the loading screen onto the new manager. Previously
   the screen was orphaned on the old manager, causing flicker and
   rendering through a dead manager.

2. Recalculate maxProgress when AddHostPostLoadProcessesStep and
   AddClientPostLoadProcessesStep inject additional load steps. The
   initial maxProgress only counted pre-context-switch steps, so the
   progress bar overflowed once post-switch steps ran.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-31 18:51:45 -04:00
Cervator
4c36d62afb fix: propagate parent BeanContext in ContextImpl(Context) constructor
The ContextImpl(Context parent) constructor created a standalone
DefaultBeanContext with no parent, so @Inject dependency resolution in
child contexts could not see beans registered in the parent. This
affected network connection handlers (ClientConnectionHandler,
ServerConnectionHandler), NUIManagerInternal, and other callers.

Fixed by extracting the parent's beanContext when the parent is a
ContextImpl, matching the pattern already used in the ServiceRegistry
variant of the constructor.

Includes a unit test that demonstrates the fix: childContext
ResolvesParentBeansViaInject fails with DependencyResolutionException
before this change and passes after.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-31 18:51:44 -04:00
Cervator
18df6c61e7 fix: assign UniverseWrapper in UniverseSetupScreen.setEnvironment
setEnvironment() received a UniverseWrapper parameter but never assigned it
to the instance field. The screen's UI bindings read from the field, not the
context, so seed/generator/server settings from AdvancedGameSetupScreen were
silently discarded.

Flagged independently by both Copilot and CodeRabbit on PR #5299.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-31 18:51:44 -04:00
Cervator
0d310c8c34 chore: bump gestalt to 8.0.1-SNAPSHOT
Aligns version catalog and build-logic with the 8.0.1 gestalt branch
that contains the DI refactor changes this migration depends on.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-31 18:51:44 -04:00
Rasmus Praestholm
2544d5ff39
Merge pull request #5315 from SiliconSaga/review/post-di-phase2
DI PR post-review follow-up 2 - 4 code quality tweaks
2026-03-31 17:44:59 -05:00
Rasmus Praestholm
039a22e691
Merge pull request #5317 from SiliconSaga/review/post-di-phase2b
review: safeguard implicit type casts and fail-fast on null singletons
2026-03-31 17:44:16 -05:00
Cervator
f28b1977df fix: guard error messages against null in safe cast checks
Both InitialiseBlocks and ModuleManager.loadEnvironment called
.getClass() on potentially null references in their error messages,
which would throw NPE instead of the intended IllegalStateException.

CodeRabbit review feedback on PR #5317.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-30 23:30:40 -04:00
Cervator
ccbc828473 fix: fail fast on AutoConfig construction failure instead of publishing null
The ServiceRegistry supplier silently returned null when AutoConfig
construction failed, publishing a null singleton. Later lookups would
get null and NPE far from the root cause. Now logs the error and throws
RuntimeException to surface the problem immediately.

CodeRabbit flagged this on PR #5299.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-30 23:21:46 -04:00
Cervator
c5ba72e675 fix: document and safeguard ContextImpl requirement in ModuleManager.loadEnvironment
The loadEnvironment(Context, ...) method requires a ContextImpl to
extract the BeanContext for module DI, but the parameter type is the
broader Context interface. Added Javadoc documenting this requirement
and replaced the blind cast with instanceof + clear error message.

BSA flagged this on PR #5299: "Should this implementation requirement
be documented?"

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-30 23:17:51 -04:00
Cervator
69dd0e00a1 fix: add safe downcast check in InitialiseBlocks
Replace blind cast of BlockManager to BlockManagerImpl with instanceof
pattern matching and a clear error message if the assumption is violated.
The cast is currently always safe (RegisterBlocks always creates
BlockManagerImpl), but making it explicit prevents silent ClassCastException
if the registration ever changes.

BSA flagged this on PR #5299: "Is it safe to assume that this down-cast
will always work?"

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-30 23:13:53 -04:00
Cervator
63e5595811 cleanup: remove unused gameManifest parameter from RegisterRemoteWorldSystems
BSA review feedback: the GameManifest parameter was left behind after
removing the commented-out code that used it. Remove from constructor
and update the caller in StateLoading.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-30 21:26:36 -04:00
Cervator
72d6139774 fix: restore GameManifest import in RegisterRemoteWorldSystems
The GameManifest import was removed along with the dead code, but the
constructor parameter still references the type. Restores the import.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-29 22:32:46 -04:00
Cervator
2774c81cf8 refactor: inject explicit deps in BlockFamilyLibrary instead of Context
Replace Context parameter with explicit ReflectFactory and
CopyStrategyLibrary parameters in both constructors. The Context was
only used to pull these two dependencies, making it an unnecessary
intermediary.

BSA flagged this on PR #5299: "We should not be injecting Context
directly unless absolutely necessary."

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-29 22:13:34 -04:00
Cervator
ec9ca36e31 refactor: inject NetworkSystem directly in ConsoleImpl
Inject NetworkSystem as an explicit constructor parameter instead of
pulling it from Context. Context is retained only for the lazy
PermissionManager lookup (provided by @Share at runtime, not available
at construction time).

BSA flagged this on PR #5299: "This class does not require a full
context. Inject NetworkSystem and PermissionManager instead."
PermissionManager cannot be fully injected yet due to its lifecycle.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-29 22:09:21 -04:00
Cervator
eafc364b4b cleanup: rename timedContextForModulesWidgets to widgetContext
Rename the nonsensical variable name to something descriptive. This is
a per-module child context used to inject widget-specific dependencies
(TypeWidgetLibrary) during control widget initialization.

BSA flagged this on PR #5299.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-29 21:51:34 -04:00