Skip to content

shell: restore variant-aware runtime switches - #782

Merged
ewhauser merged 4 commits into
mainfrom
ewhauser/shell-variant-runtime-switches
Mar 29, 2026
Merged

shell: restore variant-aware runtime switches#782
ewhauser merged 4 commits into
mainfrom
ewhauser/shell-variant-runtime-switches

Conversation

@ewhauser

Copy link
Copy Markdown
Owner

Summary

  • add a resolved shell-variant profile layer as the single source of truth for parser language, diagnostics, runtime defaults, Bash namespace exposure, and audited builtin availability
  • drive runtime behavior from the resolved ShellVariant across core, interpreter, lookup, quoting, trap rendering, xtrace, and parse/reparse helpers
  • gate Bash-only namespace state and audited builtin families by shell variant, update SPEC.md, and add focused runtime/profile coverage

Why

The recent multishell plumbing restored parser-level variant selection, but several runtime helpers still hardcoded Bash behavior. That left gbash with inconsistent shell-specific behavior across parsing, lookup, special vars, and builtin surfaces.

Impact

  • sh now starts with POSIX mode on and braceexpand off
  • mksh and zsh now consistently use their variant parser/diagnostic paths through runtime helpers
  • Bash-only namespace vars and caller are hidden outside bash/bats
  • compgen, complete, compopt, mapfile, readarray, and shopt are only exposed for bash/bats
  • dirs, pushd, and popd are only exposed for bash/zsh
  • type, help, enable -a, completion lookup, and virtual command stubs no longer advertise unsupported builtins as active
  • one stale regex conformance xfail was removed after the new coverage showed gbash now matches bash there

Root Cause

Variant resolution had been reintroduced at the shell-selection layer, but downstream runtime code still fell back to Bash defaults in a number of paths. Builtin lookup and Bash namespace exposure were also not being filtered through one authoritative runtime profile.

Validation

  • go test ./internal/shellvariantprofile ./internal/shell/... ./internal/runtime ./shell/expand/... -count=1
  • go test ./internal/builtins -run 'TestHelp|TestBashRuntime' -count=1
  • go test ./internal/conformance -run 'TestConformance/bash/oils/(builtin-bash|builtin-dirs|builtin-type|regex)\.test\.sh' -count=1 -timeout=20m
  • make lint

@ewhauser
ewhauser marked this pull request as ready for review March 29, 2026 17:26
@ewhauser ewhauser changed the title [codex] shell: restore variant-aware runtime switches shell: restore variant-aware runtime switches Mar 29, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 75566ef916

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/shell/core.go Outdated
Comment thread internal/shell/interp/vars.go

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f74a0509c9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/shell/interp/vars.go Outdated
Comment thread internal/shell/core.go

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 91cd506233

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/shell/interp/runner.go
@ewhauser
ewhauser merged commit db77268 into main Mar 29, 2026
16 checks passed
@ewhauser
ewhauser deleted the ewhauser/shell-variant-runtime-switches branch March 29, 2026 18:00
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