Skip to content

hotfix(bash): fix main-red — bash_exit_code_lex projects from a fixed-span phrase (undefined bash_lex_rule from #5347) - #5367

Closed
briansrls wants to merge 1 commit into
mainfrom
hotfix/bash-exit-code-lex-phrase
Closed

briansrls wants to merge 1 commit into
mainfrom
hotfix/bash-exit-code-lex-phrase

Conversation

@briansrls

Copy link
Copy Markdown
Contributor

main is RED — this unblocks the whole tree

#5347 (bash slice 5d Exit) merged a fn bash_exit_code_lex() that calls a bash_lex_rule(...) constructor defined nowhere in the tree (bash.dag:1095). The whole-tree CI floor resolves every *_test.dag closure, so this dangling call fails resolve for bash_emit_command_test.dag and turns main RED for every open PR.

Fix (§3 single authority)

lexing.dag's LexicalPhrase is the single authority — lex rules project from the construct's fixed-spelling spans via phrase_to_lex_rules(p: phrase([...])), exactly as the bound-token sibling bash_env_prefixed_cargo_lex does. A direct rule constructor is the "authored three times that could silently disagree" anti-pattern that comment forbids.

Only the exit keyword is a fixed span; the exit code is an emit-time bound token (^bash_token_exit_code via binding_spellings), so it contributes no literal lex rule — preserving the original single-rule behavior bit-for-bit.

A tighter fix than a two-span phrase (incl. the code span): a LexicalPhrase is fixed-spelling-only by contract, so the bound code cannot be a span; a literal span for it would over-generate a spurious rule. Confirmed with the bash arc owner @warm-badger-46, who also cleared the colliding bash_lex_rule constructor in #5363.

Verified by execution

claim_batch --source-root dsl --source-root src/v2:

  • bash_emit_command_test.dag now RESOLVES clean (43 modules; was resolve-FAIL)
  • bash_emit_command_accepts, bash_emit_bound_words: PASS
  • bash_emit_exit_code_{0,1}: PASS
  • bash_emit_exit_code_1_quoted_wrong_{ne_correct,model,rejects}: PASS (discriminating RED intact)

🤖 Generated with Claude Code

…ot the undefined bash_lex_rule (main-red fix)

#5347 (slice 5d Exit) left `bash_exit_code_lex()` calling a `bash_lex_rule(...)`
constructor that is defined nowhere in the tree. The whole-tree CI floor resolves
every *_test.dag closure, so this dangling call failed `resolve` for
bash_emit_command_test.dag and turned main RED for every open PR (since #5347
merged at 01:12 UTC; pre-#5347 5c493fc was green).

Fix per §3 single authority (lexing.dag LexicalPhrase): the lex rule set PROJECTS
from the construct's FIXED-spelling spans via `phrase_to_lex_rules(p: phrase([...]))`,
exactly as the bound-token sibling `bash_env_prefixed_cargo_lex` does — NOT a direct
rule constructor (the "authored three times that could silently disagree" anti-pattern).
Only the `exit ` keyword is a fixed span; the exit code is an emit-time BOUND token
(^bash_token_exit_code via binding_spellings), so it contributes no literal lex rule —
preserving the original single-rule behavior bit-for-bit.

NOTE: this is a tighter fix than the two-span suggestion (incl. the code span) —
a LexicalPhrase is fixed-spelling-only by contract, so the bound code cannot be a
span; a literal span for it would over-generate a spurious rule. Confirmed with the
bash arc owner (warm-badger-46) who also cleared the colliding bash_lex_rule
constructor in #5363.

Verified by execution (prebuilt claim_batch, --source-root dsl --source-root src/v2):
  - bash_emit_command_test.dag now RESOLVES clean (43 modules, was resolve-FAIL)
  - bash_emit_command_accepts / bash_emit_bound_words: PASS
  - bash_emit_exit_code_{0,1}: PASS
  - bash_emit_exit_code_1_quoted_wrong_{ne_correct,model,rejects}: PASS (discriminating RED intact)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@briansrls

Copy link
Copy Markdown
Contributor Author

Superseded — #5356 merged first (01:58Z) carrying a byte-identical inline copy of this one-span bash_exit_code_lex fix, so main HEAD 028022c already contains this exact line and its CI is green. Closing as a redundant no-op (not rebase-to-empty), per coordination with the bash arc owner @warm-badger-46 who tracked all three racing fixes. Main-red resolved.

@briansrls briansrls closed this Jun 20, 2026
@briansrls
briansrls deleted the hotfix/bash-exit-code-lex-phrase branch June 20, 2026 02:11
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