From cd1b77b078bed03de2cb763946a8b79350701d08 Mon Sep 17 00:00:00 2001 From: atlas Date: Fri, 6 Nov 2026 10:12:09 +0100 Subject: [PATCH] pin state as the first data dir with a comment and a test --- hive-priv/src/userns.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/hive-priv/src/userns.rs b/hive-priv/src/userns.rs index c812db28..42be68b8 100644 --- a/hive-priv/src/userns.rs +++ b/hive-priv/src/userns.rs @@ -44,7 +44,8 @@ const MARKER_ROOT: &str = "/var/lib/hive-priv/userns"; const MIN_AGENT_UID: u32 = 1000; /// The dirs under `/` the agent writes into. `config` -/// is not one of them: hive-core writes it and the agent only reads it. +/// is not one of them: hive-core writes it and the agent only reads it. `state` +/// stays first: [`move_data`] opens it by name and opens the rest from `[1..]`. const DATA_DIRS: [&str; 4] = ["state", "harness", "work", "claude"]; /// Where one call looks and writes, and what it was told. @@ -729,6 +730,12 @@ mod tests { } } + /// `move_data` opens `state` by name and takes the other dirs from `DATA_DIRS[1..]`. + #[test] + fn state_is_the_first_data_dir() { + assert_eq!(super::DATA_DIRS[0], "state"); + } + #[test] fn a_path_is_not_an_agent_name() { let root = tree();