@@ -11,8 +11,7 @@ use crate::config::CONFIG_FILENAME;
1111pub const INSTANCE_DIR_NAME: &str = ".vibebox";
1212pub const GLOBAL_CACHE_DIR_NAME: &str = "vibebox";
1313pub const GLOBAL_DIR_NAME: &str = ".vibebox";
14−pub const INSTANCE_TOML_FILENAME: &str = "instance.toml";
15−pub const SESSION_TEMP_PREFIX: &str = "sessions";
14+pub const INSTANCE_FILENAME: &str = "instance.toml";
1615pub const SESSION_TOML_SUFFIX: &str = ".toml";
1716const SESSIONS_DIR_NAME: &str = "sessions";
1817
@@ -100,7 +99,8 @@ impl SessionManager {
10099 } else {
101100 tracing::warn!(
102101 directory = %directory.display(),
103− "missing session id in instance.toml"
102+ file = INSTANCE_FILENAME,
103+ "missing session id in instance file"
104104 );
105105 }
106106 }
@@ -158,7 +158,7 @@ impl SessionManager {
158158 }
159159
160160 fn session_path_for(&self, id: &str) -> PathBuf {
161− let filename = format!("{id}.toml");
161+ let filename = format!("{id}{SESSION_TOML_SUFFIX}");
162162 self.sessions_dir.join(filename)
163163 }
164164
@@ -225,9 +225,7 @@ fn read_session_file(path: &Path) -> Result<SessionEntry, SessionError> {
225225}
226226
227227fn read_instance_metadata(directory: &Path) -> Result<InstanceMetadata, SessionError> {
228− let instance_path = directory
229− .join(INSTANCE_DIR_NAME)
230− .join(INSTANCE_TOML_FILENAME);
228+ let instance_path = directory.join(INSTANCE_DIR_NAME).join(INSTANCE_FILENAME);
231229 if !instance_path.exists() {
232230 return Ok(InstanceMetadata::default());
233231 }
@@ -256,7 +254,7 @@ fn atomic_write(path: &Path, content: &[u8]) -> io::Result<()> {
256254
257255 fs::create_dir_all(parent)?;
258256 let mut temp = tempfile::Builder::new()
259− .prefix(SESSION_TEMP_PREFIX)
257+ .prefix(SESSIONS_DIR_NAME)
260258 .suffix(SESSION_TOML_SUFFIX)
261259 .tempfile_in(parent)?;
262260 temp.write_all(content)?;
@@ -285,7 +283,7 @@ mod tests {
285283 let instance_dir = project_dir.join(INSTANCE_DIR_NAME);
286284 fs::create_dir_all(&instance_dir).unwrap();
287285 let content = format!("id = \"{id}\"\nlast_active = \"{last_active}\"\n");
288− fs::write(instance_dir.join(INSTANCE_TOML_FILENAME), content).unwrap();
286+ fs::write(instance_dir.join(INSTANCE_FILENAME), content).unwrap();
289287 }
290288
291289 #[test]
@@ -306,9 +304,10 @@ mod tests {
306304 assert_eq!(dirs[0], project_dir.canonicalize().unwrap());
307305 assert!(mgr.index_path().exists());
308306
309− let session_path = mgr
310− .index_path()
311− .join("019bf290-cccc-7c23-ba1d-dce7e6d40693.toml");
307+ let session_path = mgr.index_path().join(format!(
308+ "019bf290-cccc-7c23-ba1d-dce7e6d40693{}",
309+ SESSION_TOML_SUFFIX
310+ ));
312311 assert!(session_path.exists());
313312 }
314313
@@ -329,9 +328,10 @@ mod tests {
329328 let sessions = mgr.list_sessions().unwrap();
330329 assert!(sessions.is_empty());
331330
332− let session_path = mgr
333− .index_path()
334− .join("019bf290-cccc-7c23-ba1d-dce7e6d40693.toml");
331+ let session_path = mgr.index_path().join(format!(
332+ "019bf290-cccc-7c23-ba1d-dce7e6d40693{}",
333+ SESSION_TOML_SUFFIX
334+ ));
335335 assert!(!session_path.exists());
336336 }
337337
@@ -340,7 +340,11 @@ mod tests {
340340 let temp = TempDir::new().unwrap();
341341 let mgr = manager(&temp);
342342 fs::create_dir_all(mgr.index_path()).unwrap();
343− fs::write(mgr.index_path().join("bad.toml"), "not toml").unwrap();
343+ fs::write(
344+ mgr.index_path().join(format!("bad{SESSION_TOML_SUFFIX}")),
345+ "not toml",
346+ )
347+ .unwrap();
344348
345349 let err = mgr.list_sessions().unwrap_err();
346350 assert!(matches!(err, SessionError::TomlDe(_)));