pub struct EngineTarget {
pub binary: PathBuf,
pub env: Vec<(String, String)>,
pub data_dir_env: Option<String>,
pub data_dir_arg: Option<String>,
pub forbidden_args: Vec<String>,
pub allow_no_data_dir_for_refusal_probe: bool,
}Expand description
An engine binary and how to launch it without touching real user data.
Every launch (cli, run, start_sidecar) must name an isolated data directory, or it is
refused before the process starts with a crate::userdata::UserDataViolation (rule
no-isolated-data-dir). A directory is named when the caller’s CliOptions::data_dir reaches
the engine through data_dir_env, or data_dir_env is set in the launch environment, or
data_dir_arg appears in the arguments, and the directory passes
crate::userdata::check_engine_dirs. A data_dir on a target that declares neither is not
named: the engine would never see it.
Fields§
§binary: PathBuf§env: Vec<(String, String)>Env applied to every engine process (e.g. GENRIGHT_NO_KEYCHAIN=1).
data_dir_env: Option<String>Env var that receives the per-scenario data dir (e.g. GENRIGHT_APP_DATA).
data_dir_arg: Option<String>Flag the engine takes its data dir under (e.g. --data-dir). Declaring it lets a caller
name the isolated directory in the launch arguments; the harness only judges the value.
forbidden_args: Vec<String>Flags that select the real library (e.g. --use-user-library). A launch whose arguments
contain one, as flag or flag=value, is refused. Empty by default; the product declares
its own, this crate hard-codes none.
allow_no_data_dir_for_refusal_probe: boolSet by EngineTarget::allow_no_data_dir_for_refusal_probe; read it as a warning label.
Implementations§
Source§impl EngineTarget
impl EngineTarget
Sourcepub fn new(binary: impl Into<PathBuf>) -> Self
pub fn new(binary: impl Into<PathBuf>) -> Self
A target with no environment, no data-dir variable or flag, and no deny list. Such a target
cannot be launched until it declares data_dir_env or data_dir_arg (or the probe
opt-out is used).
Sourcepub fn with_data_dir_env(self, var: &str) -> Self
pub fn with_data_dir_env(self, var: &str) -> Self
Env var that receives the data dir (e.g. GENRIGHT_APP_DATA).
Sourcepub fn with_data_dir_arg(self, flag: &str) -> Self
pub fn with_data_dir_arg(self, flag: &str) -> Self
Flag the engine takes its data dir under (e.g. --data-dir).
Sourcepub fn forbid_args(self, flags: &[&str]) -> Self
pub fn forbid_args(self, flags: &[&str]) -> Self
Flags that select the real library; a launch carrying one is refused.
Sourcepub fn allow_no_data_dir_for_refusal_probe(self) -> Self
pub fn allow_no_data_dir_for_refusal_probe(self) -> Self
Let launches of this target name no data directory, ONLY to assert the engine’s own
refusal to run without one. Use it on a dedicated clone of the target, never on the target
that runs real scenarios. A second barrier is still required: on Unix the launch
environment (CliOptions::env or the target’s env) must redirect HOME into a QA
directory, and XDG_DATA_HOME / XDG_CONFIG_HOME too wherever they are set or inherited;
on Windows the Known Folder API ignores the environment, so the launch is refused
whatever the caller passes. See crate::userdata::check_engine_launch.
pub fn cli( &self, args: &[String], opts: &CliOptions, tracker: &Tracker, ) -> Result<CliResult>
Sourcepub fn run(
&self,
words: &str,
input: Value,
opts: &CliOptions,
tracker: &Tracker,
) -> Result<Value>
pub fn run( &self, words: &str, input: Value, opts: &CliOptions, tracker: &Tracker, ) -> Result<Value>
engine run('job status', input): words split, non-zero exit or json.error fails.