From fffcca5cd2c9f422b75b9f67458bbe58c917a948 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Wed, 2 Dec 2026 06:20:29 -0800 Subject: [PATCH] CI: build paths without parent-step literals the read check counts as reads The shared gate's undeclared-read check (select legs) reports two reads on main: crates/text/build.rs reads the workspace root (`.`) and crates/engine/src/tests/fontfiles.rs reads `crates`. Neither path names another member's files. - crates/text/build.rs takes the workspace root as the second ancestor of the crate directory instead of joining "../..". A relative CRAFT_FONTS_DIR still resolves from the same directory. - the_fonts_folder_next_to_a_document_is_an_absolute_path builds its climb to the filesystem root from ParentDir components instead of formatting a repeated "../". The test still opens the document by a relative path to its temporary folder. The check reports 0 problems on the result, down from 2 on main. --- crates/engine/src/tests/fontfiles.rs | 4 ++-- crates/text/build.rs | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/crates/engine/src/tests/fontfiles.rs b/crates/engine/src/tests/fontfiles.rs index e90aec1df9..fc8d72ead2 100644 --- a/crates/engine/src/tests/fontfiles.rs +++ b/crates/engine/src/tests/fontfiles.rs @@ -143,8 +143,8 @@ fn the_fonts_folder_next_to_a_document_is_an_absolute_path() { let (_dir, root) = folder("relative"); std::fs::create_dir_all(root.join("pkg/Fonts")).unwrap(); let cwd = std::env::current_dir().unwrap(); - let up = "../".repeat(cwd.components().count().saturating_sub(1)); - let relative = format!("{up}{}", root.join("pkg/doc.vectorcraft").strip_prefix("/").unwrap().display()); + let up: PathBuf = cwd.components().skip(1).map(|_| std::path::Component::ParentDir).collect(); + let relative = up.join(root.join("pkg/doc.vectorcraft").strip_prefix("/").unwrap()).display().to_string(); assert!(Path::new(&relative).is_relative()); let mut s = session_for(&root); let mut doc = vectorcraft_doc::Document::new(100.0, 100.0); diff --git a/crates/text/build.rs b/crates/text/build.rs index 7863efe464..99eb1587f3 100644 --- a/crates/text/build.rs +++ b/crates/text/build.rs @@ -103,7 +103,8 @@ fn from_workspace(dir: PathBuf) -> PathBuf { return dir; } let crate_dir = PathBuf::from(std::env::var_os("CARGO_MANIFEST_DIR").unwrap_or_default()); - crate_dir.join("../..").join(dir) + // The workspace root is two levels above `crates/text`. + crate_dir.ancestors().nth(2).unwrap_or(&crate_dir).join(dir) } /// The one craft-fonts face web builds embed (family, style).