{"record":{"id":"3fd606123d6b498d","repo":"astrid-runtime/astrid","slug":"native-capacity-query-is-unavailable-on-this-platf","errorCode":null,"errorMessage":"native capacity query is unavailable on this platform","messagePattern":"native capacity query is unavailable on this platform","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"crates/astrid-kernel/src/storage_mount/volume_info.rs","lineNumber":66,"sourceCode":"        \"available_blocks\": available,\n        \"created_secs\": timestamp(metadata.created()),\n        \"modified_secs\": timestamp(metadata.modified()),\n    }))\n    .map_err(io::Error::other)\n}\n\n#[cfg(unix)]\nfn timestamp(value: io::Result<std::time::SystemTime>) -> Option<u64> {\n    value\n        .ok()?\n        .duration_since(std::time::UNIX_EPOCH)\n        .ok()\n        .map(|value| value.as_secs())\n}\n\n#[cfg(not(unix))]\nfn snapshot(_root: &std::path::Path) -> io::Result<Vec<u8>> {\n    Err(io::Error::new(\n        io::ErrorKind::Unsupported,\n        \"native capacity query is unavailable on this platform\",\n    ))\n}\n\n#[cfg(all(test, unix))]\nmod tests {\n    use super::*;\n\n    #[test]\n    fn reports_actual_backing_capacity_and_configured_label() {\n        use std::os::unix::fs::MetadataExt;\n        let root = tempfile::tempdir().unwrap();\n        std::fs::write(root.path().join(\"astrid.volume\"), [42; 8192]).unwrap();\n        std::fs::write(\n            root.path().join(\"config.toml\"),\n            \"[filesystem]\\nvolume_name = 'AOS'\\n\",\n        )","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-kernel/src/storage_mount/volume_info.rs#L48-L84","documentation":"volume_info::snapshot collects native filesystem capacity/usage data for a mount root. On non-Unix targets the platform-specific statvfs-style implementation does not exist, so the non-unix snapshot stub unconditionally returns io::ErrorKind::Unsupported with this message.","triggerScenarios":"Calling snapshot() (or any volume-info query that relies on it) on a platform compiled without the unix cfg — e.g. Windows or WASM builds of astrid-kernel.","commonSituations":"Running the kernel on Windows where the capacity query was never ported; cross-compiling to a non-Unix target and exercising volume-info code paths; CI matrix hitting a non-Unix runner.","solutions":["Run on a Unix platform (Linux/macOS/BSD) where the native capacity query is implemented","Guard the caller behind #[cfg(unix)] or a runtime capability check and degrade gracefully when unavailable","Implement a non-unix snapshot() using the platform's native API (e.g. GetDiskFreeSpaceExW on Windows)","Fall back to reporting unknown capacity instead of treating this as fatal"],"exampleFix":"// before\nlet info = volume_info::snapshot(&root)?;\n// after\nlet info = match volume_info::snapshot(&root) {\n    Ok(info) => Some(info),\n    Err(e) if e.kind() == io::ErrorKind::Unsupported => None,\n    Err(e) => return Err(e.into()),\n};","handlingStrategy":"fallback","validationCode":"#[cfg(unix)]\nfn capacity_query_available() -> bool { true }\n#[cfg(not(unix))]\nfn capacity_query_available() -> bool { false }","typeGuard":null,"tryCatchPattern":"match volume_info::snapshot(&root) {\n    Ok(info) => info,\n    Err(e) if e.kind() == io::ErrorKind::Unsupported => {\n        VolumeInfo::unknown() // degrade gracefully on non-unix\n    }\n    Err(e) => return Err(e.into()),\n}","preventionTips":["Gate volume-info features behind #[cfg(unix)] or a runtime capability probe","Skip capacity reporting in non-Unix deployments instead of failing the mount","Track platform support in CI so non-Unix builds exercise the fallback path"],"tags":["platform","unsupported","capacity"],"backgroundTag":"unsupported-platform","analyzedSha":"affd8760f44190dbdfbec23403f4c4b642c33112","analyzedAt":"2026-09-09T21:28:12.402Z","contentChangedAt":"2026-09-09T21:28:12.402Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}