refactor: declare the names the interactive shell exposes - #59
Merged
Merged
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
`main()` declares `global session_args`, `global root` and `global v2` and assigns them, which is how `ascender-shell` ends up with a connected `root` and `v2` at the interactive prompt. None of the three has a module-level binding, so `global` creates them on first assignment. That works, and it means the module does not say what it exposes. Reading the file top to bottom gives no indication that `root` and `v2` are the point of the script, and importing it before `main()` runs raises `AttributeError` for names that are, in every practical sense, its public surface. Declared at module scope as `None`, with a comment saying what fills them. `main()` keeps its `global` statements and assigns exactly as before, so the only change is that the names exist, holding `None`, before it runs. That is also what the type checker's three `unresolved-global` warnings were pointing at. Verified with `black --check`, `flake8`, the unit suite at 355 passing, and importing the module without calling `main()`, which now reports `None None None` instead of raising.
blaipr
force-pushed
the
refactor/declare-shell-globals
branch
from
September 13, 2026 09:03
030a2d7 to
e8517b7
Compare
cigamit
approved these changes
Sep 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
main()declaresglobal session_args,global rootandglobal v2and assigns them, which is howascender-shellends up with a connectedrootandv2at the interactive prompt. None of the three has a module-level binding, soglobalcreates them on first assignment.That works, and it means the module does not say what it exposes. Reading the file top to bottom gives no indication that
rootandv2are the point of the script, and importing it beforemain()runs raisesAttributeErrorfor names that are, in every practical sense, its public surface.Declared at module scope as
None, with a comment saying what fills them.main()keeps itsglobalstatements and assigns exactly as before, so the only change is that the names exist, holdingNone, before it runs. That is also what the type checker's threeunresolved-globalwarnings were pointing at.Verified with
black --check,flake8, the unit suite at 355 passing, and importing the module without callingmain(), which now reportsNone None Noneinstead of raising.