Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion rust/contracts/rust-core-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -3210,7 +3210,13 @@ revision and the diagnostic says so instead of listing modified files.
Automatic run discovery, fingerprint traversal and Node manifest discovery use
Core's shared scan policy. Known caches/build outputs
are pruned before descending; other hidden source directories remain visible and
symlinks are not followed. Failure to read the workspace root is an error. An
symlinks are not followed. Automatic run discovery and `build.detect` search at
most 6 levels and also prune directories Git ignores, using the `.gitignore`
files they pass and the `info/exclude` of each repository whose root lies in the
workspace (a linked worktree reads the main repository's shared one); a nested
repository starts its own rules. Nothing above the workspace root is read, nor
`core.excludesFile` or the index. Fingerprint traversal and Node manifest
discovery keep ignored directories. Failure to read the workspace root is an error. An
unreadable optional child or fingerprint input is recorded in
`generator.unreadablePaths`; generation retains previous configurations and input
hashes beneath those unknown paths. Inspection returns `incompleteProjectScan`
Expand Down
23 changes: 23 additions & 0 deletions rust/crates/core/src/tests/build_systems.rs
Original file line number Diff line number Diff line change
Expand Up @@ -754,6 +754,29 @@ fn detection_applies_nesting_priority_and_rejections() {
assert_eq!(gradle["markers"], json!(["android/settings.gradle.kts"]));
}

/// A directory Git ignores is no candidate root: agent worktrees and local copies
/// repeat the project's own manifests, and would list every module twice.
#[test]
fn detection_skips_directories_git_ignores() {
let package = |name: &str| format!("[package]\nname = \"{name}\"\nversion = \"0.1.0\"\n");
let workspace = TemporaryWorkspace::new("build-detect-ignored");
workspace
.write(".git/HEAD", "ref: refs/heads/main\n")
.write(".git/info/exclude", ".claude/worktrees/\n")
.write(".gitignore", "/scratch/\n")
.write("Cargo.toml", &package("app"))
.write("tools/Cargo.toml", &package("tools"))
.write("scratch/Cargo.toml", &package("scratch"))
.write(".claude/worktrees/copy/Cargo.toml", &package("app"));

let detection = detect(
&workspace,
vec![fixture("build-static-file.plugin.json")],
json!({}),
);
assert_eq!(instance_ids(&detection), ["cargo:.", "cargo:tools"]);
}

#[test]
fn detection_returns_empty_for_non_directory_and_missing_workspace_roots() {
let workspace = TemporaryWorkspace::new("build-detect-non-directory");
Expand Down
9 changes: 8 additions & 1 deletion rust/crates/core/src/tests/remote_sessions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -747,6 +747,10 @@ fn shared_run_scan_reads_the_host_tree_and_stops_when_the_link_drops() {
std::fs::create_dir_all(remote.join("service/api")).unwrap();
std::fs::write(remote.join("package.json"), "{}").unwrap();
std::fs::write(remote.join("service/tool-a.toml"), "").unwrap();
// The ignore rules are the host's: the placeholder has no `.gitignore`.
std::fs::create_dir_all(remote.join("generated")).unwrap();
std::fs::write(remote.join("generated/package.json"), "{}").unwrap();
std::fs::write(remote.join(".gitignore"), "generated/\n").unwrap();
let workspace = serde_json::from_value(
json!({"sessionId": host.id, "localRoot": local, "remoteRoot": remote}),
)
Expand All @@ -768,7 +772,10 @@ fn shared_run_scan_reads_the_host_tree_and_stops_when_the_link_drops() {
assert_eq!(
files,
[
(std::path::PathBuf::new(), vec!["package.json".to_owned()]),
(
std::path::PathBuf::new(),
vec![".gitignore".to_owned(), "package.json".to_owned()]
),
("service".into(), vec!["tool-a.toml".to_owned()]),
("service/api".into(), Vec::new()),
]
Expand Down
1 change: 1 addition & 0 deletions rust/crates/execution/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ description = "Run configurations for Lithe: generation, resolution, launch envi
test-support = []

[dependencies]
ignore = "=0.4.33"
lithe-diagnostics = { path = "../diagnostics" }
lithe-plugin-model = { path = "../plugin-model" }
lithe-protocol = { path = "../protocol" }
Expand Down
Loading
Loading