Skip to content

fix: resolve 11 oracle test failures (180/181)#13

Merged
mpecan merged 5 commits intomainfrom
fix/oracle-remaining
Mar 25, 2026
Merged

fix: resolve 11 oracle test failures (180/181)#13
mpecan merged 5 commits intomainfrom
fix/oracle-remaining

Conversation

@mpecan
Copy link
Copy Markdown
Owner

@mpecan mpecan commented Mar 25, 2026

Summary

Fixes 9 of the 12 remaining oracle test failures, bringing the score from 169/181 to 177/181.

Fixes

Fix Tests Root cause Change
is_varfd validation heredoc_formatting 9 {6d} accepted as varfd Require first char to be letter/_
Assignment subscript spaces word_boundaries 2 arr[0 until ]=$ assignment Reject subscripts with whitespace
$[...] bracket depth word_boundaries 8 Stops at first ] New read_deprecated_arith with depth
Trailing \ at EOF ansi_c_escapes 3, redirect_formatting 3 Single \ instead of \\ Push \\ when EOF after \
Heredoc trailing \ heredoc_formatting 1 (partial) Same, in heredoc body Same pattern
Coproc redirect heredoc_formatting 8, redirect_formatting 7 <</<> after coproc as words Check token type before adding to words
Heredoc delimiter whitespace ansi_c_escapes 18 EOF not matching EOF Trim trailing whitespace before match
Background ordering cmdsub_formatting 9 (partial) & after heredoc content Insert before heredoc content

Remaining 4 known failures

Test Issue
heredoc_formatting 1 Trailing \n at EOF in heredoc body
ansi_c_escapes 13 bash-oracle control char doubling (\x1 → 2 bytes)
other 10 bash-oracle control char doubling (\01 → 2 bytes)
cmdsub_formatting 9 Trailing space before ) in cmdsub with background heredoc

Also

  • Removed unused read_until_char function
  • All 140 tests pass, clippy clean
  • No Parable test regressions

Test plan

  • 140 tests pass (87 unit + 47 integration + 6 doc)
  • Oracle: 177/181
  • cargo clippy --all-targets -- -D warnings clean

🤖 Generated with Claude Code

mpecan and others added 3 commits March 25, 2026 14:28
- is_varfd: require first char to be letter/underscore (heredoc_formatting 9)
- is_assignment_word: reject subscripts with spaces (word_boundaries 2)
- $[...] deprecated arith: track bracket depth (word_boundaries 8)
- Trailing \ at EOF: push \\ in word lexer, quotes, expansions,
  and heredoc body (ansi_c_escapes 3, redirect_formatting 3,
  heredoc_formatting 1)
- Remove unused read_until_char

Oracle: 175/181 (was 169).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- is_varfd: require first char to be letter/underscore, rejecting
  {6d} which is not a valid bash variable name (heredoc_formatting 9)
- is_assignment_word: reject subscripts containing whitespace, so
  arr[0 until ]=$ is not treated as assignment (word_boundaries 2)
- $[...] deprecated arith: new read_deprecated_arith with bracket
  depth tracking replaces read_until_char (word_boundaries 8)
- Trailing \ at EOF: push \\ (literal backslash) in word lexer,
  double-quoted strings, matched parens, param expansion braces,
  and heredoc body (ansi_c_escapes 3, redirect_formatting 3)
- Remove unused read_until_char

6 entries removed from KNOWN_ORACLE_FAILURES.
6 remaining: heredoc_formatting 1 (trailing \n at EOF), ansi_c_escapes
13+18, other 10, heredoc_formatting 8, redirect_formatting 7,
cmdsub_formatting 9.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Coproc redirect: parse_coproc now checks if first token after
  coproc is a redirect operator (<<, <>, etc.) and parses it as a
  redirect instead of a word (heredoc_formatting 8, redirect_formatting 7)
- Heredoc delimiter: allow trailing whitespace on delimiter line
  (ansi_c_escapes 18)
- Background ordering: insert trailing & before heredoc content
  on the delimiter line, not after (partial fix for cmdsub_formatting 9)

4 remaining known failures:
- heredoc_formatting 1: trailing \n at EOF in heredoc body
- ansi_c_escapes 13, other 10: bash-oracle control char doubling
- cmdsub_formatting 9: trailing space before ) in cmdsub

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@mpecan mpecan changed the title fix: resolve 6 oracle test failures (175/181) fix: resolve 9 oracle test failures (177/181) Mar 25, 2026
Bash internally prefixes CTLESC (0x01) and CTLNUL (0x7F) bytes with
a CTLESC marker in its word representation. When ANSI-C escapes like
$'\x1' or $'\01' produce these byte values, the internal string
contains two copies of the byte.

Match this behavior in process_ansi_c_content for hex and octal
escapes: when the escape value equals CTLESC or CTLNUL, prefix
the output with an extra 0x01 byte.

Fixes ansi_c_escapes 13, other 10.
Oracle: 179/181 (2 remaining).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@mpecan mpecan changed the title fix: resolve 9 oracle test failures (177/181) fix: resolve 11 oracle test failures (179/181) Mar 25, 2026
@mpecan mpecan changed the title fix: resolve 11 oracle test failures (179/181) fix: resolve 11 oracle test failures (180/181) Mar 25, 2026
@mpecan mpecan force-pushed the fix/oracle-remaining branch from 1e24f6f to a336ea4 Compare March 25, 2026 14:56
When a heredoc body's last line ends with \ at EOF, bash doesn't
append a trailing newline (the backslash consumes the implicit
newline). Track whether the backslash-at-EOF handler fired and
skip the \n push in that case.

Verified against bash-oracle: normal EOF lines get \n, but lines
ending with trailing \ at EOF do not.

Fixes heredoc_formatting 1.
Oracle: 180/181 (1 remaining: cmdsub_formatting 9 — trailing space).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@mpecan mpecan force-pushed the fix/oracle-remaining branch from a336ea4 to 4af8d91 Compare March 25, 2026 15:09
@mpecan mpecan merged commit 69d6bc8 into main Mar 25, 2026
5 checks passed
@mpecan mpecan deleted the fix/oracle-remaining branch March 25, 2026 15:26
mpecan added a commit that referenced this pull request Mar 25, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.1.8](rable-v0.1.7...rable-v0.1.8)
(2026-03-25)


### Features

* enrich AST with structured word spans and assignment detection
([9163d24](9163d24))
* enrich AST with structured word spans and assignment detection
([#11](#11))
([3b58c38](3b58c38))


### Bug Fixes

* CTLESC byte doubling for bash-oracle compatibility (179/181)
([72bc381](72bc381))
* heredoc trailing newline at EOF with backslash (180/181)
([4af8d91](4af8d91))
* resolve 11 oracle test failures (180/181)
([#13](#13))
([69d6bc8](69d6bc8))
* resolve 3 more oracle failures (177/181)
([8aca953](8aca953))
* resolve 6 oracle test failures
([0496222](0496222))
* resolve 6 oracle test failures (175/181)
([1708884](1708884))


### Documentation

* comprehensive documentation update
([#14](#14))
([6abfb20](6abfb20))
* comprehensive documentation update for better DX
([61114b0](61114b0))


### Code Refactoring

* remove sexp re-parsing by threading spans through all nodes
([54db8c7](54db8c7))
* simplify span collection, move to owned tokens, remove dead code
([cec7e8e](cec7e8e))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
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.

1 participant