cursus.validation.alignment¶
Unified Alignment Tester Module
This module provides comprehensive validation of alignment rules between scripts, contracts, specifications, and builders in the pipeline architecture.
The alignment validation covers four levels: 1. Script ↔ Contract Alignment 2. Contract ↔ Specification Alignment 3. Specification ↔ Dependencies Alignment 4. Builder ↔ Configuration Alignment
Consolidated Structure (Post Phase 4): - config/: Configuration and validation rulesets - core/: Core alignment testers for each level - reporting/: Consolidated reporting and scoring (validation_reporter.py) - utils/: Consolidated utilities and models (validation_models.py) - validators/: Remaining validation logic and rules
- class UnifiedAlignmentTester(workspace_dirs=None, **kwargs)[source]¶
Bases:
objectEnhanced Unified Alignment Tester with configuration-driven validation.
This class orchestrates validation across all levels based on step-type-aware configuration rules, providing dramatic performance improvements through validation level skipping.
- export_report(format='json', output_path=None)[source]¶
Export validation report - enhanced with configuration insights.
- get_component_path_from_catalog(step_name, component_type)[source]¶
Get component file path from step catalog - maintained for backward compatibility.
- get_critical_issues()[source]¶
Get critical validation issues - step-type-aware critical issue analysis.
- get_step_info_from_catalog(step_name)[source]¶
Get step information from step catalog - maintained for backward compatibility.
- run_full_validation(target_scripts=None, skip_levels=None)[source]¶
Enhanced run_full_validation with configuration-driven approach.
- run_validation_for_step(step_name)[source]¶
Run validation for a specific step based on its ruleset.
- validate_cross_workspace_compatibility(step_names)[source]¶
Validate compatibility across workspace components - simplified with configuration.
- class ScriptContractAlignmentTester(workspace_dirs=None)[source]¶
Bases:
objectTests alignment between processing scripts and their contracts.
Validates: - Path usage matches contract declarations - Environment variable access matches contract - Script arguments align with contract expectations - File operations match declared inputs/outputs
- class SpecificationDependencyAlignmentTester(validation_config=None, workspace_dirs=None)[source]¶
Bases:
objectTests alignment between step specifications and their dependencies.
Validates: - Dependency chains are consistent - All dependencies can be resolved - No circular dependencies exist - Data types match across dependency chains
- get_dependency_resolution_report(all_specs)[source]¶
Generate detailed dependency resolution report using production resolver.
- validate_all_specifications(target_scripts=None)[source]¶
Validate alignment for all specifications or specified target scripts.
This method uses StepCatalog’s bulk loading for efficiency.
- class DependencyValidator(validation_config=None)[source]¶
Bases:
objectValidates dependencies between step specifications.
Features: - Enhanced dependency resolution with compatibility scoring - Circular dependency detection - Data type consistency validation - Integration with production registry for canonical name mapping
- get_dependency_resolution_report(all_specs)[source]¶
Generate detailed dependency resolution report using production resolver.
- validate_circular_dependencies(specification, all_specs, spec_name)[source]¶
Validate that no circular dependencies exist.
- validate_dependency_data_types(specification, all_specs, spec_name)[source]¶
Validate data type consistency across dependency chains.
- class SageMakerPropertyPathValidator[source]¶
Bases:
objectValidates SageMaker step property paths against official documentation.
This validator ensures that property paths used in step specifications are valid for the specific SageMaker step type, preventing runtime errors in pipeline execution.
- get_step_type_documentation(step_type, node_type='')[source]¶
Get documentation information for a specific step type.
- class ValidationLevel(*values)[source]¶
Bases:
EnumThe 3 validation BOUNDARIES — what construction can’t self-check (FZ 31e1d3h / Phase D5).
The unified
.step.yamlmade Contract<->Spec alignment a construction-time Pydantic invariant (StepInterface._sync_and_align), so the former Level-2 (CONTRACT_SPEC=2) validated a tautology and has been removed. The three surviving levels are renamed in SEMANTICS to the 3 boundaries — SCRIPT_CONTRACT is the Script<->Interface fidelity boundary (B1), SPEC_DEPENDENCY is the cross-step DAG-resolvability boundary (B2, which now also owns the SageMaker property-path check folded in from the old L2), and BUILDER_CONFIG is the registry<->handler<->config binding boundary (B3). The member NAMES + integer VALUES are kept (1/3/4, non-contiguous) soValidationLevel(1/3/4)coercion and every existing reference keep working; onlyCONTRACT_SPEC(value 2) is gone.- SCRIPT_CONTRACT = 1¶
- SPEC_DEPENDENCY = 3¶
- BUILDER_CONFIG = 4¶
- class ValidationStatus(*values)[source]¶
Bases:
EnumStatus of validation operations.
- PASSED = 'PASSED'¶
- FAILED = 'FAILED'¶
- EXCLUDED = 'EXCLUDED'¶
- ERROR = 'ERROR'¶
- ISSUES_FOUND = 'ISSUES_FOUND'¶
- PASSED_WITH_WARNINGS = 'PASSED_WITH_WARNINGS'¶
- NO_VALIDATOR = 'NO_VALIDATOR'¶
- COMPLETED = 'COMPLETED'¶
- class IssueLevel(*values)[source]¶
Bases:
EnumSeverity levels for validation issues.
- ERROR = 'ERROR'¶
- WARNING = 'WARNING'¶
- INFO = 'INFO'¶
- class RuleType(*values)[source]¶
Bases:
EnumTypes of validation rules.
- UNIVERSAL = 'universal'¶
- STEP_SPECIFIC = 'step_specific'¶
- METHOD_INTERFACE = 'method_interface'¶
- CONFIGURATION = 'configuration'¶
- class ValidationIssue(level, message, method_name=None, rule_type=None, details=None, step_name=None, file_path=None, line_number=None)[source]¶
Bases:
objectRepresents a validation issue found during alignment checking.
- level: IssueLevel¶
- class ValidationResult(status, step_name, validation_level=None, issues=None, metadata=None, error_message=None)[source]¶
Bases:
objectRepresents the result of a validation operation.
- issues: List[ValidationIssue] = None¶
- validation_level: ValidationLevel | None = None¶
- status: ValidationStatus¶
- class MethodValidationInfo(method_name, is_required, expected_signature=None, return_type=None, purpose=None, validation_rules=None)[source]¶
Bases:
objectInformation about method validation requirements.
- class StepValidationContext(step_name, step_type, builder_class_name=None, workspace_dirs=None, validation_config=None)[source]¶
Bases:
objectContext information for step validation.
- create_validation_issue(level, message, method_name=None, rule_type=None, details=None, **kwargs)[source]¶
Create a validation issue with proper type conversion.
- create_validation_result(status, step_name, validation_level=None, issues=None, **kwargs)[source]¶
Create a validation result with proper type conversion.
Modules
Restored Script Analysis Module |
|
Validation Alignment Configuration Module |
|
Core Alignment Testers Module |
|
Reporting and Visualization Module |
|
Enhanced Unified Alignment Tester |
|
Utilities and Models Module |
|
Validators Module |