Skip to content

Commit ab76e66

Browse files
committed
chore: M5 CI/Workflow Sweep - final synchronisation
1 parent e6ed57f commit ab76e66

32 files changed

Lines changed: 728 additions & 550 deletions

ffi/rust/src/audit.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -264,31 +264,31 @@ mod tests {
264264

265265
#[test]
266266
fn test_audit_log_creation() {
267-
let tmp = tempdir().unwrap();
267+
let tmp = tempdir().expect("TODO: handle error");
268268
let path = tmp.path().join("audit.jsonl");
269269

270-
let mut log = AuditLog::new(path.clone()).unwrap();
270+
let mut log = AuditLog::new(path.clone()).expect("TODO: handle error");
271271

272-
log.log_operation("mkdir", "/test/dir", None).unwrap();
273-
log.log_operation("touch", "/test/file.txt", Some(0)).unwrap();
272+
log.log_operation("mkdir", "/test/dir", None).expect("TODO: handle error");
273+
log.log_operation("touch", "/test/file.txt", Some(0)).expect("TODO: handle error");
274274

275275
assert_eq!(log.entry_count(), 2);
276276
}
277277

278278
#[test]
279279
fn test_audit_log_integrity() {
280-
let tmp = tempdir().unwrap();
280+
let tmp = tempdir().expect("TODO: handle error");
281281
let path = tmp.path().join("audit.jsonl");
282282

283283
{
284-
let mut log = AuditLog::new(path.clone()).unwrap();
285-
log.log_operation("mkdir", "/a", None).unwrap();
286-
log.log_operation("mkdir", "/b", None).unwrap();
287-
log.log_operation("rmdir", "/a", None).unwrap();
284+
let mut log = AuditLog::new(path.clone()).expect("TODO: handle error");
285+
log.log_operation("mkdir", "/a", None).expect("TODO: handle error");
286+
log.log_operation("mkdir", "/b", None).expect("TODO: handle error");
287+
log.log_operation("rmdir", "/a", None).expect("TODO: handle error");
288288
}
289289

290290
// Verify integrity
291-
let log = AuditLog::new(path).unwrap();
292-
assert!(log.verify_integrity().unwrap());
291+
let log = AuditLog::new(path).expect("TODO: handle error");
292+
assert!(log.verify_integrity().expect("TODO: handle error"));
293293
}
294294
}

ffi/rust/src/lib.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -381,63 +381,63 @@ mod tests {
381381

382382
#[test]
383383
fn test_mkdir_rmdir_reversible() {
384-
let tmp = tempdir().unwrap();
384+
let tmp = tempdir().expect("TODO: handle error");
385385
let config = FfiConfig {
386386
sandbox_root: tmp.path().to_path_buf(),
387387
..Default::default()
388388
};
389389

390-
let mut ctx = FfiContext::new(config).unwrap();
390+
let mut ctx = FfiContext::new(config).expect("TODO: handle error");
391391

392392
// mkdir
393-
ctx.mkdir("test_dir").unwrap();
393+
ctx.mkdir("test_dir").expect("TODO: handle error");
394394
assert!(tmp.path().join("test_dir").exists());
395395

396396
// rmdir (reverse)
397-
ctx.rmdir("test_dir").unwrap();
397+
ctx.rmdir("test_dir").expect("TODO: handle error");
398398
assert!(!tmp.path().join("test_dir").exists());
399399
}
400400

401401
#[test]
402402
fn test_create_delete_file_reversible() {
403-
let tmp = tempdir().unwrap();
403+
let tmp = tempdir().expect("TODO: handle error");
404404
let config = FfiConfig {
405405
sandbox_root: tmp.path().to_path_buf(),
406406
..Default::default()
407407
};
408408

409-
let mut ctx = FfiContext::new(config).unwrap();
409+
let mut ctx = FfiContext::new(config).expect("TODO: handle error");
410410

411411
// create_file
412-
ctx.create_file("test.txt").unwrap();
412+
ctx.create_file("test.txt").expect("TODO: handle error");
413413
assert!(tmp.path().join("test.txt").exists());
414414

415415
// delete_file (reverse)
416-
ctx.delete_file("test.txt").unwrap();
416+
ctx.delete_file("test.txt").expect("TODO: handle error");
417417
assert!(!tmp.path().join("test.txt").exists());
418418
}
419419

420420
#[test]
421421
fn test_write_file_reversible() {
422-
let tmp = tempdir().unwrap();
422+
let tmp = tempdir().expect("TODO: handle error");
423423
let config = FfiConfig {
424424
sandbox_root: tmp.path().to_path_buf(),
425425
..Default::default()
426426
};
427427

428-
let mut ctx = FfiContext::new(config).unwrap();
428+
let mut ctx = FfiContext::new(config).expect("TODO: handle error");
429429

430430
// Create file first
431-
ctx.create_file("test.txt").unwrap();
431+
ctx.create_file("test.txt").expect("TODO: handle error");
432432

433433
// Write new content, get old
434-
let old = ctx.write_file("test.txt", b"new content").unwrap();
434+
let old = ctx.write_file("test.txt", b"new content").expect("TODO: handle error");
435435
assert_eq!(old, b"");
436436

437437
// Write old content back (reverse)
438-
ctx.write_file("test.txt", &old).unwrap();
438+
ctx.write_file("test.txt", &old).expect("TODO: handle error");
439439

440-
let content = ctx.read_file("test.txt").unwrap();
440+
let content = ctx.read_file("test.txt").expect("TODO: handle error");
441441
assert_eq!(content, b"");
442442
}
443443
}

