cursus.validation.alignment.core

Core Alignment Testers Module

This module contains the core alignment validation logic for all four alignment levels. Each tester focuses on a specific alignment relationship in the pipeline architecture.

Alignment Levels: 1. Script ↔ Contract Alignment (Level 1) 2. Contract ↔ Specification Alignment (Level 2) 3. Specification ↔ Dependencies Alignment (Level 3) 4. Builder ↔ Configuration Alignment (Level 4)

Components: - script_contract_alignment.py: Level 1 - Script and contract alignment validation - contract_spec_alignment.py: Level 2 - Contract and specification alignment validation - spec_dependency_alignment.py: Level 3 - Specification and dependency alignment validation - builder_config_alignment.py: Level 4 - Builder and configuration alignment validation

class ScriptContractAlignmentTester(workspace_dirs=None)[source]

Bases: object

Tests 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

get_validation_summary(results)[source]

Generate a summary of validation results.

validate_all_scripts(target_scripts=None)[source]

Validate alignment for all scripts or specified target scripts.

Parameters:

target_scripts (List[str] | None) – Specific scripts to validate (None for all)

Returns:

Dictionary mapping script names to validation results

Return type:

Dict[str, Dict[str, Any]]

validate_script(script_name)[source]

Validate alignment for a specific script.

Parameters:

script_name (str) – Name of the script to validate

Returns:

Validation result dictionary

Return type:

Dict[str, Any]

class SpecificationDependencyAlignmentTester(validation_config=None, workspace_dirs=None)[source]

Bases: object

Tests 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.

Parameters:

target_scripts (List[str] | None) – Specific scripts to validate (None for all)

Returns:

Dictionary mapping specification names to validation results

Return type:

Dict[str, Dict[str, Any]]

validate_specification(spec_name)[source]

Validate alignment for a specific specification.

Parameters:

spec_name (str) – Name of the specification to validate

Returns:

Validation result dictionary

Return type:

Dict[str, Any]

validate_specification_object(specification, spec_name=None)[source]

Validate a pre-loaded specification object.

Parameters:
  • specification (Dict[str, Any]) – Serialized specification dictionary

  • spec_name (str) – Optional specification name for context

Returns:

Validation result dictionary

Return type:

Dict[str, Any]

Modules

level3_validation_config

Level 3 Validation Configuration

level_validators

Level Validators

script_contract_alignment

Script ↔ Contract Alignment Tester

spec_dependency_alignment

Specification ↔ Dependencies Alignment Tester