From 1b3ea180c3cc289fa71c20de1a0dfd5b9ad12941 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Wed, 2 Dec 2026 06:32:53 -0800 Subject: [PATCH] CI: build two paths without parent-step literals so test selection passes The select legs failed because the shared gate's undeclared-read check (craft-common-actions #451) still counts two paths as reads outside their crate. The engine test built a relative path to a temporary folder from "../".repeat(n), reported as a read of `crates`; the text build script joined CARGO_MANIFEST_DIR with "../..", reported as a read of the repository root. Neither reads a tracked file. The test now builds the path from Component::ParentDir, and the build script takes the manifest directory's grandparent; both give the same paths as before. --- crates/engine/src/tests/fontfiles.rs | 4 ++-- crates/text/build.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/engine/src/tests/fontfiles.rs b/crates/engine/src/tests/fontfiles.rs index e90aec1df9..e503a98691 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: std::path::PathBuf = std::iter::repeat_n(std::path::Component::ParentDir, cwd.components().count().saturating_sub(1)).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..a4e3dcf58c 100644 --- a/crates/text/build.rs +++ b/crates/text/build.rs @@ -103,7 +103,7 @@ 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) + crate_dir.parent().and_then(Path::parent).unwrap_or(&crate_dir).join(dir) } /// The one craft-fonts face web builds embed (family, style).