Skip to content

Commit c85662c

Browse files
committed
feat(validation): implement real script execution in ScriptValidator
- Replace placeholder pattern matching with actual LuaEngine execution - Add on-demand LuaEngine creation to avoid thread safety issues - Implement proper script context creation with validation data injection - Add thread-isolated script execution to avoid Tokio runtime conflicts - Convert ScriptError to ValidationError with detailed error messages - Support structured validation output parsing from script results - Remove dependency on stored LuaEngine to maintain Send+Sync traits - All ScriptValidator tests pass with real script execution validation This completes the core script validation functionality in ValidationEngine and enables real script-based validation instead of simulation. closes #341
1 parent 50e5322 commit c85662c

File tree

4 files changed

+509
-299
lines changed

4 files changed

+509
-299
lines changed

crates/mandrel-mcp-th/src/executor.rs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -605,10 +605,12 @@ impl TestCaseExecutor {
605605
// Use timeout from ExecutorConfig, or script-specific timeout if specified
606606
let timeout_ms = script
607607
.timeout_ms
608-
.unwrap_or_else(|| self.config.timeout.as_millis() as u64);
608+
.unwrap_or(self.config.timeout.as_millis() as u64);
609609

610-
let mut script_config = ScriptConfig::default();
611-
script_config.timeout_ms = timeout_ms;
610+
let script_config = ScriptConfig {
611+
timeout_ms,
612+
..ScriptConfig::default()
613+
};
612614

613615
ScriptContext::new(
614616
input.clone(),
@@ -714,7 +716,7 @@ mod tests {
714716
}
715717

716718
// ========================================================================
717-
// PHASE 1: ScriptManager Tests (Should FAIL until GREEN phase)
719+
// Script Manager Integration Tests
718720
// ========================================================================
719721

720722
#[test]
@@ -788,7 +790,7 @@ mod tests {
788790
}
789791

790792
// ========================================================================
791-
// PHASE 2: TestCaseExecutor Script Integration Tests (Should FAIL until GREEN phase)
793+
// TestCaseExecutor Script Integration Tests
792794
// ========================================================================
793795

794796
#[tokio::test]
@@ -956,7 +958,7 @@ mod tests {
956958
}
957959

958960
// ========================================================================
959-
// PHASE 3: Script Execution Context Tests (Should FAIL until GREEN phase)
961+
// Script Execution Context Tests
960962
// ========================================================================
961963

962964
#[tokio::test]
@@ -1025,7 +1027,7 @@ mod tests {
10251027
}
10261028

10271029
// ========================================================================
1028-
// PHASE 4: Metrics and Performance Tests (Should FAIL until GREEN phase)
1030+
// Metrics and Performance Tests
10291031
// ========================================================================
10301032

10311033
#[tokio::test]
@@ -1087,7 +1089,7 @@ mod tests {
10871089
}
10881090

10891091
// ========================================================================
1090-
// PHASE 5: Error Handling and Edge Cases (Should FAIL until GREEN phase)
1092+
// Error Handling and Edge Cases
10911093
// ========================================================================
10921094

10931095
#[tokio::test]
@@ -1177,7 +1179,7 @@ mod tests {
11771179
}
11781180

11791181
// ========================================================================
1180-
// PHASE 6: Integration with Existing Validation (Should FAIL until GREEN phase)
1182+
// Integration with Existing Validation
11811183
// ========================================================================
11821184

11831185
#[tokio::test]

0 commit comments

Comments
 (0)