Introduce runtime config types in the data model
Intent: Define the new `HostProcessRuntimeConfig`, `IncusRuntimeConfig`, `TartRuntimeConfig` structs and the `JobRuntimeConfig` enum that replaces the three loose fields on `JobSpec`. Wire up accessor methods that extract backend-specific values from the enum, plus a `debug_assert` that the runtime config variant agrees with the execution config's declared runtime kind.
Affected files: crates/pikaci/src/model.rs
@@ -30,6 +30,37 @@ pub enum GuestCommand {
@@ -37,10 +68,8 @@ pub struct JobSpec {
@@ -182,12 +211,17 @@ impl JobSpec {
@@ -208,7 +242,10 @@ impl JobSpec {
@@ -216,11 +253,17 @@ impl JobSpec {
The core of the refactor lives in model.rs. Three new structs capture backend-specific knobs:
pub struct HostProcessRuntimeConfig;
pub struct IncusRuntimeConfig {
pub staged_linux_command: Option<StagedLinuxCommandConfig>,
}
pub struct TartRuntimeConfig {
pub host_setup_command: Option<&'static str>,
pub mount_host_rust_toolchain: bool,
}
These are unified under a single enum:
pub enum JobRuntimeConfig {
HostProcess(HostProcessRuntimeConfig),
Incus(IncusRuntimeConfig),
Tart(TartRuntimeConfig),
}
JobSpec loses its three flat fields (staged_linux_command, host_setup_command, mount_host_rust_toolchain) and gains a single runtime_config: JobRuntimeConfig field.
The existing accessor methods (staged_linux_command(), host_setup_command(), mount_host_rust_toolchain()) are preserved for backward compatibility at the call-site level, but now dispatch through match on the runtime config enum. The runtime_kind() method switches from reading self.execution.runtime to deriving the kind from self.runtime_config().kind(), and a debug_assert_eq! in runtime_config() cross-checks that the execution config and runtime config agree—catching misconstruction during development without runtime cost in release builds.