fix(skills): share deleted-upstream denylist between Nix and rebuild

This commit is contained in:
hermes committed 2026-11-29 13:22:54 -05:00
1 parent 72a23ff0d0
commit e4c67f0080
8 files changed
+159 -2

No files matched your search

+1
View File
@@ -44,6 +44,7 @@ printf '#!/bin/sh\nprintf wrapper\n' > "$TMP/home/.pi/agent/bin/bird"
printf '#!/bin/sh\nprintf homebrew\n' > "$TMP/homebrew/bin/bird"
chmod +x "$TMP/home/.pi/agent/bin/bird" "$TMP/homebrew/bin/bird"
# shellcheck disable=SC2016 # the snippet expands inside the fresh zsh
resolved=$(HOME="$TMP/home" ZSHRC="$TMP/zshrc" \
PATH="$TMP/homebrew/bin:/usr/bin:/bin" \
timeout 60 zsh -f -i -c '
+19
View File
@@ -210,6 +210,25 @@ class RebuildUpdates(unittest.TestCase):
self.execute()
self.assertFalse(any(call[:2] == ["npm", "install"] for call in self.calls))
def test_deleted_upstream_skills_never_reach_the_cli(self):
denied = (ROOT / "deleted-upstream-skills.txt").read_text().split()
self.assertEqual(len(denied), 20)
names = denied + ["tdd", "security-audit", "codebase-design"]
(self.home / ".agents/.skill-lock.json").write_text(
json.dumps({"skills": {name: {} for name in names}}))
self.state["skills"] = {name: "old" for name in names}
self.execute()
skills_call = next(call for call in self.calls if call[0] == "npx")
for name in denied:
self.assertNotIn(name, skills_call)
self.assertEqual(self.state["skills"][name], "old")
self.assertIn("tdd", skills_call)
self.assertEqual(self.state["skills"]["tdd"], "new")
self.assertNotIn("security-audit", skills_call)
self.assertEqual(self.state["skills"]["security-audit"], "old")
self.assertIn("codebase-design", skills_call)
self.assertEqual(self.state["skills"]["codebase-design"], "new")
def test_absent_packages_are_not_installed_or_queried(self):
self.state["packages"] = {}
self.execute()
+1
View File
@@ -15,5 +15,6 @@ status=0
"$ROOT/tests/rebuild-update-steps.sh" || status=1
"$ROOT/tests/bird-brave-e2e.sh" || status=1
"$ROOT/tests/bird-path.sh" || status=1
"$ROOT/tests/skill-denylist.sh" || status=1
exit "$status"
+59
View File
@@ -0,0 +1,59 @@
#!/usr/bin/env bash
# End-to-end check for the shared deleted-upstream skill denylist.
#
# The same source-controlled file must drive both paths. home.nix copies it to
# the Nix store and reads it in home.activation.removeDeletedUpstreamSkills.
# rebuild.sh reads it from its own checkout before calling the Skills CLI. This
# check compares the Nix copy with the source file and confirms rebuild.sh uses
# the same name to filter CLI arguments. The CLI call itself is exercised with
# spies in tests/rebuild-update-steps.py.
set -euo pipefail
ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)
LIST="$ROOT/deleted-upstream-skills.txt"
CONFIG='(builtins.getFlake (toString '"$ROOT"')).darwinConfigurations."lt-mbp".config.home-manager.users.laptran'
fail() { printf 'FAIL: %s\n' "$1" >&2; exit 1; }
pass() { printf 'PASS: %s\n' "$1"; }
command -v nix >/dev/null 2>&1 \
|| { echo "skill-denylist: nix is required to evaluate the configuration" >&2; exit 2; }
[ -r "$LIST" ] || fail "denylist missing at $LIST"
expected='agent-self-scheduling
codex-goal-loop
delegating-to-agents
markdown-rendering
run-deep-swe
cyber-audit
pi-custom-model
vps-server-management
pi-web-search
research-prompt
youtube-polls
youtube-transcript
distribute-skill-to-all-agents
folder-specific-claude-and-agents-md
push-skill-to-github
brain-to-docs
grill-me
interview-style-doc-building
short
teach'
[ "$(cat "$LIST")" = "$expected" ] || fail "denylist does not hold the 20 expected names"
pass "denylist holds the 20 deleted upstream skills"
activation=$(nix eval --raw --impure --expr "$CONFIG.home.activation.removeDeletedUpstreamSkills.data")
nix_list=$(printf '%s\n' "$activation" | sed -n 's/^deny_file=//p')
[ -n "$nix_list" ] || fail "activation script does not reference a denylist file"
cmp -s "$nix_list" "$LIST" || fail "Nix denylist copy differs from $LIST"
pass "home.nix activation reads the same denylist"
# shellcheck disable=SC2016 # the literal line in rebuild.sh is the assertion
grep -qF 'DENYLIST="$DIR/deleted-upstream-skills.txt"' "$ROOT/rebuild.sh" \
|| fail "rebuild.sh does not read the shared denylist"
grep -qF 'name not in denied' "$ROOT/rebuild.sh" \
|| fail "rebuild.sh does not filter denied names from the Skills CLI call"
pass "rebuild.sh reads the same denylist and filters CLI arguments"