{"record":{"id":"1f2db2334eb837cc","repo":"astrid-runtime/astrid","slug":"legacy-distro-path-detail","errorCode":null,"errorMessage":"legacy distro {path}: {detail}","messagePattern":"legacy distro (.+?): (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-kernel/src/principal_distro_migration.rs","lineNumber":562,"sourceCode":"\n#[cfg(unix)]\nfn sync_parent(path: &Path) -> io::Result<()> {\n    if let Some(parent) = path.parent() {\n        File::open(parent)?.sync_all()?;\n    }\n    Ok(())\n}\n\n#[cfg(not(unix))]\n// Windows publication is already write-through; keep the shared fallible\n// signature so migration call sites remain platform-independent.\n#[allow(clippy::unnecessary_wraps)]\nfn sync_parent(_path: &Path) -> io::Result<()> {\n    Ok(())\n}\n\nfn invalid(path: &Path, detail: &str) -> io::Error {\n    io::Error::new(\n        io::ErrorKind::InvalidData,\n        format!(\"legacy distro {}: {detail}\", path.display()),\n    )\n}\n\nfn conflict(path: &Path, detail: &str) -> io::Error {\n    io::Error::new(\n        io::ErrorKind::AlreadyExists,\n        format!(\"legacy distro conflict at {}: {detail}\", path.display()),\n    )\n}\n\n#[cfg(test)]\nmod tests {\n    use super::*;\n\n    fn lock_text() -> &'static str {\n        \"schema-version = 1\\n\\n[distro]\\nid = \\\"example\\\"\\nversion = \\\"1.0.0\\\"\\nresolved-at = \\\"2026-01-01T00:00:00Z\\\"\\n\"","sourceCodeStart":544,"sourceCodeEnd":580,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-kernel/src/principal_distro_migration.rs#L544-L580","documentation":"This io::Error with ErrorKind::InvalidData wraps any problem found while inspecting or migrating a legacy distro directory. It is the generic rejection path of the legacy distro migration code: the path exists but fails a structural or content check. The {detail} suffix carries the specific reason.","triggerScenarios":"Calling invalid(path, detail) from legacy_distro_destination_proof, legacy_distro_init_destination_proof, migrate_one, validate, identifier, or nonempty when a legacy distro path fails validation — e.g. missing/empty identifier, bad destination proof, or unreadable metadata.","commonSituations":"Hand-copied distro directories missing expected files, legacy distros produced by older versions with a different layout, or paths containing unexpected content after manual edits.","solutions":["Read the {detail} portion of the message to identify the exact failed check","Inspect the legacy distro directory at {path} against the expected legacy layout","Re-create or repair the legacy distro using the tooling that produced it originally","Skip or quarantine the invalid distro if it is no longer needed"],"exampleFix":"// before: migration aborts on invalid distro\nmigrate_legacy_distro(path)?;\n// after: validate first and skip bad entries\nif let Err(e) = validate_legacy_distro(path) {\n    log::warn!(\"skipping invalid distro {path}: {e}\");\n    return Ok(());\n}","handlingStrategy":"try-catch","validationCode":"fn distro_looks_valid(path: &Path) -> bool {\n    path.is_dir() && path.join(\"identifier\").is_file()\n}","typeGuard":"fn is_valid_distro_path(p: &Path) -> bool { p.is_dir() && p.metadata().is_ok() }","tryCatchPattern":"match migrate_one(path) {\n    Err(e) if e.kind() == io::ErrorKind::InvalidData => warn!(\"skip distro {}: {e}\", path.display()),\n    Err(e) => return Err(e),\n    Ok(()) => {},\n}","preventionTips":["Validate distro layout before starting migration","Never hand-edit legacy distro internals","Keep distro creation tooling and migration in version lockstep"],"tags":["filesystem","migration","invalid-data"],"backgroundTag":"invalid-argument-value","analyzedSha":"affd8760f44190dbdfbec23403f4c4b642c33112","analyzedAt":"2026-09-09T21:28:12.402Z","contentChangedAt":"2026-09-09T21:28:12.402Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}