- 2418
undo_promotion("undo-resume", control.path()).unwrap(); - 2419
assert_eq!( - 2420
load_transaction(&journal_path).unwrap().state, - 2421
PromotionTransactionState::Undone - 2422
); - 2423
assert_eq!( - 2424
fs::read_to_string(target.path().join("draft.txt")).unwrap(), - 2425
"before" - 2426
); - 2427
} - 2428
- 2429
#[test] - 2430
fn revised_candidate_can_review_accept_and_undo_a_deletion() { - 2431
let source = tempfile::tempdir().unwrap(); - 2432
let target = tempfile::tempdir().unwrap(); - 2433
let store = tempfile::tempdir().unwrap(); - 2434
let control = tempfile::tempdir().unwrap(); - 2435
fs::write(target.path().join("obsolete.txt"), "workspace original").unwrap(); - 2436
fs::write(source.path().join("obsolete.txt"), "draft version").unwrap(); - 2437
let first = freeze_candidate( - 2438
"delete-v1", - 2439
source.path(), - 2440
target.path(), - 2441
&store.path().join("v1"), - 2442
) - 2443
.unwrap(); - 2444
let task = store.path().join("task"); - 2445
prepare_revision_copy(&first, &task).unwrap(); - 2446
fs::remove_file(task.join("obsolete.txt")).unwrap(); - 2447
let deletion = - 2448
freeze_revision_candidate("delete-v2", &task, &first, &store.path().join("v2")) - 2449
.unwrap(); - 2450
assert_eq!(deletion.files.len(), 1); - 2451
assert_eq!(deletion.files[0].operation, CandidateOperation::Delete); - 2452
let receipt = promote_recoverable(&deletion, control.path()).unwrap(); - 2453
assert_eq!(receipt.deleted, vec!["obsolete.txt"]); - 2454
assert!(!target.path().join("obsolete.txt").exists()); - 2455
undo_promotion("delete-v2", control.path()).unwrap(); - 2456
assert_eq!( - 2457
fs::read_to_string(target.path().join("obsolete.txt")).unwrap(), - 2458
"workspace original" - 2459
); - 2460
} - 2461
- 2462
#[test] - 2463
fn durable_records_are_append_only_and_replayable() { - 2464
let dir = tempfile::tempdir().unwrap(); - 2465
let path = dir.path().join("sandbox").join("records.jsonl"); - 2466
let plan = EnvironmentPlan { - 2467
id: "env-1".into(), - 2468
outcome_revision: 7, - 2469
input_root: dir.path().into(), - 2470
task_root: dir.path().join("task"), - 2471
backend: "local".into(), - 2472
image: None, - 2473
network_policy: "none".into(), - 2474
setup_recipe: vec!["make".into()], - 2475
}; - 2476
let record = DurableRecord::Environment(EnvironmentRecord { - 2477
record_id: "r-1".into(), - 2478
environment_id: "env-1".into(), - 2479
state: EnvironmentState::Ready, - 2480
plan, - 2481
updated_at: "2026-09-08T00:00:00Z".into(), - 2482
detail: None, - 2483
}); - 2484
append_record(&path, &record).unwrap(); - 2485
let preparation = DurableRecord::PreviewPreparation(PreviewPreparationRecord { - 2486
record_id: "preview-1".into(), - 2487
session_id: "session-1".into(), - 2488
result_id: "result-1".into(), - 2489
candidate_id: "candidate-1".into(), - 2490
candidate_digest: "sha256:digest".into(), - 2491
environment_id: "preview:candidate-1".into(), - 2492
state: EnvironmentState::Ready, - 2493
command: "npm ci --ignore-scripts --no-audit --no-fund".into(), - 2494
evidence: "dependencies prepared".into(), - 2495
updated_at: "2026-09-08T00:01:00Z".into(), - 2496
}); - 2497
append_record(&path, &preparation).unwrap(); - 2498
assert_eq!(load_records(&path).unwrap(), vec![record, preparation]); - 2499
} - 2500
} - 2501
Indexing the workspace…
Vakyartha documentation is discovering safe artifacts, anchors, and source references.