Skip to content

2-emit-partition (b1a): v2 bash whole-program serializer foundation (direct-variant coverage) - #6149

Merged
briansrls merged 4 commits into
mainfrom
session/fierce-lark-783-b-bash-defork
Jul 2, 2026
Merged

briansrls merged 4 commits into
mainfrom
session/fierce-lark-783-b-bash-defork

Conversation

@briansrls

@briansrls briansrls commented Jul 2, 2026 •

Copy link
Copy Markdown
Contributor

(b) bash grammar de-fork — foundation slice (b1a)

First slice of the bash de-fork (node 2-emit-partition (b)). The dsl fork extdeps.languages.bash.program hand-rolls serialize_bash(ShellProgram) -> String, consumed by ~17 modules; the v2 grammar authority (bash_command_fold) had no whole-program serializer (only per-construct builders). This adds one.

What this lands

  • New authority module src/v2/extdeps/languages/bash_program_fold.dag: bash_program_serialize(ShellProgram) -> Outcome<String> — folds statements through the existing v2 grammar fold (bash_fold_stmt_emitted_witness + bash_fold_target_model_for_stmt_witness + emit), newline-joins with trailing \n per stmt, and applies the set -e prefix — matching dsl serialize_bash's shape exactly. Composes existing surfaces; no change to the fold mechanism.
  • Byte-oracle test src/v2/test/claim/bash_program_fold_test.dag: bash_program_serialize == dsl serialize_bash byte-for-byte on a multi-statement program (set -e + command + assign), green by execution, plus a set_e-discriminating tooth.

Scope (honest)

Covers the direct target-model statement variants (Command/Assign/Exit/AndOr/Pipe/If/simple-Subshell). The delegated variants (RawLine/WithRedir/Heredoc/Negation/EnvPrefixed/Subshell-with-delegated-body) and the word gaps (Concat/CmdSubst/Raw, plus BraceGroup) currently Reject — their serialization machinery exists but is test-local and needs promotion into the authority. That + the ~17-consumer migration + breaking bash_command_fold's dsl self-import are the named follow-on slices (b1b / b2 / b3). This slice de-risks the architecture: proves v2 can serialize a whole bash program byte-identical to the fork.

🤖 Generated with Claude Code

@gunbai-bot gunbai-bot Bot changed the title 2-emit-partition — shell/json/yaml as grammar rows, zero language knowledge in the wrong layer (UN-GATED: operator merged #6106 registry dispatch). Four leftovers per the roadmap node: (a) retire orchestration->bash lowering from 05_emit_orchestration.dag via the #6106 registry mechanism (welded env 2-emit-partition (b1a): v2 bash whole-program serializer foundation (direct-variant coverage) Jul 2, 2026
@gunbai-bot
gunbai-bot Bot marked this pull request as ready for review July 2, 2026 07:11
@briansrls
briansrls merged commit a3a206c into main Jul 2, 2026
1 of 2 checks passed
@briansrls
briansrls deleted the session/fierce-lark-783-b-bash-defork branch July 2, 2026 07:24
@gunbai-bot

gunbai-bot Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

All three findings addressed in the pushed fix — thank you, these were correct catches.

Layering (surfaced by CI, related): the module was in extdeps but imports v2.compiler.emit — an extdeps→compiler inversion. Moved to src/v2/workflow/bash_program_emit.dag (workflow may import compiler+extdeps; all imports now point toward std). Whole-program serialization inherently needs emit(), so its home cannot be extdeps; it's a language-specific workflow consumer, keeping compiler stages agnostic.

Finding 1 (medium-as-string): took the on-carrier scaffold-marker option you offered. Added bash_program_serialize_medium_join_scaffold naming the dissolution trigger — the set-e prefix and newline join become bash grammar productions emitted through the fold, mirroring the existing orchestration seq2 join (orch_construct_seq2 / orch_seq2_target_model), so serialization runs with zero concat. Tracked as the (b1b) follow-on.

Finding 2 (single authority): added bash_program_serialize_single_authority_reconciliation — bash_program_serialize is declared THE single v2 ShellProgram→String authority; serialize_bash is the scaffold-to-delete, dissolution = (b3) migration of its ~17 consumers + deletion. The coexisting pair is honestly-marked incremental de-fork debt with a named owner, not two co-equal authorities; the test oracle is the git-historical byte-reference the grammar surface is proven identical against.

Finding 3: facts_lookup is a fail-closed sentinel identical in shape to orch_emit_facts_lookup (05_emit_orchestration.dag:44) — direct-variant emit never consults facts (the oracle witness is green/Accepted, never Rejected). Renamed bash_program_fold_*→bash_program_emit_* for module consistency.

— sent from fierce-lark-783

briansrls added a commit that referenced this pull request Jul 2, 2026
…direct-variant coverage) (#6149)

* WIP: 2-emit-partition — shell/json/yaml as grammar rows, zero language knowle

* wip(b1): bash whole-program serialize driver + byte-oracle test

* remove throwaway verify plan

* WIP: 2-emit-partition — shell/json/yaml as grammar rows, zero language knowle

---------

Co-authored-by: Brian Searls <briansearls1@gmail.com>
briansrls added a commit that referenced this pull request Jul 2, 2026
…direct-variant coverage) (#6149)

* WIP: 2-emit-partition — shell/json/yaml as grammar rows, zero language knowle

* wip(b1): bash whole-program serialize driver + byte-oracle test

* remove throwaway verify plan

* WIP: 2-emit-partition — shell/json/yaml as grammar rows, zero language knowle

---------

Co-authored-by: Brian Searls <briansearls1@gmail.com>
@gunbai-bot gunbai-bot Bot mentioned this pull request Jul 2, 2026
6 tasks
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