{"record":{"id":"c1211cdf800d8931","repo":"astrid-runtime/astrid","slug":"legacy-audit-tree-crosses-a-filesystem-or-mount-bo","errorCode":null,"errorMessage":"legacy audit tree crosses a filesystem or mount boundary: {}","messagePattern":"legacy audit tree crosses a filesystem or mount boundary: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-kernel/src/legacy_migration_barrier/host_fs.rs","lineNumber":523,"sourceCode":"        Err(error) => return Err(error),\n    }\n    Ok(())\n}\n\n#[cfg(not(unix))]\nfn validate_audit_tree(path: &Path, root_device: u64) -> io::Result<()> {\n    let metadata = fs::symlink_metadata(path)?;\n    if metadata.file_type().is_symlink() || !metadata.is_dir() {\n        return Err(io::Error::new(\n            io::ErrorKind::InvalidData,\n            format!(\n                \"legacy audit tree is redirected or not a directory: {}\",\n                path.display()\n            ),\n        ));\n    }\n    if device_id(&metadata) != root_device || active_mountpoint(path)? {\n        return Err(io::Error::new(\n            io::ErrorKind::InvalidData,\n            format!(\n                \"legacy audit tree crosses a filesystem or mount boundary: {}\",\n                path.display()\n            ),\n        ));\n    }\n    astrid_core::platform_fs::verify_no_redirects(path)?;\n    for entry in fs::read_dir(path).map_err(io::Error::other)? {\n        let child = entry.map_err(io::Error::other)?.path();\n        let child_metadata = fs::symlink_metadata(&child).map_err(io::Error::other)?;\n        if child_metadata.file_type().is_symlink()\n            || device_id(&child_metadata) != root_device\n            || active_mountpoint(&child)?\n        {\n            return Err(io::Error::new(\n                io::ErrorKind::InvalidData,\n                format!(","sourceCodeStart":505,"sourceCodeEnd":541,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-kernel/src/legacy_migration_barrier/host_fs.rs#L505-L541","documentation":"validate_audit_tree enforces that the whole legacy audit tree lives on one filesystem: each node's device id must equal the root device and the node must not itself be an active mountpoint. A violation means part of the tree sits on another mount (bind mount, network share, tmpfs), so a same-filesystem rename-based retirement would be incomplete or could silently move only part of the data.","triggerScenarios":"Any validate_audit_tree caller (preflight, retire, recursive descent, delete) encountering a node whose st_dev differs from the root device, or a path that is an active mountpoint — e.g. the audit dir or a subtree is bind-mounted or on a separate partition/NFS mount.","commonSituations":"Users mounting a separate disk or NFS share at ~/.astrid/audit; bind mounts in containers; tmpfs mounted over part of the tree; encrypted-home setups mounting subtrees.","solutions":["Unmount the mount covering the audit path (umount) so the tree is a single filesystem, then re-run migration.","Move the audit data onto the same filesystem as the principal home and remove the external mount.","If the data must stay on another filesystem, consolidate it into the default location before migration."],"exampleFix":"// before\nmount --bind /mnt/data/audit ~/.astrid/principal/audit\n// after\numount ~/.astrid/principal/audit\n# data lives directly on the home filesystem","handlingStrategy":"validation","validationCode":"fn same_device(root: &Path) -> std::io::Result<bool> {\n    use std::os::unix::fs::MetadataExt;\n    let r = std::fs::symlink_metadata(root)?;\n    for entry in std::fs::read_dir(root)? {\n        if std::fs::symlink_metadata(entry?.path())?.dev() != r.dev() { return Ok(false); }\n    }\n    Ok(true)\n}","typeGuard":null,"tryCatchPattern":"if let Err(e) = migrate_legacy_audit(&home, &source) {\n    if e.to_string().contains(\"filesystem or mount boundary\") {\n        // findmnt to locate the mount, unmount it, then retry\n    }\n}","preventionTips":["Never bind-mount or NFS-mount paths under ~/.astrid.","Check `findmnt --target <audit-dir>` before migrating.","Keep audit data on the same filesystem as the principal home."],"tags":["filesystem","mount","device-boundary","migration"],"backgroundTag":"unsupported-operation","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"}