{"record":{"id":"01d56d4bbfaa4546","repo":"astrid-runtime/astrid","slug":"outside-fixture","errorCode":null,"errorMessage":"outside fixture","messagePattern":"outside fixture","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-kernel/src/audit_retirement_tests.rs","lineNumber":34,"sourceCode":"    assert!(!principal_home.audit_dir().exists());\n    assert!(\n        !home\n            .migrations_dir()\n            .join(\"audit-principal-home.retired\")\n            .exists()\n    );\n}\n\n#[cfg(unix)]\n#[test]\nfn audit_retirement_rejects_redirects_before_removal() {\n    let directory = tempfile::tempdir().expect(\"temporary home\");\n    let home = AstridHome::from_path(directory.path().join(\".astrid\"));\n    home.ensure().expect(\"home layout\");\n    let principal_home = home.principal_home(&astrid_core::PrincipalId::default());\n    principal_home.ensure().expect(\"legacy principal layout\");\n    let outside = directory.path().join(\"outside\");\n    std::fs::create_dir(&outside).expect(\"outside fixture\");\n    std::os::unix::fs::symlink(&outside, principal_home.audit_dir().join(\"redirect\"))\n        .expect(\"redirect fixture\");\n\n    assert!(retire_legacy_audit_dir(&home, &principal_home.audit_dir()).is_err());\n    assert!(principal_home.audit_dir().exists());\n}\n\n#[test]\nfn derived_audit_recertify_helper_rejects_invalid_history() {\n    let valid = vec![(\n        SessionId::new(),\n        ChainVerificationResult {\n            valid: true,\n            entries_verified: 1,\n            issues: Vec::new(),\n        },\n    )];\n    require_audit_integrity(&valid).expect(\"valid history is accepted by the derived helper\");","sourceCodeStart":16,"sourceCodeEnd":52,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-kernel/src/audit_retirement_tests.rs#L16-L52","documentation":"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.","triggerScenarios":"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.","commonSituations":"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).","solutions":["Ensure the tempdir from line 28 is still alive at this point (the TempDir guard must not be dropped early).","Switch std::fs::create_dir to std::fs::create_dir_all only if parents may legitimately be missing — otherwise prefer fixing the fixture order.","Check nothing else creates a sibling named 'outside' before this line; rename the fixture directory if a collision is possible.","Confirm the filesystem permits directory creation (no read-only remount) on the CI runner."],"exampleFix":"// before\nstd::fs::create_dir(&outside).expect(\"outside fixture\");\n// after\nstd::fs::create_dir(&outside)\n    .unwrap_or_else(|e| panic!(\"outside fixture: create {}: {e}\", outside.display()));","handlingStrategy":"validation","validationCode":"if outside.exists() {\n    panic!(\"outside fixture path {} already exists\", outside.display());\n}\nif !directory.path().is_dir() {\n    panic!(\"tempdir root {} vanished before fixture setup\", directory.path().display());\n}","typeGuard":null,"tryCatchPattern":"std::fs::create_dir(&outside)\n    .unwrap_or_else(|e| panic!(\"outside fixture: {}: {e}\", outside.display()));","preventionTips":["Keep the TempDir guard alive for the whole test so the root is not deleted mid-setup.","Use unique fixture names if sibling tests could collide inside a shared tempdir.","Prefer create_dir_all when parent existence is not guaranteed by earlier steps.","Investigate any external temp cleaners (AV, tmpwatch) that delete files during test runs."],"tags":["rust","filesystem","test-fixture","unix"],"backgroundTag":"file-write-failed","analyzedSha":"affd8760f44190dbdfbec23403f4c4b642c33112","analyzedAt":"2026-09-09T21:28:12.402Z","contentChangedAt":"2026-09-09T21:28:12.402Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}