Repository navigation
Conversation
2 tasks done
Contributor
|
I think this is probably a bigger change than is in this PR. I think this is more widespread than just the |
last and get skipped itemsget skipped items
kokhlo
force-pushed
the
fix/last-get-stream-errors-19463
branch
from
November 6, 2026 15:52
8438161 to
3d90b11
Compare
Contributor
|
superseeded by #19467 |
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.
Description
get <n>(and$in.<n>cell-path access) silently dropped error values from stream items it skipped: a pipeline whose failing item came before the requested index still succeeded, and anexitinside the closure was discarded too. Fixes thegethalf of #19463.Same class as the error propagation #18976 added for
length,columnsandis-empty.PipelineData::follow_cell_path(nu-protocol) collected aListStreamwith a plain.collect(), which keepsValue::Erroritems dormant inside the list, and then indexed it. It now collects withListStream::into_value(), which propagates the first error. This also fixes$in.<n>cell-path access (same code path ineval_ir) andgetwith several paths.The
lasthalf of #19463 is deliberately not included: therecordfamily (#19190) codified that a failed row keeps its position and later rows are still processed —[{a: {b: x}} {c: 1}] | record walk {|value, path| ... } | lastmust return the last good row, not abort on the earlier error row. Propagating errors from evicted rows inlastwould contradict those tests, so it needs a maintainer call on the intended semantics (skip error rows vs. abort), not a one-line change.skip(also mentioned in #19463) is likewise a lazy-vs-eager design question.User-facing changes (Release notes)
get <n>silently dropped errors (and discardedexit) from stream items before the requested index:[1 2 3] | each {|x| if $x == 1 { error make {msg: "boom"} }; $x } | get 2now raises the error instead of returning3, andexit 3in a skipped item now exits with code 3 instead of the script continuing with exit code 0.Additional notes
Fixes the
gethalf of #19463 (lastandskipneed a semantics decision first — see Description).Verification:
commands::get::get_index_propagates_errors_in_skipped_itemscargo test -p nu-command --test tests -- commands::get commands::last commands::record: 134 passed, 0 failed (includes therecordfamily of commands #19190 record tests that alastchange would have broken).cargo test -p nu-protocol: 608 passed across all targets, 0 failed.exitcases against a debug build:each {|x| if $x == 1 { exit 1 }; $x } | get 2exits 1 (was: printed3, script continued);exit 3variant exits 3.cargo fmtandcargo clippy -p nu-command -p nu-protocol --all-targets -- -D warnings: clean.