Colocated atomic+git repo with `file` tracked in Atomic (baseline) and a turn-start boundary captured. The session is saved to disk like the orchestrator does at turn start.
(
dir: &TempDir,
session_id: &str,
file: &str,
content: &str,
)
| 1279 | /// a turn-start boundary captured. The session is saved to disk like the |
| 1280 | /// orchestrator does at turn start. |
| 1281 | fn setup( |
| 1282 | dir: &TempDir, |
| 1283 | session_id: &str, |
| 1284 | file: &str, |
| 1285 | content: &str, |
| 1286 | ) -> (git2::Repository, AgentSession) { |
| 1287 | let git = git2::Repository::init(dir.path()).unwrap(); |
| 1288 | let repo = Repository::init(dir.path()).unwrap(); |
| 1289 | let mut session = AgentSession::new(session_id, "claude-code", "Claude Code"); |
| 1290 | session.view_name = repo.current_view().to_string(); |
| 1291 | |
| 1292 | // Baseline: Atomic tracks the same content Git will commit, so the |
| 1293 | // worktree stays clean across the git-only turn. |
| 1294 | std::fs::write(dir.path().join(file), content).unwrap(); |
| 1295 | let working_copy = repo.require_working_copy_id().unwrap(); |
| 1296 | repo.add(working_copy, file, TrackingOptions::default()) |
| 1297 | .unwrap(); |
| 1298 | repo.record( |
| 1299 | working_copy, |
| 1300 | atomic_core::change::ChangeHeader::new("baseline"), |
| 1301 | atomic_repository::record::RecordOptions::new(), |
| 1302 | ) |
| 1303 | .unwrap(); |
| 1304 | |
| 1305 | let baseline = crate::record::capture_turn_boundary(&repo, dir.path(), session_id, 1) |
| 1306 | .expect("turn-start boundary captures on a real repository"); |
| 1307 | session.set_boundary_start(baseline.clone()); |
| 1308 | drop(repo); |
| 1309 | |
| 1310 | // The orchestrator persisted the session (with its boundary) at turn |
| 1311 | // start; the pre-commit hook loads it from disk. |
| 1312 | let store = SessionStore::new(dir.path().join(".atomic").join("sessions")).unwrap(); |
| 1313 | store.save(&session).unwrap(); |
| 1314 | (git, session) |
| 1315 | } |
| 1316 | |
| 1317 | #[test] |
| 1318 | fn clean_turn_without_git_move_is_observation_only() { |
no test coverage detected