Merge branch 'main' into fix/apm-audit-git-env
This commit is contained in:
commit
2c6e82747c
2 files changed
+40
-3
No files matched your search
@@ -17,6 +17,12 @@ set -euo pipefail
|
||||
# defect it exists to close — so the clean run's own count is asserted against
|
||||
# the index rather than taken on trust.
|
||||
|
||||
# Fixtures below run `git init`/`git commit` in temp dirs. Under a git hook,
|
||||
# git exports GIT_DIR (and can export GIT_WORK_TREE / GIT_INDEX_FILE), which
|
||||
# would point every `git -C "$fixture"` at THIS repo instead (see
|
||||
# tests/run-tests.sh). Never inherit the caller's repository.
|
||||
unset GIT_DIR GIT_WORK_TREE GIT_INDEX_FILE GIT_OBJECT_DIRECTORY GIT_COMMON_DIR
|
||||
|
||||
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
SCRIPT="$REPO_ROOT/scripts/check-apm-agents-valid.sh"
|
||||
PASS=0
|
||||
@@ -277,6 +283,34 @@ else
|
||||
pass "a missing validate.sh exits 1 and names the stale path"
|
||||
fi
|
||||
|
||||
# --- 8. A checkout that itself sits under .claude/worktrees/ discovers its agents ---
|
||||
# A Claude Code worktree lives at <repo>/.claude/worktrees/<name>/, so every
|
||||
# absolute path the script sees contains /.claude/worktrees/. A filter matched
|
||||
# against that absolute path excluded every agent file and the gate reported
|
||||
# "N of N tracked agent file(s) were not discovered" (#199).
|
||||
echo ""
|
||||
echo "--- a checkout under .claude/worktrees/ discovers its own agent files ---"
|
||||
FIX8_PARENT="$(make_fixture)"
|
||||
FIXTURES+=("$FIX8_PARENT")
|
||||
FIX8="$FIX8_PARENT/.claude/worktrees/agent-x"
|
||||
mkdir -p "$FIX8"
|
||||
mv "$FIX8_PARENT/plugins" "$FIX8/plugins"
|
||||
git -C "$FIX8" init -q
|
||||
git -C "$FIX8" add -A
|
||||
git -C "$FIX8" -c user.email=[email protected] -c user.name=t commit -qm "fixture"
|
||||
if ! bash "$SCRIPT" "$FIX8" > "$RUN_TMP/worktree.out" 2>&1; then
|
||||
fail "a checkout under .claude/worktrees/ failed — its own agent files were excluded"
|
||||
sed 's/^/ /' "$RUN_TMP/worktree.out"
|
||||
elif grep -q 'not a git worktree root' "$RUN_TMP/worktree.out"; then
|
||||
fail "the fixture did not resolve as its own git worktree root, so the derived check never ran"
|
||||
sed 's/^/ /' "$RUN_TMP/worktree.out"
|
||||
elif ! grep -q 'APM agent validation passed: 1 plugin-scope' "$RUN_TMP/worktree.out"; then
|
||||
fail "a checkout under .claude/worktrees/ passed but did not validate its one agent file"
|
||||
sed 's/^/ /' "$RUN_TMP/worktree.out"
|
||||
else
|
||||
pass "a checkout under .claude/worktrees/ discovers and validates its own agent file"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "Results: $PASS passed, $FAIL failed"
|
||||
[[ $FAIL -eq 0 ]]
|
||||
Reference in new issue
Block a user