Skip to content

Respect explicitly configured AeshContext in ReadlineConsole runtime - #689

Merged
stalep merged 1 commit into
aeshell:masterfrom
tristantarrant:issue-687-console-context-fix
Oct 22, 2026
Merged

stalep merged 1 commit into
aeshell:masterfrom
tristantarrant:issue-687-console-context-fix

Conversation

@tristantarrant

Copy link
Copy Markdown
Contributor

Fixes the bug where ReadlineConsole always ran commands under a runtime whose context was a fresh internal default, silently shadowing whatever was configured via SettingsBuilder.aehsContext(...).

Changes

  • ReadlineConsole — when an explicit context is configured on settings, use exactly that instance; otherwise keep today's managed fallback (new DefaultAeshContext(exportManager)) unchanged.
  • Settings — additive default boolean hasExplicitAeshContext() { return true; }. External implementors are unaffected (their getter value was already used unconditionally by AeshCommandRuntimeBuilder.settings()); the console now honours it consistently too.
  • SettingsImpl — precise explicitness tracking: setter marks on non-null, lazy default never does; copy constructor only carries explicitly configured contexts so copied settings keep their own fresh defaults.

Why this shape

aeshContext() is always non-null (lazy init, relied upon widely), so "user set one" vs "lazy default" needed a distinguisher — hence the additive interface method rather than changing getter semantics or nullability.

New regression test asserts console.context() returns identically the instance passed via settings when explicitly configured, and that unset settings still fall back to a managed default. Full module suite green (1577 tests).

Closes #687

@stalep
stalep merged commit 9e7ede2 into aeshell:master Oct 22, 2026
4 checks passed
@stalep

stalep commented Oct 22, 2026

Copy link
Copy Markdown
Member

Thanks!

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.

ReadlineConsole ignores an explicitly configured AeshContext — console runtime always uses a fresh DefaultAeshContext

2 participants