A runtime fault keeps the output that ran before it - #448
Open
tobert wants to merge 1 commit into
Open
Conversation
`break`, `continue`, `return`, and `exit` already carry the output a
block produced before they leave it. A runtime fault propagated as a
bare `anyhow::Error` and dropped that output at every block on the way
up: `echo left && x=$((1/0))` printed only the error, an `if` body lost
what it printed, and a function that faulted became exit 1 with neither
its output nor the real cause, since the stage fold used `to_string()`.
A block that faults now wraps the error in a private carrier holding
its accumulated output, merging with any output an inner block already
attached: if and while conditions and bodies, for and case bodies, both
sides of && and ||, function bodies, `source`, and `.kai` scripts. A
command substitution keeps only stderr, because its stdout was
captured, never printed. The carrier renders exactly as the error it
wraps, so no message text changes.
At the top level, a streaming caller receives the faulting statement's
partial output through `on_output` before the `Err`.
`KernelError::Execution` becomes `{ error, output }` so a non-streaming
caller can read the same output; this breaks `Execution(e)` patterns.
A pipeline stage that faults becomes a failed result holding the
carried output and the `{:#}` cause chain.
Co-Authored-By: DeepSeek V4 Flash <noreply@deepseek.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
break,continue,return, andexitalready carry the output a block produced before they leave it. A runtime fault propagated as a bareanyhow::Errorand dropped that output at every block on the way up. A function that faulted became exit 1 with neither its output nor the real cause, because the pipeline stage folded the error withto_string().A block that faults wraps the error in a private carrier holding its accumulated output, merging with any output an inner block already attached. The sites are if and while conditions and bodies, for and case bodies, both sides of
&&and||, function bodies,source, and.kaiscripts. A command substitution keeps only stderr, because its stdout was captured and never printed. The carrier renders exactly as the error it wraps, so no message text changes.At the top level, a streaming caller receives the faulting statement's partial output through
on_outputbefore theErr. A pipeline stage that faults becomes a failed result holding the carried output and the{:#}cause chain.BREAKING:
KernelError::ExecutionbecomesExecution { error, output }so a non-streaming caller can read the same output. AKernelError::Execution(e)pattern no longer compiles; kaijutsu and kaibo do not match on the variant.This stacks on #445.
Co-Authored-By: DeepSeek V4 Flash noreply@deepseek.com
Co-Authored-By: Claude Opus 5 noreply@anthropic.com
🤖 Generated with Claude Code