{"record":{"id":"8502ae0ae214c393","repo":"astral-sh/ruff","slug":"truth-source-directory-dir-does-not-contain-a","errorCode":null,"errorMessage":"truth source directory `{dir}` does not contain a base name","messagePattern":"truth source directory `(.+?)` does not contain a base name","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/ty_completion_eval/src/main.rs","lineNumber":432,"sourceCode":"\n            let dir = SystemPath::from_std_path(&path).ok_or_else(|| {\n                anyhow::anyhow!(\n                    \"truth source directory `{path}` contains invalid UTF-8\",\n                    path = path.display()\n                )\n            })?;\n            sources.push(TaskSource::new(dir)?);\n        }\n        // Sort our sources so that we always run in the same order.\n        // And also so that the CSV output is deterministic across\n        // all platforms.\n        sources.sort_by(|source1, source2| source1.name.cmp(&source2.name));\n        Ok(sources)\n    }\n\n    fn new(dir: &SystemPath) -> anyhow::Result<TaskSource> {\n        let name = dir.file_name().ok_or_else(|| {\n            anyhow::anyhow!(\"truth source directory `{dir}` does not contain a base name\")\n        })?;\n\n        let truth_path = dir.join(\"completion.toml\");\n        let truth_data = std::fs::read(truth_path.as_std_path())\n            .with_context(|| format!(\"failed to read truth data at `{truth_path}`\"))?;\n        let truth = toml::from_slice(&truth_data).with_context(|| {\n            format!(\"failed to parse TOML completion truth data from `{truth_path}`\")\n        })?;\n\n        Ok(TaskSource {\n            dir: dir.to_path_buf(),\n            name: name.to_string(),\n            truth,\n        })\n    }\n\n    /// Convert this \"source\" task (from the Ruff repository) into\n    /// one or more evaluation tasks within a single Python project.","sourceCodeStart":414,"sourceCodeEnd":450,"githubUrl":"https://github.com/astral-sh/ruff/blob/672bb4edf04c84f8b0753346359daee4057158f2/crates/ty_completion_eval/src/main.rs#L414-L450","documentation":"`TaskSource::new` takes the fixture directory's `file_name()` as the source name; like error 74, `file_name()` is None only for root/dot paths. This is an internal invariant asserting the standard truth layout: every child of `truth/` must be a normally-named directory containing a `completion.toml`.","triggerScenarios":"A truth tree where an enumerated child directory resolves to a degenerate path (root or `..`-terminated); practically only reachable via a tampered or script-generated truth layout or a harness bug.","commonSituations":"Automated scripts writing fixtures into unusual locations; refactors of the truth enumeration code.","solutions":["Keep the standard layout: `truth/<fixture-name>/completion.toml` plus source files","If hit with an unmodified checkout, report upstream with the exact command and tree"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"for d in crates/ty_completion_eval/truth/*/; do\n  [ -f \"${d}completion.toml\" ] || echo \"fixture missing completion.toml: $d\" >&2\ndone","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Follow the standard layout `truth/<name>/completion.toml`","Never generate fixture directories as root or dot paths","Report unmodified-tree hits upstream"],"tags":["evaluation","paths","invariant","internal"],"backgroundTag":null,"analyzedSha":"672bb4edf04c84f8b0753346359daee4057158f2","analyzedAt":"2026-08-16T08:54:05.464Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}