astrid-runtime/astrid · error

outside fixture

Error message

outside fixture

What it means

The message "outside fixture" is the expect() on std::fs::create_dir(&outside) at audit_retirement_tests.rs:34. This test step creates a plain directory named 'outside' directly under the tempdir root; it is the target that a symlink inside the audit dir will point to. std::fs::create_dir (not create_dir_all) fails if the parent is missing or the path already exists, so this expect panics if the tempdir vanished or 'outside' somehow pre-exists.

Source

Thrown at crates/astrid-kernel/src/audit_retirement_tests.rs:34

    assert!(!principal_home.audit_dir().exists());
    assert!(
        !home
            .migrations_dir()
            .join("audit-principal-home.retired")
            .exists()
    );
}

#[cfg(unix)]
#[test]
fn audit_retirement_rejects_redirects_before_removal() {
    let directory = tempfile::tempdir().expect("temporary home");
    let home = AstridHome::from_path(directory.path().join(".astrid"));
    home.ensure().expect("home layout");
    let principal_home = home.principal_home(&astrid_core::PrincipalId::default());
    principal_home.ensure().expect("legacy principal layout");
    let outside = directory.path().join("outside");
    std::fs::create_dir(&outside).expect("outside fixture");
    std::os::unix::fs::symlink(&outside, principal_home.audit_dir().join("redirect"))
        .expect("redirect fixture");

    assert!(retire_legacy_audit_dir(&home, &principal_home.audit_dir()).is_err());
    assert!(principal_home.audit_dir().exists());
}

#[test]
fn derived_audit_recertify_helper_rejects_invalid_history() {
    let valid = vec![(
        SessionId::new(),
        ChainVerificationResult {
            valid: true,
            entries_verified: 1,
            issues: Vec::new(),
        },
    )];
    require_audit_integrity(&valid).expect("valid history is accepted by the derived helper");

View on GitHub (pinned to affd8760f4)

Solutions

  1. Ensure the tempdir from line 28 is still alive at this point (the TempDir guard must not be dropped early).
  2. Switch std::fs::create_dir to std::fs::create_dir_all only if parents may legitimately be missing — otherwise prefer fixing the fixture order.
  3. Check nothing else creates a sibling named 'outside' before this line; rename the fixture directory if a collision is possible.
  4. Confirm the filesystem permits directory creation (no read-only remount) on the CI runner.

Example fix

// before
std::fs::create_dir(&outside).expect("outside fixture");
// after
std::fs::create_dir(&outside)
    .unwrap_or_else(|e| panic!("outside fixture: create {}: {e}", outside.display()));
Defensive patterns

Strategy: validation

Validate before calling

if outside.exists() {
    panic!("outside fixture path {} already exists", outside.display());
}
if !directory.path().is_dir() {
    panic!("tempdir root {} vanished before fixture setup", directory.path().display());
}

Try / catch

std::fs::create_dir(&outside)
    .unwrap_or_else(|e| panic!("outside fixture: {}: {e}", outside.display()));

Prevention

When it happens

Trigger: create_dir fails with NotFound (tempdir root removed), AlreadyExists (a leftover 'outside' entry at the same path), or PermissionDenied on the tempdir; note create_dir does not create parents, so any change upstream that alters directory.path() breaks this call.

Common situations: Antivirus/cleanup daemons deleting tempdir contents mid-test; a test refactor that renamed or re-rooted the tempdir variable; parallel tests sharing a fixed TMPDIR path and colliding on the name 'outside' (only if tempdir uniqueness is broken).

Understand the failure class

Background: "failed to write file", "Could not save figure", "Error saving remote file" — file write failed: causes and fixes across languages and libraries — this error's family across 38 libraries.

Related errors


AI-assisted analysis of astrid-runtime/astrid@affd8760f4 (2026-09-09). Data as JSON: /api/errors/01d56d4bbfaa4546. Report an issue: GitHub.