{"record":{"id":"0f7a8a2c65c73840","repo":"astral-sh/ruff","slug":"could-not-find-any-cursor-directives-in-any-of","errorCode":null,"errorMessage":"could not find any `<CURSOR>` directives in any of the files in `{src_dir}`","messagePattern":"could not find any `<CURSOR>` directives in any of the files in `(.+?)`","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/ty_completion_eval/src/main.rs","lineNumber":577,"sourceCode":"\n        let src = SystemPath::from_std_path(dent.path()).ok_or_else(|| {\n            anyhow::anyhow!(\"path `{}` is not valid UTF-8\", dent.path().display())\n        })?;\n        let name = src\n            .strip_prefix(src_dir)\n            .expect(\"descendent of `src_dir` must start with `src`\");\n        // let name = src\n        // .file_name()\n        // .ok_or_else(|| anyhow::anyhow!(\"path `{src}` is missing a basename\"))?;\n        let dst = dst_dir.join(name);\n        if dent.file_type().is_dir() {\n            std::fs::create_dir_all(dst.as_std_path())\n                .with_context(|| format!(\"failed to create directory `{dst}`\"))?;\n        } else {\n            cursors.extend(copy_file(src, &dst)?);\n        }\n    }\n    anyhow::ensure!(\n        !cursors.is_empty(),\n        \"could not find any `<CURSOR>` directives in any of the files in `{src_dir}`\",\n    );\n    Ok(cursors)\n}\n\n/// Copies `src` to `dst` while looking for cursor directives.\n///\n/// Each cursor directive looks like:\n/// `<CURSOR [expected-module.]expected-symbol>`.\n///\n/// When occurrences of cursor directives are found, then they are\n/// replaced with the empty string. The position of each occurrence is\n/// recorded, which points to the correct place in a document where all\n/// cursor directives are omitted.\n///\n/// # Errors\n///","sourceCodeStart":559,"sourceCodeEnd":595,"githubUrl":"https://github.com/astral-sh/ruff/blob/672bb4edf04c84f8b0753346359daee4057158f2/crates/ty_completion_eval/src/main.rs#L559-L595","documentation":"`to_tasks` copies the fixture into the temp dir while stripping `<CURSOR ...>` directives and recording their offsets; if not a single directive is found in any file under the fixture's source directory, this guard fires. Every eval fixture must contain at least one `<CURSOR [expected-module.]expected-symbol>` marker in a Python file — the markers are what define tasks.","triggerScenarios":"Adding a new truth fixture whose Python files contain no `<CURSOR>` annotations; annotating non-Python files or files outside the copied source tree; a directive spelling the copier does not recognize.","commonSituations":"First-time fixture authorship (forgot the markers); refactors that rename or move the directive format; fixtures copied from real projects without adding markers.","solutions":["Add at least one directive to a Python file in the fixture, e.g. `os.<CURSOR path>` (cursor after `os.`, expecting completion `path`)","Verify with `grep -rn '<CURSOR' <fixture-dir>` that at least one marker exists in files that get copied","Check the directive syntax matches `<CURSOR [expected-module.]expected-symbol>` exactly"],"exampleFix":"# before (fixture/src/scratch.py — no directives)\nimport os\n\nprint(os)\n\n# after\nimport os\n\nprint(os.<CURSOR path>)","handlingStrategy":"validation","validationCode":"grep -rq '<CURSOR' \"$FIXTURE_DIR\" \\\n  || { echo \"fixture has no <CURSOR> directives; add at least one\" >&2; exit 2; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Every fixture needs at least one `<CURSOR [expected-module.]expected-symbol>` marker in a Python file","Validate new fixtures with `grep -rn '<CURSOR' <fixture>` before running the harness","Follow the directive syntax exactly; markers must live in files that get copied"],"tags":["evaluation","fixtures","cursor-directives","authoring"],"backgroundTag":null,"analyzedSha":"672bb4edf04c84f8b0753346359daee4057158f2","analyzedAt":"2026-08-16T08:54:05.464Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}