refactor(cli): reorganize parameters module and eliminate code duplication#115
Merged
ryanmccann1024 merged 27 commits intorelease/6.0.0from Sep 10, 2025
Merged
refactor(cli): reorganize parameters module and eliminate code duplication#115ryanmccann1024 merged 27 commits intorelease/6.0.0from
ryanmccann1024 merged 27 commits intorelease/6.0.0from
Conversation
Architecture Plan Phase 2 - Core Decoupling & Simulation Pipeline Implementation
refactor(interfaces): implement abstract interfaces and complete modular architecture migration
Refactor data_scripts to io module
- Fixed TypeError in cross-platform compatibility test - Changed create_input call to use proper parameter names (base_fp, engine_props) - Added default 'data' value for base_fp parameter 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Added thread_num, date, and sim_start fields to sim_params - Fixes KeyError in cross-platform CI tests - Uses default values when fields are not present in config 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Create multiprocessing.Event stop_flag when not provided - Fixes AttributeError in cross-platform CI tests - Ensures SimulationEngine has required stop_flag for proper execution 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Added 'seeds' parameter to engine_props (defaults to None) - Removed Unicode emojis from error messages to fix Windows encoding - Fixes KeyError and UnicodeEncodeError in cross-platform CI tests 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Refactor/cli
# Conflicts: # Architecture Plan v2.md
Extract configuration-related code into focused modules: - fusion/configs/errors.py: Custom configuration exceptions - fusion/configs/constants.py: Configuration constants and defaults - fusion/configs/schema.py: Configuration option schemas with types - fusion/utils/config.py: Reusable configuration utility functions Improves code organization, reduces duplication, and enhances maintainability by separating concerns and creating testable units. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Major improvements to fusion/cli/config_setup.py: - Add comprehensive Sphinx-style docstrings for all public functions - Implement specific exception handling with custom ConfigError types - Extract helper functions to reduce code duplication - Add proper type annotations throughout - Improve variable naming for clarity (other_dict → optional_dict) - Replace broad exception catching with specific error types - Reduce file size from 660+ to ~400 lines through better organization Maintains backward compatibility while significantly improving code quality, readability, and maintainability. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Update import statements across codebase to reference the new configuration module structure: - tests/test_config_args.py: Import from fusion.configs.schema - fusion/unity/make_manifest.py: Update schema imports Ensures all code continues to work with the refactored configuration modules while maintaining existing functionality. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Create CODING_STANDARDS.md with detailed guidelines covering: - Naming conventions (functions, variables, classes, constants) - Data type suffix recommendations for clarity (_dict, _set, etc.) - Code organization and module structure best practices - Documentation standards using Sphinx format - Error handling patterns and custom exceptions - Type annotation requirements and best practices - Import organization and testing standards - Performance and security guidelines Provides a comprehensive reference for consistent code quality across the FUSION project codebase. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Major improvements to fusion/cli/main_parser.py: - Add descriptive function names following coding standards (build_main_argument_parser, create_training_argument_parser, etc.) - Extract constants for argument group configurations - Add comprehensive Sphinx-style docstrings - Add complete type annotations throughout - Maintain backward compatibility with legacy function names - Improve variable naming with data type clarity All legacy functions maintained through compatibility aliases ensuring zero breaking changes to existing code. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Major improvements to run_gui.py, run_sim.py, and run_train.py: - Replace broad exception catching with specific exception types - Add comprehensive error handling with actionable user guidance - Add proper type annotations and Sphinx-style docstrings - Create shared CLI constants module for exit codes - Improve variable naming for clarity (args → gui_arguments, etc.) - Remove repetitive comments and architecture boilerplate - Add helpful error messages with installation commands - Maintain backward compatibility functions Features enhanced user experience with: - Visual feedback using emojis (🛑, ❌, 💡) - Specific error messages for common issues - Actionable troubleshooting suggestions - Clean separation of main logic and process exit handling 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Update fusion/cli/__init__.py to expose new function names and constants: - Add modern function imports (build_main_argument_parser, etc.) - Export shared CLI constants (SUCCESS_EXIT_CODE, ERROR_EXIT_CODE) - Maintain legacy function exports for backward compatibility - Update package documentation to reflect new constants module - Organize imports with clear modern/legacy separation Provides clean migration path while maintaining zero breaking changes for existing code using the CLI package interface. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Polish documentation across CLI module: - Remove repetitive "architecture best practice" phrases from docstrings - Clean up redundant delegate comments that were self-evident - Improve module docstrings with specific functionality descriptions - Maintain consistent documentation quality and tone - Focus docstrings on what modules do rather than architectural principles Results in cleaner, more focused documentation that provides actual value to developers using the CLI modules. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
…ization - Rename fusion/cli/args/ → fusion/cli/parameters/ for clearer naming - Split monolithic simulation_args.py into focused modules: * network.py: Network topology, links, nodes, spectrum bands * routing.py: Routing algorithms, spectrum assignment, SNR, SDN * traffic.py: Traffic generation, Erlang loads, simulation control - Rename files to remove redundant _args suffix: * common_args.py → shared.py * analysis_args.py → analysis.py * snr_args.py → snr.py * training_args.py → training.py - Update all imports and references throughout codebase - Improve docstrings to follow Sphinx documentation standards - Add missing egn_model parameter to SNR configuration - Maintain backward compatibility through registry system 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add fusion/cli/utils.py with standardized entry point patterns - Implement create_entry_point_wrapper() for consistent legacy functions - Implement create_main_wrapper() for simple sys.exit wrappers - Refactor run_gui.py, run_train.py, run_sim.py to use shared utilities - Remove ~75 lines of duplicated boilerplate code across CLI modules - Improve pylint score from 9.95/10 to 10.00/10 - Eliminate duplicate code warnings (R0801) completely - Move imports to top-level and remove unused sys imports - Maintain full backward compatibility for all entry points 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
af5132a to
72df3fa
Compare
- Fixed TypeError in cross-platform compatibility test - Changed create_input call to use proper parameter names (base_fp, engine_props) - Added default 'data' value for base_fp parameter 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Added thread_num, date, and sim_start fields to sim_params - Fixes KeyError in cross-platform CI tests - Uses default values when fields are not present in config 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Create multiprocessing.Event stop_flag when not provided - Fixes AttributeError in cross-platform CI tests - Ensures SimulationEngine has required stop_flag for proper execution 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Added 'seeds' parameter to engine_props (defaults to None) - Removed Unicode emojis from error messages to fix Windows encoding - Fixes KeyError and UnicodeEncodeError in cross-platform CI tests 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
d41d29d to
5a619f7
Compare
arashr88
approved these changes
Sep 9, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description:
This PR completes the CLI organization refactor by restructuring the parameters module for better maintainability and eliminating code duplication across CLI entry points. The work builds on previous CLI modernization efforts to achieve perfect pylint compliance and improved code organization.
🔧 Type of Change
Primary Change Type:
Component(s) Affected:
fusion/cli/)fusion/configs/)fusion/core/)fusion/modules/rl/,fusion/modules/ml/)fusion/modules/routing/)fusion/modules/spectrum/)fusion/modules/snr/)fusion/visualization/)fusion/gui/)fusion/unity/)tests/).github/)🧪 Testing
Test Coverage:
Test Details:
Commands to Reproduce Testing:
Test Results:
📊 Impact Analysis
Performance Impact:
Memory Usage:
Backward Compatibility:
Dependencies:
🔄 Migration Guide
Breaking Changes (if any):
None - all changes maintain backward compatibility
Migration Steps:
No migration required - all existing code continues to work unchanged
✅ Code Quality Checklist
Architecture & Design:
Code Standards:
Configuration & CLI:
Security:
📚 Documentation
Documentation Updates:
Examples Added:
🚀 Deployment
Deployment Considerations:
🔍 Review Guidelines
For Reviewers:
Review Focus Areas:
📝 Additional Notes
Key Commits in this Branch:
5d617c6- refactor: create shared CLI utilities to eliminate code duplicationfusion/cli/utils.pywith reusable entry point patterns4ab2367- refactor: rename CLI args directory to parameters with improved organizationfusion/cli/args/→fusion/cli/parameters/simulation_args.pyinto focused modules_argssuffix from all filesegn_modelparameterPrevious commits (from earlier work on this branch):
0ac76a9- docs: clean up docstrings and remove repetitive comments7e1568b- refactor: update CLI package interface with modern functions5ac7825- refactor: modernize CLI entry points with enhanced error handling6f7091b- refactor: modernize main_parser.py with improved naming and docsQuality Metrics:
Open Questions:
None - implementation is complete and tested
Future Work:
🏁 Final Checklist
Before submitting this PR, confirm: