pub fn write_json<T: Serialize>(path: &Path, data: &T) -> Result<()>
Write JSON data to a file atomically using a temporary file + rename strategy with file locking