Make session lifecycle state explicit #38

Merged
Lochnair merged 2 commits from refactor/session-machine-state into main 2026-08-03 16:41:59 +00:00
Lochnair commented 2026-08-03 16:37:32 +00:00 (Migrated from github.com)

Summary

  • Move the private session runtime into the session module.
  • Separate parameter negotiation into session/negotiation.rs.
  • Rename SessionRuntime to SessionMachine.
  • Replace parallel optional lifecycle fields with one explicit private MachineState.
  • Box the open-session payload to satisfy strict Clippy size checks.

Architectural rationale

Representing connected, open, no-test-completed, and closed states as enum
variants makes contradictory lifecycle combinations unrepresentable. Open-only
state is owned by ActiveSession, while terminal packet counts remain available
after close. Public exports and observable behavior remain unchanged.

Testing

  • cargo fmt --all -- --check
  • cargo check --workspace
  • cargo test --workspace
  • cargo check -p irtt-client --no-default-features
  • cargo test -p irtt-client --no-default-features
  • cargo clippy -p irtt-client --all-targets --no-default-features -- -D warnings
  • git diff --check
## Summary - Move the private session runtime into the session module. - Separate parameter negotiation into `session/negotiation.rs`. - Rename `SessionRuntime` to `SessionMachine`. - Replace parallel optional lifecycle fields with one explicit private `MachineState`. - Box the open-session payload to satisfy strict Clippy size checks. ## Architectural rationale Representing connected, open, no-test-completed, and closed states as enum variants makes contradictory lifecycle combinations unrepresentable. Open-only state is owned by `ActiveSession`, while terminal packet counts remain available after close. Public exports and observable behavior remain unchanged. ## Testing - `cargo fmt --all -- --check` - `cargo check --workspace` - `cargo test --workspace` - `cargo check -p irtt-client --no-default-features` - `cargo test -p irtt-client --no-default-features` - `cargo clippy -p irtt-client --all-targets --no-default-features -- -D warnings` - `git diff --check`
Sign in to join this conversation.