Background
PR #147 (branch issue-114-remove-serde_json_value_from_core_domain_model) introduced a dedicated validate_constraints pass in crates/sempai/src/semantic_check.rs and a PendingConstraintValidation enum whose three variants carry explicit /// TODO: doc-comments marking where semantic checks must attach:
RegexSyntax — validate regex syntax once diagnostics can point at the normalised where-clause source span.
PatternCompatibility — validate pattern compatibility when matcher-language context is available.
UnsupportedConstraint — emit diagnostics for unknown/unsupported constraints once unknown constraints are no longer intentionally preserved.
The pass currently returns Ok(()) for all inputs; the result of pending_constraint_validation is intentionally discarded.
Work required
MetavariableRegex / RegexSyntax — compile the regex string using the crate already used at execution time and emit a span-aware diagnostic when compilation fails. Span should point at the normalised where-clause location.
MetavariablePattern / PatternCompatibility — validate pattern compatibility against the available matcher-language context; emit a diagnostic when the pattern is incompatible.
Constraint::Other / UnsupportedConstraint — once unknown constraints are no longer intentionally preserved, emit a diagnostic for unrecognised constraint kinds.
- Tests — add unit tests for each rejection case (invalid regex, incompatible pattern, unsupported constraint) and update the existing
validate_constraints_* tests to assert on diagnostic codes once validation is active.
Acceptance criteria
validate_constraints returns a Diagnostic error for a MetavariableRegex constraint whose regex string does not compile.
validate_constraints returns a Diagnostic error for a MetavariablePattern constraint that is incompatible with the available matcher context.
_pending_check / PendingConstraintValidation scaffolding is removed or replaced with real logic once all three variants are handled.
- All existing tests continue to pass.
References
Background
PR #147 (branch
issue-114-remove-serde_json_value_from_core_domain_model) introduced a dedicatedvalidate_constraintspass incrates/sempai/src/semantic_check.rsand aPendingConstraintValidationenum whose three variants carry explicit/// TODO:doc-comments marking where semantic checks must attach:RegexSyntax— validate regex syntax once diagnostics can point at the normalisedwhere-clause source span.PatternCompatibility— validate pattern compatibility when matcher-language context is available.UnsupportedConstraint— emit diagnostics for unknown/unsupported constraints once unknown constraints are no longer intentionally preserved.The pass currently returns
Ok(())for all inputs; the result ofpending_constraint_validationis intentionally discarded.Work required
MetavariableRegex/RegexSyntax— compile the regex string using the crate already used at execution time and emit a span-aware diagnostic when compilation fails. Span should point at the normalisedwhere-clause location.MetavariablePattern/PatternCompatibility— validate pattern compatibility against the available matcher-language context; emit a diagnostic when the pattern is incompatible.Constraint::Other/UnsupportedConstraint— once unknown constraints are no longer intentionally preserved, emit a diagnostic for unrecognised constraint kinds.validate_constraints_*tests to assert on diagnostic codes once validation is active.Acceptance criteria
validate_constraintsreturns aDiagnosticerror for aMetavariableRegexconstraint whose regex string does not compile.validate_constraintsreturns aDiagnosticerror for aMetavariablePatternconstraint that is incompatible with the available matcher context._pending_check/PendingConstraintValidationscaffolding is removed or replaced with real logic once all three variants are handled.References
validate_constraintspass andPendingConstraintValidationplaceholderserde_json::Valuefrom thesempai_coredomain model