types: add Globals / MutableGlobals aliases#9632
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
No issues found across 6 files
Architecture diagram
sequenceDiagram
participant Runner as Runner (by_kwargs)
participant Evaluator as Evaluator
participant Executor as DefaultExecutor
participant Lifecycle as StrictLifecycle
participant Globals as Globals Dict
Note over Runner,Globals: Core Execution Pipeline
Runner->>Runner: _new_evaluator()
Runner->>Globals: NEW: Create MutableGlobals (dict[str, Any])
loop For each ancestor cell in topological order
Runner->>Evaluator: evaluate(cell, glbls: MutableGlobals)
Evaluator->>Lifecycle: setup(cell, glbls: MutableGlobals)
Lifecycle->>Lifecycle: Backup transitive refs
Lifecycle-->>Evaluator: Skip | None
alt Skip returned
Evaluator->>Evaluator: Skip execution
else Execute cell
Evaluator->>Executor: execute_cell(cell, glbls: MutableGlobals)
Executor->>Globals: exec(cell.body) with glbls
Globals-->>Executor: Updated glbls
Executor-->>Evaluator: Return value
end
Evaluator->>Lifecycle: teardown(cell, glbls: MutableGlobals, run_result)
Lifecycle->>Globals: Restore backed-up refs
Lifecycle-->>Evaluator: None
Evaluator-->>Runner: RunResult
Runner->>Runner: CHANGED: _returns(cell_impl, glbls: Globals)
Note over Runner: Read-only view for collecting cell defs
end
Runner->>Runner: _substitute_refs(cell_impl, glbls: MutableGlobals, kwargs)
Note over Runner: Mutate glbls with kwargs
Runner-->>Runner: Return (result, glbls: MutableGlobals)
mscolnick
approved these changes
May 20, 2026
Replaces ad-hoc ``dict[str, Any]`` in the executor pipeline with ``MutableGlobals``, and the lone read-only consumer (``_returns`` in ``by_kwargs``) with ``Globals`` (``Mapping[str, Any]``). Documents mutation intent without changing runtime behavior.
3306d51 to
ed7a283
Compare
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.
📝 Summary
Replaces
dict[str, Any]in the executor pipeline withMutableGlobals(alias), andGlobals(Mapping[str, Any]).Layering on top to prevent rebase churn