○
Planned This feature is planned but not yet implemented.
AI-powered compiler error explanation via generateObject
Failure Output
Showing last 10 of 40 lines
--> structural_check:25:0
❌ Compiler coordination error: Incomplete branch coverage
error: CompilerCoordinationFailed
/Users/larsde/src/koru/tests/regression/700_EVENT_GLOBBING/700_030_ai_error_explanation/backend.zig:9321:17: 0x1008ea433 in emit (backend)
return error.CompilerCoordinationFailed;
^
/Users/larsde/src/koru/tests/regression/700_EVENT_GLOBBING/700_030_ai_error_explanation/backend.zig:9405:28: 0x1008eb1bf in main (backend)
const generated_code = try RuntimeEmitter.emit(compile_allocator, final_ast);
^ Code
// Test: AI-powered compiler error explanation
//
// When compilation fails, the compiler can invoke an AI to explain the error.
// This is a PIPELINE PASS, not magic - just another step in compiler.coordinate.
//
// The test verifies:
// 1. AI is invoked when OPENROUTER_API_KEY (or similar) is set
// 2. Response matches ErrorExplanation schema (summary, cause, fix)
// 3. Response references relevant Koru constructs, not just Zig internals
//
// Non-deterministic output is tested via SCHEMA VALIDATION, not exact match.
// The AI's explanation varies, but it must fill the required slots.
// This code has an intentional error for the AI to explain
~event broken.example {
value: NonexistentType, // ← This type doesn't exist
}
| ok
~proc broken.example {
return .{ .ok = {} };
}
~broken.example(value: 42)