Skip to content

refactor(cli): reorder functions and tests top-down by behavior - #1226

Merged
hakula139 merged 1 commit into
mainfrom
refactor/reorder-ox-cli
Dec 6, 2026
Merged

hakula139 merged 1 commit into
mainfrom
refactor/reorder-ox-cli

Conversation

@hakula139

Copy link
Copy Markdown
Member

Summary

Pure function and test reordering cleanup across crates/ox/ with zero behavior changes, following top-down caller-to-callee ordering and grouping tests by behavior with normal cases before error cases:

  • crates/ox/src/lib.rs: alphabetize Command variants (Acp, Chat, Complete, Mcp, Run, Sessions) and mirror that order in run(), dispatch(), subcommand enums, and command helpers.
  • crates/ox/src/mcp.rs: order functions top-down (resolve_socket_path, run_mcp_list, run_mcp_call, parse_tool_arguments, send_rpc_request).
  • crates/ox/src/runtime.rs: place entrypoints (resolve_reasoning_effort, resolve_provider, resolve_provider_with_default, resolve_runtime_from_config) above their private helpers, group resolve_tui_preset tests next to resolve_theme tests, place resolve_provider_reports_config_and_lookup_errors after normal resolve_provider* tests, and move assert_clamped_efforts to the bottom helper block.
  • crates/ox/src/workspace.rs and crates/ox/src/workspace/plugins.rs: place assemble_agent above assemble_agent_with_plugins, and order plugin wiring top-down (build_tools_and_plugins, spawn_plugins_and_hooks, spawn_plugins, shutdown_plugins, build_tool_registry).
  • crates/ox/src/headless.rs: place render_agent_stream above StreamRenderer with ensure_newline below handle_event, group run_agent_with_io_sends_loaded_attachments_in_user_message with the run_agent_with_io_* tests, and place render_agent_stream_reports_compaction_to_stderr before render_agent_stream_handles_error_and_unexpected_close.
  • crates/ox/src/interactive.rs: place run_acp above AcpSessionFactory, and place open_state_store_gracefully in call order under build_chat_agent_with_default_config.
  • crates/ox/tests/cli_run.rs: move list_session_ids to the top helper block and group run_no_session_does_not_create_session_db next to run_session_lifecycle.

Test plan

  • nix develop -c run-hooks passed (format, spelling, and Clippy across all targets).
  • cargo test -p ox passed (60 unit tests and 14 integration tests across cli, cli_acp, cli_run, and mcp_cli).

@hakula139 hakula139 added refactor Behavior-preserving restructuring area: cli Touches CLI argument parsing, subcommands, or headless execution labels Dec 6, 2026
@hakula139 hakula139 self-assigned this Dec 6, 2026
@codecov

codecov Bot commented Dec 6, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.72340% with 6 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
crates/ox/src/interactive.rs 91.83% 4 Missing ⚠️
crates/ox/src/mcp.rs 96.66% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@hakula139
hakula139 merged commit e4d5f7e into main Dec 6, 2026
7 checks passed
@hakula139
hakula139 deleted the refactor/reorder-ox-cli branch December 6, 2026 10:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: cli Touches CLI argument parsing, subcommands, or headless execution refactor Behavior-preserving restructuring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant