Skip to content

Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows

test(configure_shell): pin the AUR PKGBUILD's fish completion to its generator (#4062)

Worktrunk Botc93b494bd004
diff --git a/.gitattributes b/.gitattributes
index 9beac5ce4..9cd43ecf3 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -28,6 +28,10 @@ dev/*.example.toml linguist-generated=true
# Shell templates are embedded into the binary at compile time (askama); a
# CRLF checkout would leak \r into the shell code Windows-built binaries emit.
templates/* text eol=lf
+# makepkg reads the PKGBUILD as a shell script, and a CRLF checkout also breaks
+# `test_aur_pkgbuild_ships_the_current_fish_completion`, which matches the
+# file's heredoc byte-for-byte against `fish_completion_content("wt")`.
+.github/aur/PKGBUILD text eol=lf
# cmd.exe resolves a `goto` label by seeking through the batch file, and an
# LF-only batch file can fail that search ("The system cannot find the batch
# label specified"). The hook shim is only ever run by cmd.exe, so pin its
diff --git a/Cargo.toml b/Cargo.toml
index 34fc51bdf..29b876fa6 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -47,6 +47,13 @@ globs = [
]
filterset = "test(/readme_sync/)"
+# The AUR PKGBUILD hand-copies the fish completion `fish_completion_content`
+# generates; `test_aur_pkgbuild_ships_the_current_fish_completion` reads it at
+# test time (fs::read_to_string), so coverage can't link the two.
+[[workspace.metadata.affected.rule]]
+globs = [".github/aur/PKGBUILD"]
+filterset = "test(/aur_pkgbuild/)"
+
[package]
name = "worktrunk"
version = "0.77.0"
diff --git a/src/commands/configure_shell.rs b/src/commands/configure_shell.rs
index 375fd96fb..6876fa80a 100644
--- a/src/commands/configure_shell.rs
+++ b/src/commands/configure_shell.rs
@@ -1787,6 +1787,33 @@ mod tests {
insta::assert_snapshot!(fish_completion_content("myapp"));
}
+ /// The `worktrunk-bin` AUR package installs fish completions from a
+ /// heredoc in `.github/aur/PKGBUILD` — makepkg runs no Rust, so that
+ /// literal is a hand-copied second copy of `fish_completion_content("wt")`,
+ /// as its own `TODO` says. Nothing else pins the two together: editing the
+ /// generator here ships a stale completion to AUR users on the next
+ /// release, and the only symptom is someone's tab-completion quietly
+ /// producing nothing. `release.yaml` still publishes the package: the docs
+ /// point at the official Arch package now, but `worktrunk-bin` was kept
+ /// publishing deliberately (#2052) and users track it for newer releases.
+ ///
+ /// `.github/aur/PKGBUILD` is read at test time and so never appears in
+ /// coverage; the `workspace.metadata.affected.rule` for it in `Cargo.toml`
+ /// is what force-selects this test when the PKGBUILD alone changes.
+ #[test]
+ fn test_aur_pkgbuild_ships_the_current_fish_completion() {
+ let pkgbuild_path =
+ std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join(".github/aur/PKGBUILD");
+ let pkgbuild = std::fs::read_to_string(&pkgbuild_path)
+ .unwrap_or_else(|err| panic!("read {}: {err}", pkgbuild_path.display()));
+ let expected = fish_completion_content("wt");
+ assert!(
+ pkgbuild.contains(&expected),
+ ".github/aur/PKGBUILD ships a fish completion that no longer matches \
+ `fish_completion_content(\"wt\")`. Replace the body of its heredoc with:\n\n{expected}"
+ );
+ }
+
#[test]
fn test_verify_completion_preimage_rejects_changed_state() {
let previewed = b"# previewed completion\n".as_slice();