Skip to content

refactor(cli): unify ado get handling for all resources#854

Merged
AlessandroPomponio merged 5 commits into
mainfrom
ap_848_unify_ado_get_handling
Apr 15, 2026
Merged

refactor(cli): unify ado get handling for all resources#854
AlessandroPomponio merged 5 commits into
mainfrom
ap_848_unify_ado_get_handling

Conversation

@AlessandroPomponio
Copy link
Copy Markdown
Member

Summary

This pull request refactors the ado get command handlers across all resource types to use a unified handle_ado_get() function. The changes consolidate duplicated output formatting logic, improve code maintainability, and provide a consistent interface for handling different output formats (TABLE, NAME, YAML, JSON, CONFIG, RAW).

Resolves #848

Files Changed

📄 orchestrator/cli/resources/actuator/get.py

Refactored to use the unified handle_ado_get() handler instead of custom table rendering logic. Removed manual NAME format handling and imports for rich.box, dataframe_to_rich_table, and ADO_INFO_EMPTY_DATAFRAME.

📄 orchestrator/cli/resources/actuator_configuration/get.py

Simplified to use a single handle_ado_get() call instead of branching between handle_ado_get_default_format() and handle_ado_get_special_formats(). Removed conditional logic for different output formats.

📄 orchestrator/cli/resources/context/get.py

Refactored to use handle_ado_get() for both NAME and TABLE formats (using DataFrame), and for structured formats (YAML, JSON, CONFIG) using resources. Removed manual table rendering and custom formatting logic.

📄 orchestrator/cli/resources/data_container/get.py

Simplified to a single handle_ado_get() call, removing the conditional logic that branched between TABLE and other output formats. Cleaned up imports.

📄 orchestrator/cli/resources/discovery_space/get.py

Refactored all three code paths (matching_point, matching_space, and standard) to use handle_ado_get(). Removed manual table rendering with dataframe_to_rich_table() and custom format handling. Removed unused imports.

📄 orchestrator/cli/resources/experiment/get.py

Replaced manual table rendering logic with handle_ado_get() call. Moved empty DataFrame check inside the sort operation to handle it more gracefully. Removed imports for rich.box, dataframe_to_rich_table, and ADO_INFO_EMPTY_DATAFRAME.

📄 orchestrator/cli/resources/measurement_request/get.py

Simplified to use handle_ado_get() for rendering measurement request resources. Removed manual formatting with format_resource_for_ado_get_custom_format() and the "getting output ready" spinner.

📄 orchestrator/cli/resources/operation/get.py

Simplified to a single handle_ado_get() call, removing conditional branching between TABLE and other formats. Cleaned up imports.

📄 orchestrator/cli/resources/operator/get.py

Refactored to use handle_ado_get() with DataFrame, removing manual NAME format handling and table rendering logic. Removed imports for rich.box and dataframe_to_rich_table.

📄 orchestrator/cli/resources/sample_store/get.py

Simplified to a single handle_ado_get() call, removing conditional logic for different output formats. Cleaned up imports.

📄 orchestrator/cli/utils/resources/handlers.py

Major refactoring that introduces the unified handle_ado_get() function and format-specific handlers (_handle_name_format(), _handle_table_format(), _handle_raw_format(), _handle_structured_formats()). This consolidates logic from the removed handle_ado_get_default_format() and handle_ado_get_special_formats() functions, providing a single entry point that delegates to efficient, format-specific implementations. Added helper function _write_or_print_output() for consistent output handling.

Signed-off-by: Alessandro Pomponio <alessandro.pomponio1@ibm.com>
Signed-off-by: Alessandro Pomponio <alessandro.pomponio1@ibm.com>
Signed-off-by: Alessandro Pomponio <alessandro.pomponio1@ibm.com>
Signed-off-by: Alessandro Pomponio <alessandro.pomponio1@ibm.com>
Signed-off-by: Alessandro Pomponio <alessandro.pomponio1@ibm.com>
Copy link
Copy Markdown
Member

@christian-pinto christian-pinto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@AlessandroPomponio AlessandroPomponio added this pull request to the merge queue Apr 15, 2026
Merged via the queue into main with commit 4cf88f1 Apr 15, 2026
19 checks passed
@AlessandroPomponio AlessandroPomponio deleted the ap_848_unify_ado_get_handling branch April 15, 2026 13:01
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.

refactor(cli): unify handling of ado get for all resource types

2 participants