Skip to content

Jier/modularize code base continue#1

Merged
jier merged 22 commits intomainfrom
jier/modularize-code-base-continue
Dec 22, 2025
Merged

Jier/modularize code base continue#1
jier merged 22 commits intomainfrom
jier/modularize-code-base-continue

Conversation

@jier
Copy link
Copy Markdown
Owner

@jier jier commented Dec 22, 2025

Overview

This PR focuses on a broad refactoring effort aimed at improving modularity, separation of concerns, and testability across the codebase. Significant progress has been made in rendering, validation, complexity analysis, and orchestration, while core.py remains a work in progress pending finalization of the orchestrator design. The orchestrator for the core.py file named core_orchestrated.py can be test from the bash shell script: test_orchestrator_cli.sh


Orchestration and Core Refactoring

  • Introduced an orchestrated implementation for role documentation generation via core_orchestrated.py, gated by the DOCSIBLE_USE_ORCHESTRATOR environment variable.
  • Added RoleOrchestrator as part of a phased refactor to replace the legacy doc_the_role() flow.
  • Continued refactoring of core.py, explicitly marked as work in progress until the orchestrator API stabilizes.
  • Added a shell-based CLI test script to validate orchestrator behavior across parameter combinations.

README Rendering Modularization

  • Refactored the README rendering pipeline into dedicated processors:

    • TemplateProcessor
    • MetadataProcessor
    • TagProcessor
    • FileWriter
  • Introduced the RenderContext model to replace a function signature with 25+ parameters.

  • Kept the external rendering API stable while restructuring internals.

  • Added migration documentation to guide adoption of the new rendering flow.

  • Improved logging around template resolution for easier debugging.


Validation Framework Improvements

  • Continued modularization of validation logic with clearer separation of concerns.
  • Simplified scoring logic and adjusted tests accordingly.
  • Refactored validator models into dedicated modules.
  • Cleaned up validator tests and resolved Pydantic configuration warnings.
  • Strengthened type hints and validation checks in rendering-related models.

Complexity, Maintainability, and Security Analysis

  • Completed modularization of the complexity analyzer.

  • Introduced Suggestion classes to encapsulate recommendation logic for:

    • Complexity
    • Maintainability
    • Security
  • Refactored detectors to delegate suggestion generation to these classes.

  • Added and refined unit tests, including coverage for include-depth calculation and cycle detection.


Test Suite Reorganization

  • Reorganized tests to mirror folder and module structure.
  • Renamed integration tests to end_to_end for clarity.
  • Broke down large integration tests into smaller, testable units.
  • Finalized refactoring of test paths and fixed broken references.

Documentation and Project Configuration

  • Updated refactoring assessment plans and migration strategy documentation.

  • Enhanced pyproject.toml with:

    • Optional development dependencies
    • Updated classifiers
    • Improved linting and type-checking configuration
  • Performed general codebase cleanup prior to merge.


Current State

  • The orchestrator-based flow is functional but still evolving.
  • core.py refactoring is intentionally incomplete and will be finalized once orchestration responsibilities are fully defined.
  • The codebase is now significantly more modular, testable, and maintainable, with a clearer path for completing the remaining core refactor.

jier added 22 commits December 19, 2025 12:53
…uggestion classes

- Introduced Suggestion classes for complexity, maintainability, and security detectors to encapsulate suggestion strings.
- Updated ComplexityDetector to utilize new Suggestion methods for complex conditionals, excessive set facts, and deep include chains.
- Refactored MaintainabilityDetector to use Suggestion methods for missing idempotency, monolithic main files, magic values, check mode, variable shadowing, and missing failed_when.
- Updated SecurityDetector to leverage Suggestion methods for exposed secrets, missing no_log, insecure permissions, and shell injection risks.
- Added unit tests for calculating include depth in ComplexityDetector, including cycle detection.
- Improved MarkdownValidator with constants for better readability and maintainability.
…s, keep API work the same way, work in progress
…tructure

- Removed unused feature flags from render_flags.py.
- Introduced FileWriter, MetadataProcessor, TagProcessor, TemplateProcessor classes for better separation of concerns.
- Updated ReadmeRenderer to utilize new processors for template loading, content merging, and file writing.
- Added RenderContext model to simplify parameter passing in rendering functions.
- Implemented tests for new processors and RenderContext to ensure functionality and reliability.
- Added migration guide to move away from 25+ params render_role to render_context
- Added `core_orchestrated.py` for orchestrated implementation of role documentation generation, enabled via `DOCSIBLE_USE_ORCHESTRATOR` environment variable.
- Updated `template_processor.py` and `readme_renderer.py` to include debug logging for template paths.
- Enhanced `pyproject.toml` with optional dependencies for development, updated classifiers, and improved configuration for linting and type checking.
- Created `test_orchestrator_cli.sh` for testing various CLI parameter combinations with the orchestrator.
- Added metadata and example files for a complex role in the fixtures directory.
- Updated tests for render context to include type hints and validation checks.
@jier jier merged commit c038308 into main Dec 22, 2025
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.

1 participant