Skip to main content

set_auto_chain_active

Function set_auto_chain_active 

Source
pub fn set_auto_chain_active(
    root: &Path,
    active: bool,
) -> Result<bool, GsdConfigError>
Expand description

Set workflow._auto_chain_active under root, returning whether the file was actually changed.

Writing a value the file already holds is a genuine no-op: Ok(false) is returned and the file’s bytes and mtime are untouched (F-3). That is what keeps the symmetric guard — which asserts false on every ineligible launch rather than leaving whatever it finds — from rewriting a tracked file on every stage of every run.

A missing workflow object is CREATED rather than rejected; a config that simply has not grown that key yet is a normal shape, not a corrupt one.

§Errors

Returns GsdConfigError::Missing when no config file exists, GsdConfigError::Json when the existing file is not valid JSON, and GsdConfigError::Io when the atomic write fails. In every error case the original file is left exactly as it was — the temp-write-then-rename idiom means a failure never leaves a truncated config behind.