Skip to content

feat: implement spec'd fatal error propagation - #773

Merged
reubeno merged 4 commits into
mainfrom
error-fatality
Nov 20, 2025
Merged

reubeno merged 4 commits into
mainfrom
error-fatality

Conversation

@reubeno

@reubeno reubeno commented Nov 19, 2025

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements spec-compliant fatal error propagation in the shell, ensuring that certain errors (parse errors, expansion errors) properly cause non-interactive shells to exit while allowing interactive shells to continue. The implementation centralizes error handling at the program level and removes several known_failure flags from test cases that now pass.

  • Marks parse errors and expansion errors as fatal per POSIX specification
  • Centralizes error handling in Program::execute to allow interactive shells to continue after errors
  • Handles errors in subshells and simple commands without propagating fatality to parent contexts
  • Enables 8 previously failing test cases across error handling, expansion, and status tests

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
brush-shell/tests/cases/word_expansion.yaml Removes known_failure flag for parameter expression error test
brush-shell/tests/cases/status.yaml Removes known_failure flag for parse error status test
brush-shell/tests/cases/errors.yaml Removes known_failure flags for 6 fatal error tests, adds investigation note for one edge case
brush-core/src/shell.rs Marks parse errors as fatal and consolidates error-to-result conversion in run_parsed_result
brush-core/src/interp.rs Implements error catching at Program, Subshell, and SimpleCommand levels to prevent fatal error propagation while preserving exit codes
brush-core/src/expansion.rs Marks checked expansion errors (parameter test failures) as fatal per POSIX spec

@github-actions

github-actions Bot commented Nov 20, 2025 •

Copy link
Copy Markdown

Test Results

β€‡β€ˆβ€‡β€‡3 filesβ€„β€ƒβ€‡β€ˆβ€‡23 suites   8m 8s ⏱️
1β€ˆ180 tests 1β€ˆ180 βœ…β€ƒ0 πŸ’€β€ƒ0 ❌
3β€ˆ520 runsβ€Šβ€ƒ3β€ˆ520 βœ…β€ƒ0 πŸ’€β€ƒ0 ❌

Results for commit 8cbfe2a.

♻️ This comment has been updated with latest results.

@github-actions

github-actions Bot commented Nov 20, 2025 •

Copy link
Copy Markdown

Performance Benchmark Report

Benchmark name Baseline (ΞΌs) Test/PR (ΞΌs) Delta (ΞΌs) Delta %
clone_shell_object 17.55 μs 18.13 μs 0.58 μs 🟠 +3.31%
eval_arithmetic 0.14 ΞΌs 0.14 ΞΌs 0.00 ΞΌs βšͺ Unchanged
expand_one_string 1.71 ΞΌs 1.71 ΞΌs 0.00 ΞΌs βšͺ Unchanged
for_loop 21.83 ΞΌs 21.47 ΞΌs -0.36 ΞΌs βšͺ Unchanged
function_call 2.34 ΞΌs 2.28 ΞΌs -0.06 ΞΌs βšͺ Unchanged
instantiate_shell 57.77 ΞΌs 57.88 ΞΌs 0.11 ΞΌs βšͺ Unchanged
instantiate_shell_with_init_scripts 24257.73 μs 24691.62 μs 433.89 μs 🟠 +1.79%
parse_bash_completion 2004.89 μs 2058.36 μs 53.47 μs 🟠 +2.67%
parse_sample_script 2.02 ΞΌs 2.07 ΞΌs 0.04 ΞΌs βšͺ Unchanged
run_echo_builtin_command 15.62 ΞΌs 15.76 ΞΌs 0.14 ΞΌs βšͺ Unchanged
run_one_external_command 2393.97 ΞΌs 2408.79 ΞΌs 14.82 ΞΌs βšͺ Unchanged
tokenize_sample_script 3.48 ΞΌs 3.47 ΞΌs -0.01 ΞΌs βšͺ Unchanged

Code Coverage Report: Only Changed Files listed

Package Base Coverage New Coverage Difference
brush-core/src/error.rs πŸ”΄ 47.37% 🟒 82.46% 🟒 35.09%
brush-core/src/expansion.rs 🟒 94.44% 🟒 94.45% 🟒 0.01%
brush-core/src/shell.rs 🟒 81.07% 🟒 81.09% 🟒 0.02%
brush-core/src/sys/unix/signal.rs 🟠 56.36% 🟠 60% 🟒 3.64%
Overall Coverage 🟒 73.75% 🟒 73.88% 🟒 0.13%

Minimum allowed coverage is 70%, this run produced 73.88%

Test Summary: bash-completion test suite

Outcome Count Percentage
βœ… Pass 1348 63.92
❗️ Error 211 10.00
❌ Fail 181 8.58
⏩ Skip 354 16.79
❎ Expected Fail 14 0.66
βœ”οΈ Unexpected Pass 1 0.05
πŸ“Š Total 2109 100.00

@reubeno
reubeno marked this pull request as ready for review November 20, 2025 00:33
@reubeno
reubeno merged commit 19524fa into main Nov 20, 2025
@reubeno
reubeno deleted the error-fatality branch November 20, 2025 00:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants