summaryrefslogtreecommitdiff
path: root/makima/src/db/models.rs
diff options
context:
space:
mode:
authorsoryu <soryu@soryu.co>2026-02-04 01:07:14 +0000
committersoryu <soryu@soryu.co>2026-02-04 01:07:14 +0000
commita734bf1a472b19d63341769d26a66628575df7f4 (patch)
treeec78f57e5721d157c620df0c99de5b5efe485231 /makima/src/db/models.rs
parentc732dd048128808cd9f67f6e1176a5b565df5678 (diff)
downloadsoryu-a734bf1a472b19d63341769d26a66628575df7f4.tar.gz
soryu-a734bf1a472b19d63341769d26a66628575df7f4.zip
Add chain checkpoint contracts
Diffstat (limited to 'makima/src/db/models.rs')
-rw-r--r--makima/src/db/models.rs67
1 files changed, 67 insertions, 0 deletions
diff --git a/makima/src/db/models.rs b/makima/src/db/models.rs
index eeb30e4..0b8ef43 100644
--- a/makima/src/db/models.rs
+++ b/makima/src/db/models.rs
@@ -2848,6 +2848,56 @@ pub struct CreateChainDeliverableRequest {
pub priority: Option<String>,
}
+/// Validation configuration for checkpoint contracts.
+/// Checkpoint contracts validate the outputs of their upstream dependencies
+/// before allowing downstream contracts to proceed.
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
+#[serde(rename_all = "camelCase")]
+pub struct CheckpointValidation {
+ /// Check that all required deliverables from upstream contracts exist
+ #[serde(default)]
+ pub check_deliverables: bool,
+
+ /// Run tests in the repository (requires repository to be configured)
+ #[serde(default)]
+ pub run_tests: bool,
+
+ /// Custom validation instructions for Claude to execute.
+ /// Claude will review the outputs of upstream contracts and verify they meet these criteria.
+ pub check_content: Option<String>,
+
+ /// Action to take on validation failure: "block" (default), "retry", "warn"
+ /// - block: Fail the checkpoint and block downstream contracts
+ /// - retry: Mark upstream contracts for retry (up to max_retries)
+ /// - warn: Log warning but allow downstream to proceed
+ #[serde(default = "default_checkpoint_on_failure")]
+ pub on_failure: String,
+
+ /// Maximum retry attempts for upstream contracts (when on_failure = "retry")
+ #[serde(default = "default_checkpoint_max_retries")]
+ pub max_retries: i32,
+}
+
+fn default_checkpoint_on_failure() -> String {
+ "block".to_string()
+}
+
+fn default_checkpoint_max_retries() -> i32 {
+ 3
+}
+
+impl Default for CheckpointValidation {
+ fn default() -> Self {
+ Self {
+ check_deliverables: false,
+ run_tests: false,
+ check_content: None,
+ on_failure: default_checkpoint_on_failure(),
+ max_retries: default_checkpoint_max_retries(),
+ }
+ }
+}
+
/// Request to update an existing chain
#[derive(Debug, Clone, Deserialize, ToSchema)]
#[serde(rename_all = "camelCase")]
@@ -2962,6 +3012,8 @@ pub struct ChainContractDefinition {
pub tasks: Option<serde_json::Value>,
/// Deliverable definitions as JSON: [{id, name, priority}, ...]
pub deliverables: Option<serde_json::Value>,
+ /// Validation configuration for checkpoint contracts (JSON)
+ pub validation: Option<serde_json::Value>,
/// Position in GUI editor
pub editor_x: Option<f64>,
pub editor_y: Option<f64>,
@@ -2984,6 +3036,8 @@ pub struct AddContractDefinitionRequest {
pub tasks: Option<Vec<CreateChainTaskRequest>>,
/// Deliverable definitions
pub deliverables: Option<Vec<CreateChainDeliverableRequest>>,
+ /// Validation configuration (for checkpoint contracts)
+ pub validation: Option<CheckpointValidation>,
/// Position in GUI editor
pub editor_x: Option<f64>,
pub editor_y: Option<f64>,
@@ -3004,10 +3058,23 @@ pub struct UpdateContractDefinitionRequest {
pub depends_on: Option<Vec<String>>,
pub tasks: Option<Vec<CreateChainTaskRequest>>,
pub deliverables: Option<Vec<CreateChainDeliverableRequest>>,
+ /// Validation configuration (for checkpoint contracts)
+ pub validation: Option<CheckpointValidation>,
pub editor_x: Option<f64>,
pub editor_y: Option<f64>,
}
+/// Request to start a chain
+#[derive(Debug, Clone, Deserialize, ToSchema)]
+#[serde(rename_all = "camelCase")]
+pub struct StartChainRequest {
+ /// Whether to create a supervisor task that monitors chain progress
+ #[serde(default)]
+ pub with_supervisor: bool,
+ /// Repository URL for the supervisor task to work with
+ pub repository_url: Option<String>,
+}
+
/// Response when starting a chain
#[derive(Debug, Clone, Serialize, ToSchema)]
#[serde(rename_all = "camelCase")]