Skip to content

test(cli): cover bang_shell parser and session-gate helpers - #98400

Open
salch-cred wants to merge 1 commit into
NousResearch:mainfrom
salch-cred:test-hermes-cli-bang-shell
Open

salch-cred wants to merge 1 commit into
NousResearch:mainfrom
salch-cred:test-hermes-cli-bang-shell

Conversation

@salch-cred

Copy link
Copy Markdown
Contributor

Why

bang_shell powers the !<command> shell mode — a zero-token-cost shortcut the CLI relies on. The three pure helpers (is_bang_command, parse_bang_command, bang_shell_enabled) had no direct test coverage.

What

tests/hermes_cli/test_bang_shell.py:

  • is_bang_command: leading !, leading spaces + !, bare !, mid-text ! not matched, empty string, None, non-string, double !!.
  • parse_bang_command: strips !, strips spaces after !, bare ! → empty, !!!, leading spaces, non-bang → empty, None → empty, multi-word command preserved.
  • bang_shell_enabled: enabled in plain local session, disabled by HERMES_GATEWAY_SESSION, disabled by HERMES_CRON_SESSION, disabled when HERMES_SESSION_PLATFORM set, enabled when platform is empty string.
  • Constants sanity: DEFAULT_TIMEOUT > 0, USAGE_HINT mentions !.

@alt-glitch alt-glitch added type/test Test coverage or test infrastructure P3 Low — cosmetic, nice to have comp/cli CLI entry point, hermes_cli/, setup wizard tool/terminal Terminal execution and process management labels Aug 30, 2026
@Enough1122

Copy link
Copy Markdown
Contributor

AI code review — automated review for reference; please use your judgment.

Overall: Adds tests for bang_shell parser helpers.

What it does

  • New tests/hermes_cli/test_bang_shell.py covers is_bang_command (leading !, spaces, bare !, mid-text false, empty/None/non-string, !!), parse_bang_command (strip ! and spaces, bare ! empty, !! -> !, multiword), and bang_shell_enabled — pure helpers for ! shell mode, no subprocess execution to keep suite fast.

No issues found.

Non-blocking — please use your judgment.

@kvnloo

kvnloo commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Exact-head comment on #98400 head 2ff7a27.

KEEP pure unit coverage for is_bang_command / parse_bang_command / bang_shell_enabled / USAGE_HINT / DEFAULT_TIMEOUT in tests/hermes_cli/test_bang_shell.py — parser mid-text !, leading spaces, !!, None/non-string, and session-gate env helpers. Complements (does not replace) #81989's timeout/drain execution tests.

CHECK: no subprocess execution here (author correctly scoped). CHECK: stay green if bang_shell_enabled gate env names move — pin the current public helpers only. CHECK: do not expand this PR into a second interactive PTY bang shell (#100017 already open).

Author salch-cred not kvnloo. No competing PR from me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard P3 Low — cosmetic, nice to have tool/terminal Terminal execution and process management type/test Test coverage or test infrastructure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants