Repository navigation
docs(design): 1.5.0 RFC - workspace split, embeddable engine API, host boundary - #814
Merged
Merged
Conversation
…sh-name builtins, sudo visibility) and #757 prompt expansion (bare specials, promptvars gate) #759 item 3 - `shift` with a bad operand is a usage error (2), not a plain failure. GNU builtins/shift.def routes a non-numeric operand through get_numeric_arg (builtins/common.c:501-505 sh_neednumarg, get_numeric_arg returns 0, shift_builtin answers `return (EX_USAGE)`) and a surplus operand through no_args (set_exit_status(EX_BADUSAGE)); only the shift-count-erange path stays EXECUTION_FAILURE. rubash returned 1 for both usage shapes; GNU 5.3.0 gives 2/2/1/1 for x / 1 2 / -1 / 99 and rubash now agrees (the 5.2.21-vs-5.3.0 question left open on the ticket thread is resolved for the 5.3.0 contract). #759 item 4 - GNU bash has no `setopt`/`unsetopt` builtins; a script probing them to detect zsh must miss. Removed the zsh-compat builtins (src/builtins/zsh_options.rs and every dispatch/classification arm): `setopt x` is command-not-found (127), `builtin setopt x` is not-a-shell-builtin (1), `enable -a` lists exactly GNU's 61 names, and shell option state is untouched by the unknown names. `compgen -A setopt` is deliberately UNTOUCHED - complete.def:130 defines it as a `set -o` completion action, not the zsh builtin. `sudo` moves to the hidden-builtin contract (docs/builtins.md, the uname/arch pattern): execution keeps the Windows host-capability builtin only while an embedding host registered an elevation handler; with no handler it routes and introspects as the PATH command GNU runs (`command -v sudo` finds /usr/bin/sudo, never a bare builtin name). Introspection surfaces (type, command -v, enable -a, compgen -b) report external unconditionally. #757 - the prompt second pass now runs the full double-quoted word expansion (parse.y:6689 expand_prompt_string with Q_DOUBLE_QUOTES) instead of a bare-name scanner: bare special parameters ($? $# $$ $- positional $1/$2), $((...)) arithmetic and backticks all expand in ${PS1@P} and the render channels. The pass is gated on `promptvars || posixly_correct` (parse.y:6683), so `shopt -u promptvars` leaves `$var`/backtick text literal while posix mode keeps expanding. decode_prompt_string gains the parse.y:6586-6592 `\$` contract (backslash-quoted for the pass when non-root, bare `#`/`$` otherwise) and the parse.y:6434/6452/6533/6549/6563 backslash-quote protection for the \w \u \h \H \W \D{} decode outputs (the slashify_in_quotes set, syntax.h:26), so their data cannot be misread as expansion syntax by the pass. #431 (\[ \] stripping) and #604 (status snapshot, render-path parity) behavior unchanged - their regression suites stay green. Known boundaries left as-is (pre-existing, out of ticket scope): PS4 does not decode PS1-style escapes, the `${var?word}` prompt-pass shape keeps printing the message text, and ticket section 3 (PS0 emission, \! / HISTCMD counters, compgen -A signal inventory). Differential evidence: WSL GNU bash 5.3.0 stdin probes 2026-10-18 (LF scripts, stdout/stderr split). New regression coverage: tests/regression.rs shift_bad_operand_status_matches_gnu / zsh_option_builtins_are_gone / sudo_is_not_reported_as_a_builtin and tests/issue757_prompt_expansion_regressions.rs (6 cases); the three shift chain tests move to the 5.3.0 status contract. Full `cargo test --release -- --test-threads=1` failure set compared bidirectionally against an origin/master worktree run on the same machine: 44 pre-existing environment failures on master, 34 on this branch, no new failure attributable to the change. Two files (arrays/mapfile.rs, executor_command_chaining/part_041.rs) carry fmt-only hunks the pre-commit rustfmt gate demands on any commit.
…rompt_string (CR F1/F2/F5 on #810) F1 (regression from the #757 prompt pass): a malformed `${...}` inside PS1 failed the enclosing command (`PS1='a${1x}b'; p=${PS1@P}` -> rc 1, variable unset). GNU subst.c:4392-4418 expand_prompt_string runs the expansion with `no_longjmp_on_fatal_error = 1` and RETURNS THE PASSED STRING on any verdict. The pass now snapshots the expansion-verdict latches (parameter_bad_substitution, arithmetic_expansion_error, arithmetic_fatal_error, arithmetic_nonfatal_error) and, when the walk raised one, restores them and falls back to the decoded prompt text — diagnostic stands, value literal, enclosing command still rc 0. expand_prompt_string_mut (the interactive render channel) gets the same containment around its double-quoted walk. Two verdict sites were needed inside the double-quoted walk, both gated on it so ordinary word paths are untouched: - an unterminated `${body` (GNU 5.3.0: `PS1='a${bad'` prints `a${bad: bad substitution`, value literal) — the body collector now reports termination (collect_braced_parameter_body); - the `?`/`:?` error operator REPORTS (subst.c:10403-10418: `{prefix} {name}: {message}`, message expanded) instead of substituting the message into the value. F2 resolved by the same change: `${var?word}` inside the prompt pass is now GNU-aligned (stderr diagnostic + literal value + rc 0) — probed against WSL GNU 5.3.0 on all five shapes (bad substitution, arithmetic verdict, unterminated brace, `?` operator, nonfatal division). F5: `help sudo` drops the windows-only hand-written help page and takes the GNU no-topics form (`help: no help topics match 'sudo'`), matching the new contract that introspection never presents sudo as a builtin. New differential regressions: tests/regression.rs prompt_expansion_failure_contained_like_gnu (rc + literal + stderr across the five shapes) and the in-process malformed_braced_parameter_contained_in_prompt_transform. Prompt boundary suites (issue393/421/431/433/604/757, pb10k) 35/35 green; lib 690 green; executor_tests failure set unchanged (the 8 adjudicated pre-existing environment flakes).
…cross-target E0609) routes_as_builtin referenced the #[cfg(windows)] elevation_handler field unconditionally, so every unix compile lane (linux/darwin/android cross check, unix Rust tests, shell functionality build) failed with E0609 at lookup_paths.rs:95. The field and its whole machinery are windows-only by the established pattern (executor/mod.rs:1039-1040, init.rs:424, command_substitution.rs:1573, sudo_builtin module gate), so the routing helper gets the same two-variant shape: on Windows the table plus the handler-gated sudo arm; elsewhere the pure table - which is also the GNU-correct answer, since off Windows there is no sudo builtin at all. The issue757 backslash-dollar decode regression test asserted the root render (hash); unix CI runs non-root, so it now derives the expectation from EUID and asserts the literal-name contract on either branch (root hash / non-root backslash-quoted dollar).
…item 3) The upstream-suite errors slice pinned the pre-#759 `shift` usage status: `after shift: 1` twice, recorded while rubash answered EX_USAGE-shaped failures with EXECUTION_FAILURE. The 5.3.0 contract this branch ships (builtins/common.c:501-505 get_numeric_arg -> shift.def `return (EX_USAGE)`, surplus operands through no_args EX_BADUSAGE) is 2, byte-verified against WSL GNU bash 5.3.0. Re-recorded per the documented protocol (RUBASH_REGRESSION_RECORD=1 cargo test --test regression upstream_suite_slice_snapshots); the diff is exactly the two shift lines, no other slice moved.
…I, host boundary RFC draft v1 for the 1.5.0 shape: four-layer workspace split (core/driver/interactive/facade), the Session-level embeddable API (#595's rubash-as-engine), and the formalization of the engine/host boundary (846 env-IPC sites -> typed bridges). Train: 1.4.1 fix wave, 1.4.2 #359 plan A loader, 1.4.3 typed rc writer, 1.5.0 pillars + unix interactive harness + debugger M0. Groundwork inventory (~30% landed: #593/#314/#606/#570/#746/#729-728) and the open decision list (D1-D5) included.
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.
RFC draft v1 for #595's 1.5.0 shape. Three pillars: (1) four-layer workspace split (core/driver/interactive/facade, coarse-first, dependency-direction enforced in CI), (2) Session-level embeddable API behind an RFC-frozen pub face (consumers: niubash -> oh-my-pi -> Zed PoC; acceptance = editor-REPL demo without ConPTY/Win32), (3) formalizing the engine/host boundary (846 env-IPC sites -> typed bridges; #359 plan A is the first entity). Train table: 1.4.1 fix wave / 1.4.2 #359 loader / 1.4.3 typed writer / 1.5.0 pillars + unix interactive harness + debugger M0. Groundwork inventory (~30% landed) and open decisions D1-D5 in §8.