Resolve config for a task, preferring the DB snapshot over live resolution. If the task has a `resolved_config` snapshot (set at creation time), deserialize it. Otherwise, fall back to live resolution from config files (for pre-migration tasks).
(
task: &crate::task::Task,
ctx: &AppContext,
event_sender: &Option<crate::tui::events::ServerEventSender>,
)
| 119 | /// If the task has a `resolved_config` snapshot (set at creation time), deserialize it. |
| 120 | /// Otherwise, fall back to live resolution from config files (for pre-migration tasks). |
| 121 | pub(crate) fn resolve_config_from_task( |
| 122 | task: &crate::task::Task, |
| 123 | ctx: &AppContext, |
| 124 | event_sender: &Option<crate::tui::events::ServerEventSender>, |
| 125 | ) -> crate::context::ResolvedConfig { |
| 126 | if let Some(ref json) = task.resolved_config { |
| 127 | match serde_json::from_str(json) { |
| 128 | Ok(config) => return config, |
| 129 | Err(e) => { |
| 130 | crate::tui::events::emit_or_print( |
| 131 | event_sender, |
| 132 | crate::tui::events::ServerEvent::WarningMessage(format!( |
| 133 | "Warning: Failed to deserialize resolved_config for task {}: {e}. Falling back to live resolution.", |
| 134 | task.id |
| 135 | )), |
| 136 | ); |
| 137 | } |
| 138 | } |
| 139 | } |
| 140 | // Fallback: live resolution (for tasks created before config snapshotting) |
| 141 | let project_config = tsk_config::load_project_config(&task.repo_root); |
| 142 | ctx.tsk_config().resolve_config( |
| 143 | &task.project, |
| 144 | project_config.as_ref(), |
| 145 | Some(&task.repo_root), |
| 146 | ) |
| 147 | } |
| 148 | |
| 149 | /// Manages Docker container execution for TSK tasks. |
| 150 | /// |
no test coverage detected