Skip to main content

broccoli_server_sdk/types/
checker.rs

1use serde::{Deserialize, Serialize};
2
3use super::submission::SourceFile;
4use super::verdict::Verdict;
5
6/// Input to checker format plugin's parse_verdict handler.
7#[derive(Debug, Clone, Serialize, Deserialize)]
8pub struct CheckerParseInput {
9    pub stdout: String,
10    pub stderr: String,
11    pub exit_code: i32,
12    pub expected_output: String,
13    #[serde(default)]
14    pub test_input: String,
15    #[serde(default)]
16    pub checker_source: Option<Vec<SourceFile>>,
17    /// Opaque config blob from the plugin_config table (namespace="checker").
18    /// Checkers that support configuration (e.g., float tolerances) deserialize this.
19    #[serde(default)]
20    pub config: Option<serde_json::Value>,
21}
22
23/// Output from checker format plugin handlers (returned by run_checker host fn).
24#[derive(Debug, Clone, Serialize, Deserialize)]
25pub struct CheckerVerdict {
26    pub verdict: Verdict,
27    pub score: f64,
28    pub message: Option<String>,
29}
30
31/// Input from evaluator plugins to the run_checker host function.
32#[derive(Debug, Clone, Serialize, Deserialize)]
33pub struct RunCheckerInput {
34    pub format: String,
35    #[serde(flatten)]
36    pub input: CheckerParseInput,
37}