You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The enum validation cleanup improves one class of template variable error, but other schema validation failures in TemplateRenderer._coerce_and_validate still raise plain ValueError. Regex, min, and max validation failures should use the same domain error path so the CLI consistently reports clean messages.
Evidence from code inspection
In structkit/template_renderer.py:
Type coercion errors and enum errors now use TemplateVariableError.
Regex validation still raises plain ValueError:
Variable '{name}' does not match required pattern: {pattern}
Min/max validation still raises plain ValueError:
Variable '{name}' must be >= {minv}, got {coerced}
Variable '{name}' must be <= {maxv}, got {coerced}
GenerateCommand.execute catches TemplateVariableError, not every ValueError, so these user-caused schema validation failures can still surface as tracebacks.
Proposed fix
Convert regex/min/max validation failures to TemplateVariableError.
Consider a helper for all variable validation message formatting.
Keep catching only the domain error at the command boundary, not broad Exception.
Acceptance criteria
Invalid regex-pattern value exits 1 with no Traceback.
Below-min and above-max numeric values exit 1 with no Traceback.
Error messages include variable name, expected constraint, and received value.
Tests cover regex, min, and max validation through both TemplateRenderer and structkit generate.
Activity
[httpdss#167] Normalize template variable validation errors beyond en…