fix(pack-census): fixed-string retired match, fragment top-level key allowlist
grep -qxF on gstack-removed.list; a fragment carrying a top-level key other than enabledPlugins, deniedMcpServers, disableClaudeAiConnectors or model is RED. T13-unknown-key.
This commit is contained in:
1 parent
84463e130a
commit
2fb9a2f4c1
4 files changed
+16
-4
No files matched your search
@@ -1,5 +1,5 @@
|
|||||||
# The gstack skills this config never exposes: one name per line, read by
|
# The gstack skills this config never exposes: one name per line, read by
|
||||||
# lib/pack-census.sh (grep -qx), so these comment lines never match.
|
# lib/pack-census.sh (grep -qxF), so these comment lines never match.
|
||||||
# A name listed is in no pack and no profile, `max` included. Pruned
|
# A name listed is in no pack and no profile, `max` included. Pruned
|
||||||
# 2026-09-28 (BDR-105); the helpers once housed in lib/gstack-removed.sh
|
# 2026-09-28 (BDR-105); the helpers once housed in lib/gstack-removed.sh
|
||||||
# are gone with the symlink toggling (BDR-117).
|
# are gone with the symlink toggling (BDR-117).
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
# lib/pack-census-fragments.jq — fragment invariants (lib/pack-census.sh).
|
# lib/pack-census-fragments.jq — fragment invariants (lib/pack-census.sh).
|
||||||
# $m = manifests [{id,on}]; inputs = lib/profiles/*.json. Prints RED lines,
|
# $m = manifests [{id,on}]; inputs = lib/profiles/*.json. Prints RED lines,
|
||||||
# and WARN lines for a pack id with no manifest.
|
# and WARN lines for a pack id with no manifest. A fragment may carry only
|
||||||
|
# the top-level keys lib/profile.sh reads (an allowlist).
|
||||||
def name_of: input_filename | sub(".*/"; "");
|
def name_of: input_filename | sub(".*/"; "");
|
||||||
def dn: [(.deniedMcpServers // [])[] | .serverName] | sort;
|
def dn: [(.deniedMcpServers // [])[] | .serverName] | sort;
|
||||||
[inputs | {f: name_of, frag: .}] as $all
|
[inputs | {f: name_of, frag: .}] as $all
|
||||||
@@ -17,6 +18,11 @@ def dn: [(.deniedMcpServers // [])[] | .serverName] | sort;
|
|||||||
| ( if ($g.enabledPlugins | keys) != $keys
|
| ( if ($g.enabledPlugins | keys) != $keys
|
||||||
then "RED lib/profiles/\($f): key set differs from full.json"
|
then "RED lib/profiles/\($f): key set differs from full.json"
|
||||||
else empty end ),
|
else empty end ),
|
||||||
|
( ($g | keys)
|
||||||
|
- ["enabledPlugins", "deniedMcpServers", "disableClaudeAiConnectors",
|
||||||
|
"model"]
|
||||||
|
| select(length > 0)
|
||||||
|
| "RED lib/profiles/\($f): unknown top-level key(s) \(join(", "))" ),
|
||||||
( ["model-router@skills-dir", "security-guidance@claude-code-plugins"][]
|
( ["model-router@skills-dir", "security-guidance@claude-code-plugins"][]
|
||||||
| select($g.enabledPlugins[.] != true)
|
| select($g.enabledPlugins[.] != true)
|
||||||
| "RED lib/profiles/\($f): \(.) must be true" ),
|
| "RED lib/profiles/\($f): \(.) must be true" ),
|
||||||
|
|||||||
+3
-2
@@ -9,7 +9,8 @@
|
|||||||
# 1. manifest parses, name = folder; every entry resolves (dangling =
|
# 1. manifest parses, name = folder; every entry resolves (dangling =
|
||||||
# WARN; RED with --installed on a pack ON by manifest); no skill both
|
# WARN; RED with --installed on a pack ON by manifest); no skill both
|
||||||
# flat and in a pack; no retired gstack name (lib/gstack-removed.list).
|
# flat and in a pack; no retired gstack name (lib/gstack-removed.list).
|
||||||
# 2. fragments lib/profiles/*.json: same key set as full.json; model-router
|
# 2. fragments lib/profiles/*.json: same key set as full.json, only the
|
||||||
|
# top-level keys profile.sh reads (allowlist); model-router
|
||||||
# + security-guidance true, example-skills + brightdata false
|
# + security-guidance true, example-skills + brightdata false
|
||||||
# everywhere; full.json packs = manifest defaults.
|
# everywhere; full.json packs = manifest defaults.
|
||||||
# 3. no reader of the old layout left (scope and terms in check_citers).
|
# 3. no reader of the old layout left (scope and terms in check_citers).
|
||||||
@@ -62,7 +63,7 @@ check_entry() { # $1 pack dir, $2 entry path
|
|||||||
red "$n: $s target missing (pack ON)"
|
red "$n: $s target missing (pack ON)"
|
||||||
else echo "WARN $n: $s target missing (installer not run)"; fi
|
else echo "WARN $n: $s target missing (installer not run)"; fi
|
||||||
fi
|
fi
|
||||||
[ -f "$REMOVED" ] && grep -qx -- "$s" "$REMOVED" \
|
[ -f "$REMOVED" ] && grep -qxF -- "$s" "$REMOVED" \
|
||||||
&& red "$n: $s is a retired gstack skill"
|
&& red "$n: $s is a retired gstack skill"
|
||||||
if [ -n "${seen[$s]:-}" ]; then
|
if [ -n "${seen[$s]:-}" ]; then
|
||||||
red "$s listed twice: ${seen[$s]} and $n; run: $(dup_remedy "$s")"
|
red "$s listed twice: ${seen[$s]} and $n; run: $(dup_remedy "$s")"
|
||||||
|
|||||||
@@ -104,6 +104,11 @@ jq '. + {deniedMcpServers: [{serverName: "claude.ai Fictional"}]}' "$FX/lib/prof
|
|||||||
out="$(census)"
|
out="$(census)"
|
||||||
check T13-deny-differs "$(grep -c 'zdev.json are identical fragments' <<<"$out")" 0
|
check T13-deny-differs "$(grep -c 'zdev.json are identical fragments' <<<"$out")" 0
|
||||||
rm "$FX/lib/profiles/zdev.json"
|
rm "$FX/lib/profiles/zdev.json"
|
||||||
|
jq '. + {bogusKey: 1, model: "sonnet"}' "$FX/lib/profiles/dev.json" > "$FX/lib/profiles/zdev.json"
|
||||||
|
out="$(census)"; rc=$?
|
||||||
|
check T13-unknown-key-rc "$rc" 1
|
||||||
|
check_has T13-unknown-key "$out" "RED lib/profiles/zdev.json: unknown top-level key(s) bogusKey"
|
||||||
|
rm "$FX/lib/profiles/zdev.json"
|
||||||
sed 's/pack-beta@skills-dir": false/pack-beta@skills-dir": false, "pack-ghost@skills-dir": false/' "$FX/lib/profiles/dev.json" > "$FX/lib/profiles/ghost.json"
|
sed 's/pack-beta@skills-dir": false/pack-beta@skills-dir": false, "pack-ghost@skills-dir": false/' "$FX/lib/profiles/dev.json" > "$FX/lib/profiles/ghost.json"
|
||||||
out="$(census)"; rc=$?
|
out="$(census)"; rc=$?
|
||||||
check_has T14-ghost "$out" "WARN lib/profiles/ghost.json: names pack-ghost with no skills/pack-ghost/"
|
check_has T14-ghost "$out" "WARN lib/profiles/ghost.json: names pack-ghost with no skills/pack-ghost/"
|
||||||
|
|||||||
Reference in new issue
Block a user