Repository navigation
Refs #2794: expansion-error discard face on RunClassification - #3248
Merged
Merged
Conversation
A FATAL-class word-expansion error (${var:?} subst.c:10416-10418,
nounset unbound subst.c:11032-11034, bad @-transform subst.c:8949,
arithmetic nounset expr.c:1208-1216) adjudicated an interactive
DISCARD was classification-silent: status 1, Completed, every flag
false — indistinguishable from an ordinary status-1 completion.
The executor now notes the verdict at its raise points (every
FATAL-class arm where expansion_error_is_interactive_discard
selects the DISCARD) into a per-unit record mirroring Q6 arm B's
unit_signal_discard; the grouped driver carries it per group and
the session routes report it as
RunClassification::expansion_error_discard. The lesser expansion
classes carry no interactive/fatal branch in GNU and never set
it. Consumer assertions cover the grouped/line routes, the -e
coexistence, the non-interactive fatal counter-cell, nounset,
and the plain-failure/lesser-class boundaries; the fate pin is
unchanged (7/7 on base and head). Ledger: header addendum plus
the take_classification row's value list.
No deletion paths; additions only (the single deletion count is
one ledger row extended in place).
Captain review census (full enumeration of the discard predicate's call sites plus producer/consumer tracing of the arithmetic_nounset_error and conditional_expansion_fatal latches) found three FATAL-class DISCARD ruling paths the first pass left unnoted, none compensated by another arm: the bare-arithmetic fast entry ruling on its own arm, the assignment-only command consuming the arithmetic nounset latch itself, and the [[ ]] arithmetic-comparison nounset trap ruling at the trap (its prepare-side conversion only unwinds the parked status). All three now note at their own DISCARD arms, for 15 noting arms in all. Three consumer cells ride the new paths (the bare-arithmetic cell on the grouped and line routes). Ledger gains a coverage-completion addendum in the same form; no face change. No deletion paths; additions only.
Formatting only; no semantic change.
caomengxuan666
added a commit
to unixwin/niubash
that referenced
this pull request
Nov 10, 2026
本 PR 是 rubash PR #3248 台账面的镜像同步:把 `docs/api-ledger.md` 的 expansion-error discard addendum(两条 Addendum + `Session::take_classification` 行口径更新)字节级同步到 niubash 侧,使两仓台账保持字节一致。这是 rubash 侧合入的前置门(先例:niu PR #976)。 同步验合: - 同步前:niu 当下 master 台账与 rubash PR #3248 基底(`530d7063`)台账 sha256 同为 `56551e95bffbad7a90ead051aef3965c0ca24c73920022067f2cbfcd79059d32`——基线无漂移。 - 同步后:本 PR 的 `docs/api-ledger.md` sha256 = `09ecf2c203187eaa516ce114be2a783df9b7db81750e04edb12928b5f31b1882`,与 rubash PR #3248 头 `1b8ea5b7` 的台账全文逐字节一致。 - 变更面:仅 `docs/api-ledger.md` 一个文件,+30/−1,不碰任何代码。 本 PR 删除了什么:台账中 `Session::take_classification` 一行旧口径文本(1 行),由含 expansion-error discard 的新口径行替换;无其他删除。 Refs unixwin/rubash#3248 Refs unixwin/rubash#2794
caomengxuan666
marked this pull request as ready for review
November 10, 2026 15:09
This was referenced Nov 10, 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.
Refs #2794
What
RunClassificationgrows anexpansion_error_discardface: whether the run's terminal unit ended in an expansion-error DISCARD — a FATAL-class word-expansion error the executor adjudicated an interactive DISCARD at its raise point instead of a fatal FORCE_EOF jump. Until now that fate (status 1,Flow::Completed, no unwind, every classification flag false) was indistinguishable from an ordinary status-1 completion to a host reading only the classification.Mechanism
interactive_shell ? &expand_wdesc_error : &expand_wdesc_fatal—${var:?}(subst.c:10416-10418), nounset unbound (subst.c:11032-11034), bad @-transform (subst.c:8949), arithmetic nounset (expr.c:1208-1216). The error branch is a DISCARD: the unit is dropped with status 1 and the reader lives (eval.c:111-128).expansion_error_is_interactive_discard()selects the DISCARD (15 arms across the simple-command pre-scan, heredoc finish,raise_word_expansion_error, the arithmetic-nounset gates, the bare-arithmetic fast entry, the assignment-only arithmetic consumer, pipeline element gates, and the[[ ]]operand gates plus its arithmetic-comparison nounset trap) — into a per-unit record that mirrors Q6 arm B'sunit_signal_discard. No session-layer re-derivation. The arm census was completed at captain review by full enumeration of the predicate's call sites plus producer/consumer tracing of thearithmetic_nounset_errorandconditional_expansion_fatallatches: three ruling paths the first pass missed (the bare-(( ))fast entry ruling on its own arm, the assignment-only command consuming the latch itself, and the[[ ]]arith-compare trap ruling at the trap rather than at its downstream conversion) now note at their own arms too.terminal_discard(same most-recent-group semantics, same skipped-group reset) intoGroupedRunClassification;Session::run's grouped route,outcome_after_driver, andSession::take_classificationreport it onRunClassification. The startup-file literals reportfalse(a non-reader route, like theirsignal_discard).errexit_break: the discard dropped the line; the verdict on its status ended the session.Tests
tests/issue2794_expansion_error_discard_classification.rs(7 cells, unchanged): base and head both 7 passed / 0 failed.src/api/consumer_tests.rsride the field the pin could not reference before it existed: grouped + line routes with survival and per-run clearing, the-ecoexistence cell, the non-interactive fatal counter-cell, a nounset member cell, the plain-failure / lesser-class boundary cells, and the three census-completion cells — bare-(( ))arithmetic nounset (both routes), assignment-only arithmetic nounset, and[[ ]]arithmetic-comparison nounset.Ledger
docs/api-ledger.md: a dated header addendum records the field, a follow-up addendum records the census completion of the noting-arm set, and the §2.3Session::take_classificationrow's value list gains the expansion-error discard.RunClassificationrides insideRunOutcome's recorded entry and stays unlisted as its own §6 symbol, so no §6 entry is added and no census count moves; the new executor note/take pair is driver-internal plumbing of the same unrecorded kind as theunit_signal_discardpair.Merge gate: the niubash copy of
docs/api-ledger.mdmust be synced in the same batch before this merges (the #3145 / niubash#976 pattern), so the two copies stay byte-identical.本 PR 删除了什么
无删除路径。纯新增:一个分类字段、一条 executor 单元记录及其注记/读取对、15 处裁定点注记、driver 与 session 的同位携带、consumer 断言与账本记录。唯一的删除计数是账本 §2.3 一行括注的原地扩写(+21/−1 中的 −1)。