Skip to content

fix!: re-exec config preservation, protocol state names, test coverage#8

Merged
nazq merged 1 commit intomainfrom
fix/work-items
Mar 15, 2026
Merged

fix!: re-exec config preservation, protocol state names, test coverage#8
nazq merged 1 commit intomainfrom
fix/work-items

Conversation

@nazq
Copy link
Copy Markdown
Owner

@nazq nazq commented Mar 15, 2026

Summary

  • Fix non-detached hm run re-exec to preserve all resolved config (including [[env]], classifier thresholds, kill_process_group) via temp TOML serialization instead of reconstructing CLI flags
  • Fix hm status state-name rendering to use protocol-global names instead of local classifier config
  • Extract pure logic from pty.rs (prepare_argv, prepare_env, signal_target) for unit testability
  • Refactor terminal.rs rendering to accept generic AsyncWrite — tests now call real functions
  • Add kill_process_group semantic tests (grandchild survives/dies)
  • Add subscribed-mode socket protocol tests
  • Add non-detached re-exec e2e tests (Python/pexpect)
  • 254 tests (181 unit + 73 integration), 92% coverage

Test plan

  • cargo test — 181 unit + 73 integration, all passing
  • cargo clippy --tests -- -W clippy::all — zero warnings
  • cargo fmt -- --check — clean
  • uv run pytest tests/ -v — 22 Python tests passing
  • just cov — 92% line coverage
  • Config round-trip verified: serialize → deserialize preserves all fields including [[env]]
  • Non-detached re-exec proven: env injection, session_env_var, kill_process_group survive
  • Protocol state names stable across classifier mismatch

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 15, 2026

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

Fix the non-detached `hm run` re-exec path to preserve all resolved
config. The supervisor now serializes the full Config to a temp TOML
file and passes it via --config, preserving [[env]], classifier
thresholds, kill_process_group, session_env_var, and log_filter
across the re-exec boundary. The temp config is cleaned up by
CleanupGuard on session exit.

- Fix to_detach_args() to serialize full resolved config to temp file
  instead of reconstructing CLI flags (which dropped env, classifier
  thresholds, and other config-only state)
- Fix hm status state-name rendering: use protocol-global state names
  instead of local classifier config, preventing "unknown" for valid
  states when classifier configs differ between session and client
- Add protocol::state_name() for protocol-level state byte mapping
- Remove state_name from StateClassifier trait (test-only now)
- Add Config::to_toml() with Serialize for Config, ClassifierConfig,
  EnvVar for round-trip config serialization
- Add CleanupGuard config_path for ephemeral config file cleanup
- Extract pure logic from pty.rs: prepare_argv(), prepare_env(),
  signal_target() — unit testable without fork/exec
- Refactor terminal.rs rendering to accept generic AsyncWrite for
  testability — tests now call real draw_status_bar, setup_status_bar,
  resize_status_bar, reset_scroll_region instead of shadow copies
- Add kill_process_group semantic tests: grandchild survives with
  false, dies with true (setsid isolation for clean signal contract)
- Add subscribed-mode socket tests: input, status, resize, kill, and
  unknown frames while subscribed
- Add non-detached re-exec e2e tests: env injection, session_env_var,
  kill_process_group all survive the re-exec path (Python/pexpect)
- Add merge_run_args unit tests: CLI/config precedence, classifier
  switch, defaults, unknown classifier error
- Fix codecov badge token in README
- Add .gitignore entries for profraw and lcov.info
- Add libc dev-dependency for process-group tests
- 254 tests (181 unit + 73 integration), 92% coverage, all passing
@nazq nazq merged commit 19ddda1 into main Mar 15, 2026
6 checks passed
@nazq nazq deleted the fix/work-items branch March 15, 2026 03:35
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