cursus.registry.validation_utils

Simple validation utilities for step definition standardization.

This module provides lightweight validation for new step creation following the simplified approach from the redundancy analysis. It focuses on essential validation without over-engineering.

Based on: Hybrid Registry Standardization Enforcement Implementation Plan Redundancy Target: 15-20% (vs 30-35% in original design) Implementation Size: ~50-100 lines (vs 1,200+ in original design)

validate_new_step_definition(step_data)[source]

Validate new step definition with essential checks only.

This function provides the core validation logic identified as essential in the redundancy analysis, focusing on preventing naming violations during new step creation. Optimized for <1ms performance.

Parameters:

step_data (Dict[str, Any]) – Dictionary containing step definition data

Returns:

List of error messages (empty if validation passes)

Return type:

List[str]

auto_correct_step_definition(step_data)[source]

Auto-correct step definition with simple regex-based fixes.

This function applies the simple auto-correction approach identified in the redundancy analysis, using regex patterns to fix common naming violations.

Parameters:

step_data (Dict[str, Any]) – Dictionary containing step definition data

Returns:

Corrected step data dictionary

Return type:

Dict[str, Any]

to_pascal_case(text)[source]

Convert text to PascalCase using simple regex patterns.

This utility function provides the essential PascalCase conversion identified as necessary in the redundancy analysis. Optimized with LRU cache for performance.

Parameters:

text (str) – Input text to convert

Returns:

PascalCase version of the text

Return type:

str

get_validation_errors_with_suggestions(step_data)[source]

Get validation errors with helpful suggestions and examples.

This function provides the clear error messages with examples identified as essential for developer experience in the redundancy analysis.

Parameters:

step_data (Dict[str, Any]) – Dictionary containing step definition data

Returns:

List of detailed error messages with suggestions

Return type:

List[str]

register_step_with_validation(step_name, step_data, existing_steps, mode='warn')[source]

Register step with simple standardization validation.

This function provides the minimal registry integration identified as essential in the redundancy analysis.

Parameters:
  • step_name (str) – Name of the step to register

  • step_data (Dict[str, Any]) – Step definition data

  • existing_steps (Dict[str, Any]) – Dictionary of existing steps (for duplicate checking)

  • mode (str) – Validation mode (“warn”, “strict”, “auto_correct”)

Returns:

List of warnings/messages

Raises:

ValueError – If validation fails in strict mode

Return type:

List[str]

create_validation_report(step_name, step_data, validation_mode='warn')[source]

Create a comprehensive validation report for a step definition.

This function provides simple error reporting functionality identified as essential in Phase 2 of the implementation plan.

Parameters:
  • step_name (str) – Name of the step to validate

  • step_data (Dict[str, Any]) – Step definition data

  • validation_mode (str) – Validation mode used

Returns:

Dictionary containing validation report

Return type:

Dict[str, Any]

get_performance_metrics()[source]

Get performance metrics for validation operations.

Returns:

Dictionary with performance statistics

Return type:

Dict[str, Any]

reset_performance_metrics()[source]

Reset performance tracking metrics.

get_validation_status()[source]

Get current validation system status with performance metrics.

Returns:

Dictionary with validation system information

Return type:

Dict[str, Any]