run_tests: Stop treating non-workspace dirs as packages (#60502)

The `orchestrate` job maps changed directories to root-workspace package
names, and when no mapping was found it fell back to using the raw
directory name as a package. Because `tooling/lints` is a separate
workspace (not a root-workspace member), a change under
`tooling/lints/**` produced the filter `rdeps(lints)`, which `cargo
nextest run --workspace` rejects with "operator didn't match any
packages" — failing `run_tests` for any such PR. This drops that
fallback so an unmapped directory falls through to the existing "no
package changes → run all tests" path instead.

Release Notes:

- N/A
This commit is contained in:
Richard Feldman 2026-07-06 21:20:27 -04:00 committed by GitHub
parent e7311d52ba
commit 52bc5a0488
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 16 additions and 6 deletions

View file

@ -76,11 +76,16 @@ jobs:
FILE_CHANGED_PKGS=""
for dir in $CHANGED_DIRS; do
pkg=$(echo "$DIR_TO_PKG" | grep "^${dir}=" | cut -d= -f2 | head -1 || true)
# Only add directories that map to a real root-workspace package.
# Some directories (e.g. tooling/lints) belong to a separate workspace
# and are not root members, so they have no mapping here. Previously we
# fell back to the raw directory name, which fabricated a bogus package
# (e.g. "lints") and produced a nextest filter like rdeps(lints) that
# hard-errors ("operator didn't match any packages"). Skipping such
# directories leaves the package set empty, which falls through to the
# "run all tests" path below.
if [ -n "$pkg" ]; then
FILE_CHANGED_PKGS=$(printf '%s\n%s' "$FILE_CHANGED_PKGS" "$pkg")
else
# Fall back to directory name if no mapping found
FILE_CHANGED_PKGS=$(printf '%s\n%s' "$FILE_CHANGED_PKGS" "$dir")
fi
done
FILE_CHANGED_PKGS=$(echo "$FILE_CHANGED_PKGS" | grep -v '^$' | sort -u || true)

View file

@ -222,11 +222,16 @@ fn orchestrate_impl(rules: &[&PathCondition], target: OrchestrateTarget) -> Name
FILE_CHANGED_PKGS=""
for dir in $CHANGED_DIRS; do
pkg=$(echo "$DIR_TO_PKG" | grep "^${dir}=" | cut -d= -f2 | head -1 || true)
# Only add directories that map to a real root-workspace package.
# Some directories (e.g. tooling/lints) belong to a separate workspace
# and are not root members, so they have no mapping here. Previously we
# fell back to the raw directory name, which fabricated a bogus package
# (e.g. "lints") and produced a nextest filter like rdeps(lints) that
# hard-errors ("operator didn't match any packages"). Skipping such
# directories leaves the package set empty, which falls through to the
# "run all tests" path below.
if [ -n "$pkg" ]; then
FILE_CHANGED_PKGS=$(printf '%s\n%s' "$FILE_CHANGED_PKGS" "$pkg")
else
# Fall back to directory name if no mapping found
FILE_CHANGED_PKGS=$(printf '%s\n%s' "$FILE_CHANGED_PKGS" "$dir")
fi
done
FILE_CHANGED_PKGS=$(echo "$FILE_CHANGED_PKGS" | grep -v '^$' | sort -u || true)