MCPcopy Create free account
hub / github.com/dtormoen/tsk-tsk / resolve_config_from_task

Function resolve_config_from_task

src/docker/mod.rs:121–147  ·  view source on GitHub ↗

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>,
)

Source from the content-addressed store, hash-verified

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).
121pub(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///

Callers 4

run_in_containerMethod · 0.85
graceful_shutdownMethod · 0.85
run_task_containerMethod · 0.85

Calls 4

emit_or_printFunction · 0.85
load_project_configFunction · 0.85
resolve_configMethod · 0.80
tsk_configMethod · 0.80

Tested by

no test coverage detected