ffi/rust/src/operations.rs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -456,54 +456,54 @@ mod tests {
456456

457457
#[test]
458458
fn test_file_type_detection() {
459-
let tmp = tempdir().unwrap();
459+
let tmp = tempdir().expect("TODO: handle error");
460460

461461
// Create file
462462
let file_path = tmp.path().join("test.txt");
463-
fs::write(&file_path, "content").unwrap();
463+
fs::write(&file_path, "content").expect("TODO: handle error");
464464

465-
let info = FileInfo::from_path(&file_path).unwrap();
465+
let info = FileInfo::from_path(&file_path).expect("TODO: handle error");
466466
assert_eq!(info.file_type, FileType::RegularFile);
467467

468468
// Create directory
469469
let dir_path = tmp.path().join("subdir");
470-
fs::create_dir(&dir_path).unwrap();
470+
fs::create_dir(&dir_path).expect("TODO: handle error");
471471

472-
let info = FileInfo::from_path(&dir_path).unwrap();
472+
let info = FileInfo::from_path(&dir_path).expect("TODO: handle error");
473473
assert_eq!(info.file_type, FileType::Directory);
474474
}
475475

476476
#[test]
477477
fn test_list_directory() {
478-
let tmp = tempdir().unwrap();
478+
let tmp = tempdir().expect("TODO: handle error");
479479

480-
fs::write(tmp.path().join("a.txt"), "").unwrap();
481-
fs::write(tmp.path().join("b.txt"), "").unwrap();
482-
fs::create_dir(tmp.path().join("subdir")).unwrap();
480+
fs::write(tmp.path().join("a.txt"), "").expect("TODO: handle error");
481+
fs::write(tmp.path().join("b.txt"), "").expect("TODO: handle error");
482+
fs::create_dir(tmp.path().join("subdir")).expect("TODO: handle error");
483483

484-
let entries = list_directory(tmp.path()).unwrap();
484+
let entries = list_directory(tmp.path()).expect("TODO: handle error");
485485
assert_eq!(entries.len(), 3);
486486
}
487487

488488
#[test]
489489
fn test_atomic_write() {
490-
let tmp = tempdir().unwrap();
490+
let tmp = tempdir().expect("TODO: handle error");
491491
let path = tmp.path().join("atomic.txt");
492492

493-
atomic_write(&path, b"test content").unwrap();
493+
atomic_write(&path, b"test content").expect("TODO: handle error");
494494

495495
assert!(path.exists());
496-
assert_eq!(fs::read_to_string(&path).unwrap(), "test content");
496+
assert_eq!(fs::read_to_string(&path).expect("TODO: handle error"), "test content");
497497
}
498498

499499
#[test]
500500
fn test_directory_size() {
501-
let tmp = tempdir().unwrap();
501+
let tmp = tempdir().expect("TODO: handle error");
502502

503-
fs::write(tmp.path().join("a.txt"), "12345").unwrap();
504-
fs::write(tmp.path().join("b.txt"), "123").unwrap();
503+
fs::write(tmp.path().join("a.txt"), "12345").expect("TODO: handle error");
504+
fs::write(tmp.path().join("b.txt"), "123").expect("TODO: handle error");
505505

506-
let size = directory_size(tmp.path()).unwrap();
506+
let size = directory_size(tmp.path()).expect("TODO: handle error");
507507
assert_eq!(size, 8);
508508
}
509509
}

