Unify scope boundaries and Ops semantics; document structured concurrency model - #57
Merged
Conversation
corp0529
reviewed
Dec 23, 2025
|
|
||
| local kept = {} | ||
| for line in tb:gmatch('[^\n]+') do | ||
| if line ~= 'stack traceback:' |
Collaborator
There was a problem hiding this comment.
magic strings here looks brittle, could we have a single source of truth for the function names and these finds, possibly constructing the table of functions in a single place. Otherwise, if function names change, this will break tracing silently.
Contributor
Author
There was a problem hiding this comment.
very good point! will think on what we can do here
corp0529
reviewed
Dec 23, 2025
| marker = marker or "\t[C]: in function 'xpcall'" | ||
|
|
||
| local out = tb_inner | ||
| local parent = coromap[co] |
Collaborator
There was a problem hiding this comment.
Could a bug introduce an infinite parent loop here? Should we guard against that?
cpunt
reviewed
Dec 23, 2025
| status = nil, -- 'ok'|'cancelled'|'failed' | ||
| primary = nil, -- primary/reason (for non-ok) | ||
| results = nil, -- packed results (for ok) | ||
| -- report = nil, -- optional: ScopeReport |
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.
What type of PR is this? (check all applicable)
Description
This PR strengthens the structured concurrency core and improves diagnostic consistency across Lua runtimes.
It includes two related changes:
fibers.scopeto provide stable, predictable structured concurrency semantics for long-running, I/O-heavy systems.close()), and ensures cancellation closes admission and cascades downward.try/perform,join_op,run,run_op) and structured reports for child outcomes and finaliser errors.op.perform_raw.Revises the local
coxpcallimplementation to make traceback output better match LuaJIT by:debug.traceback(co, ...)for the failing coroutine, andPreserves key semantics:
pcallcontinues to propagate the original error object unchanged;xpcall(f, debug.traceback)continues to behave as expected;Tests:
join_op/run/run_op).Manual test
Manual test description
Exercised scope creation/spawn/cancel/join sequences in a small local harness (listener → child scope → nested work) and verified:
xpcall.Added tests?
Added to documentation?
[optional] Are there any post-deployment tasks we need to perform?
None