📝 CodeRabbit Chat: Implement requested code changes - #78
📝 CodeRabbit Chat: Implement requested code changes#78coderabbitai[bot] wants to merge 2 commits into
Conversation
Add a runtime `CommandRunner` port and subprocess adapter so production commands depend on a stable command-execution abstraction. Move cmd-mox IPC and passthrough handling into `lading.testing`, then select that adapter once at the CLI boundary when `LADING_USE_CMD_MOX_STUB` is enabled. Route cargo metadata and publish preflight execution through the selected runner so production modules no longer import the dev-only dependency.
Reviewer's GuideRefactors the cargo metadata loading flow by extracting command invocation and JSON parsing into dedicated helpers, improving error mapping, separation of concerns, and testability while preserving existing behavior. Sequence diagram for refactored cargo metadata loading flowsequenceDiagram
participant Caller
participant load_cargo_metadata
participant _invoke_cargo_metadata_command
participant _parse_cargo_metadata_output
Caller->>load_cargo_metadata: load_cargo_metadata(workspace_root, runner)
load_cargo_metadata->>load_cargo_metadata: normalise_workspace_root(workspace_root)
load_cargo_metadata->>load_cargo_metadata: _active_command_runner(runner)
load_cargo_metadata->>load_cargo_metadata: log_command_invocation(LOGGER, _CARGO_METADATA_COMMAND, root_path)
load_cargo_metadata->>_invoke_cargo_metadata_command: _invoke_cargo_metadata_command(command_runner, root_path)
_invoke_cargo_metadata_command-->>load_cargo_metadata: exit_code, stdout_text, stderr_text
alt exit_code != 0
load_cargo_metadata-->>Caller: CargoMetadataInvocationError(exit_code, stdout_text, stderr_text)
else exit_code == 0
load_cargo_metadata->>_parse_cargo_metadata_output: _parse_cargo_metadata_output(stdout_text)
_parse_cargo_metadata_output-->>load_cargo_metadata: payload
load_cargo_metadata-->>Caller: payload
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Important Review skippedThis PR was authored by the user configured for CodeRabbit reviews. CodeRabbit does not review PRs authored by this user. It's recommended to use a dedicated user account to post CodeRabbit review feedback. ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
Code changes was requested by @leynos.
The following files were modified:
lading/workspace/metadata.pySummary by Sourcery
Refactor cargo metadata handling by separating command invocation from JSON parsing and wiring these helpers into the main loader.
Enhancements:
cargo metadatacommand and normalize its output, mapping process errors to domain-specific exceptions.cargo metadataJSON payload, returning a mapping for valid object responses.load_cargo_metadatato orchestrate command invocation, error handling, and JSON parsing via the new helper functions.