ffi/rust/src/preconditions.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -407,14 +407,14 @@ mod tests {
407407

408408
#[test]
409409
fn test_mkdir_preconditions() {
410-
let tmp = tempdir().unwrap();
410+
let tmp = tempdir().expect("TODO: handle error");
411411
let path = tmp.path().join("new_dir");
412412

413413
// Should succeed - path doesn't exist, parent exists
414414
assert!(Preconditions::mkdir(&path).is_ok());
415415

416416
// Create it
417-
fs::create_dir(&path).unwrap();
417+
fs::create_dir(&path).expect("TODO: handle error");
418418

419419
// Should fail - path exists
420420
assert!(matches!(
@@ -425,7 +425,7 @@ mod tests {
425425

426426
#[test]
427427
fn test_rmdir_preconditions() {
428-
let tmp = tempdir().unwrap();
428+
let tmp = tempdir().expect("TODO: handle error");
429429
let path = tmp.path().join("dir_to_remove");
430430

431431
// Should fail - doesn't exist
@@ -435,13 +435,13 @@ mod tests {
435435
));
436436

437437
// Create empty directory
438-
fs::create_dir(&path).unwrap();
438+
fs::create_dir(&path).expect("TODO: handle error");
439439

440440
// Should succeed
441441
assert!(Preconditions::rmdir(&path).is_ok());
442442

443443
// Add a file
444-
fs::write(path.join("file.txt"), "content").unwrap();
444+
fs::write(path.join("file.txt"), "content").expect("TODO: handle error");
445445

446446
// Should fail - not empty
447447
assert!(matches!(

ffi/rust/src/rmo.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -357,31 +357,31 @@ mod tests {
357357

358358
#[test]
359359
fn test_secure_delete_file() {
360-
let tmp = tempdir().unwrap();
360+
let tmp = tempdir().expect("TODO: handle error");
361361
let file_path = tmp.path().join("test_file.txt");
362362

363363
// Create test file
364-
std::fs::write(&file_path, "sensitive data here").unwrap();
364+
std::fs::write(&file_path, "sensitive data here").expect("TODO: handle error");
365365
assert!(file_path.exists());
366366

367367
// Secure delete
368-
secure_delete(&file_path, 3).unwrap();
368+
secure_delete(&file_path, 3).expect("TODO: handle error");
369369

370370
// File should be gone
371371
assert!(!file_path.exists());
372372
}
373373

374374
#[test]
375375
fn test_secure_delete_empty_file() {
376-
let tmp = tempdir().unwrap();
376+
let tmp = tempdir().expect("TODO: handle error");
377377
let file_path = tmp.path().join("empty.txt");
378378

379379
// Create empty file
380-
std::fs::write(&file_path, "").unwrap();
380+
std::fs::write(&file_path, "").expect("TODO: handle error");
381381
assert!(file_path.exists());
382382

383383
// Secure delete
384-
secure_delete(&file_path, 3).unwrap();
384+
secure_delete(&file_path, 3).expect("TODO: handle error");
385385

386386
// File should be gone
387387
assert!(!file_path.exists());

ffi/rust/src/sandbox.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,14 +229,14 @@ mod tests {
229229
#[test]
230230
fn test_resolve_simple_path() {
231231
let sandbox = PathBuf::from("/tmp/sandbox");
232-
let resolved = resolve_path(&sandbox, "foo/bar").unwrap();
232+
let resolved = resolve_path(&sandbox, "foo/bar").expect("TODO: handle error");
233233
assert_eq!(resolved, PathBuf::from("/tmp/sandbox/foo/bar"));
234234
}
235235

236236
#[test]
237237
fn test_resolve_absolute_path() {
238238
let sandbox = PathBuf::from("/tmp/sandbox");
239-
let resolved = resolve_path(&sandbox, "/foo/bar").unwrap();
239+
let resolved = resolve_path(&sandbox, "/foo/bar").expect("TODO: handle error");
240240
assert_eq!(resolved, PathBuf::from("/tmp/sandbox/foo/bar"));
241241
}
242242

@@ -250,7 +250,7 @@ mod tests {
250250
#[test]
251251
fn test_normalize_parent() {
252252
let sandbox = PathBuf::from("/tmp/sandbox");
253-
let resolved = resolve_path(&sandbox, "foo/../bar").unwrap();
253+
let resolved = resolve_path(&sandbox, "foo/../bar").expect("TODO: handle error");
254254
assert_eq!(resolved, PathBuf::from("/tmp/sandbox/bar"));
255255
}
256256

ffi/rust/src/verification.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -444,8 +444,8 @@ mod tests {
444444

445445
#[test]
446446
fn test_verification_suite() {
447-
let suite = VerificationSuite::new().unwrap();
448-
let results = suite.run_all().unwrap();
447+
let suite = VerificationSuite::new().expect("TODO: handle error");
448+
let results = suite.run_all().expect("TODO: handle error");
449449

450450
for result in &results {
451451
if !result.passed {

0 commit comments

Comments
 (0)