aboutsummaryrefslogtreecommitdiff
path: root/scripts/tests
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-06-15 19:16:27 -0500
committerCraig Jennings <c@cjennings.net>2026-06-15 19:16:27 -0500
commite7be0deef03210b96d167cd75bbc6be374941869 (patch)
tree97b54a38062b21ee4575ed2b3db9a5033f7b7ed5 /scripts/tests
parent1898a0d85d7da0bf05b4337a11fd1b823b5827fe (diff)
downloadrulesets-e7be0deef03210b96d167cd75bbc6be374941869.tar.gz
rulesets-e7be0deef03210b96d167cd75bbc6be374941869.zip
fix(audit): exclude retired projects from the sync target list
The audit's project discovery uses find -maxdepth 3, which reaches ~/projects/.retired/<name>/.ai — one level deeper than a live project — so shelved projects were getting template syncs they should never receive. Skip any project under a .retired/ ancestor explicitly, so the exclusion holds regardless of the find depth.
Diffstat (limited to 'scripts/tests')
-rw-r--r--scripts/tests/audit.bats17
1 files changed, 17 insertions, 0 deletions
diff --git a/scripts/tests/audit.bats b/scripts/tests/audit.bats
index 3df69c9..0b062fb 100644
--- a/scripts/tests/audit.bats
+++ b/scripts/tests/audit.bats
@@ -113,6 +113,23 @@ git_init_with_ai_tracked() {
! grep -q "# uncommitted" "$TEST_HOME/code/alpha/.ai/protocols.org"
}
+@test "audit: retired projects are excluded entirely" {
+ # ~/projects/.retired/<name> holds shelved projects. The audit must
+ # never sync into them — they're not live targets. A drifted retired
+ # project must not appear in the output or the counts.
+ scaffold_synced_ai "$TEST_HOME/projects/.retired/oldproj"
+ echo "# drift marker" >> "$TEST_HOME/projects/.retired/oldproj/.ai/protocols.org"
+ scaffold_synced_ai "$TEST_HOME/code/alpha"
+
+ run bash "$AUDIT" --no-doctor
+
+ # The retired project is invisible to the audit, in any state.
+ [[ "$output" != *".retired/oldproj"* ]]
+ # The live project is still audited and clean.
+ [[ "$output" == *"ok ~/code/alpha"* ]]
+ [[ "$output" == *"Summary: 1 ok, 0 drift, 0 skipped, 0 failed"* ]]
+}
+
@test "audit: loop continues past .ai/-missing failure" {
# Edge case 2 from todo.org:1766. The defensive [ ! -d "$proj/.ai" ]
# branch fires when a discovered .ai/ disappears between find and