Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
bump: minor
---

### Changed

- `scripts/resolve-config.sh` reads the config-cascade layers. The team layer and the new personal override, `testing.local.yaml`, come from the repository's convention home (`docs/conventions` unless the repository binds another), and a broken convention-home pointer stops the scan config. A `userConfig` value set to anything other than its default now wins over `~/.claude/testing.yaml` for the run-e2e and map keys. `/testing:setup apply` writes the team layer under the same convention home, and `/testing:audit` resolves the config when `docs/conventions/testing.local.yaml` is the only file ([#18050](https://github.com/melodic-software/claude-code-plugins/issues/18050)).

### Deprecated

- `~/.claude/testing.yaml`, `.claude/testing.yaml` and `.claude/testing.local.yaml` are still read. Each run prints one warning for each of these files it finds, naming where to move it. The old personal override is ignored once `<home>/testing.local.yaml` exists ([#18050](https://github.com/melodic-software/claude-code-plugins/issues/18050)).
18 changes: 12 additions & 6 deletions plugins/testing/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,10 @@ The team layer is `docs/conventions/testing.yaml`, validated by
takes, plus the two run-e2e keys above. Without it, the team layer is the `yaml config` block in
`docs/conventions/testing.md` (read for one more release), else `<root>/.claude/testing.yaml`. The
first of the three present wins, and the resolver prints one warning for each other one present.
The prose testing rules stay in `docs/conventions/testing.md`. This release still reads the
user-global and `.claude/testing.local.yaml` layers at those paths.
The prose testing rules stay in `docs/conventions/testing.md`. The personal override is
`docs/conventions/testing.local.yaml`. The convention home is the folder that holds these files,
`docs/conventions` by default. When the repository's `AGENTS.md` or `CLAUDE.md` binds another
convention home, the resolver reads all three files from that folder.

#### Move the team layer to `docs/conventions/testing.yaml`

Expand All @@ -196,10 +198,14 @@ user-global and `.claude/testing.local.yaml` layers at those paths.
3. Once every member runs this release, delete the old block or file. Until then every run prints a
warning naming both; an older release keeps reading the old one.

This release moves only the team layer. It still reads `~/.claude/testing.yaml` and
`.claude/testing.local.yaml`; keep them there until the plugin migrates
([#17999](https://github.com/melodic-software/claude-code-plugins/issues/17999)), then move them
where [config locations](reference/config-locations.md) says. Reading the block costs the same as reading the file; the measured p50 and p95 are in the
`scripts/resolve-config.sh` still reads the old files, and each run prints one warning for each
old file it finds, naming where to move it. `.claude/testing.yaml` goes to
`docs/conventions/testing.yaml`. `.claude/testing.local.yaml` goes to
`docs/conventions/testing.local.yaml`; once that new file exists, the resolver ignores the old one.
Each setting in `~/.claude/testing.yaml` goes to its `userConfig` option, and a setting with no
option goes to `docs/conventions/testing.local.yaml`. A `userConfig` value other than its default
wins over the old file. The other scripts and skills move in their own changes
([#17999](https://github.com/melodic-software/claude-code-plugins/issues/17999)). Reading the block costs the same as reading the file; the measured p50 and p95 are in the
[latency probes](https://github.com/melodic-software/claude-code-plugins/blob/927a5305d238874ce006eaad6b3fa5c3cb07ebc1/docs/specs/tautological-tests/probes.md#team-layer-location-docs-block-or-claudetestingyaml-wsl2),
and `plugins/testing/scripts/time-config.sh` reproduces them.

Expand Down
12 changes: 7 additions & 5 deletions plugins/testing/hooks/judge-lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -241,10 +241,11 @@ judge::drop() {
#
# The result is cached under derive/, keyed by the sha256 of the info, this
# hook directory (so a plugin update re-derives), the file's current content
# and each testing config file (docs/conventions/testing.yaml and .md, and the
# .claude/testing.yaml layers): block identity is name and ordinal in the
# current text, so the same inputs give the same keys and the scanner runs
# again only when one of them changed. A scan that failed is never cached.
# and each testing config file (docs/conventions/testing.yaml, .md and
# .local.yaml, and the .claude/testing.yaml layers; the same list the
# scanner's own pre-check in skills/audit/scripts/cant-fail-scan.sh tests):
# block identity is name and ordinal in the current text, so the same inputs
# give the same keys and the scanner runs again only when one of them changed. A scan that failed is never cached.
judge::derive() {
local file whole base_ok names lines tmpd rc n=0 re line cur marks=() b s e o name keep m text=() i b_start b_end
local root cfg cfgs=() key="" h cache c=()
Expand All @@ -259,7 +260,8 @@ judge::derive() {
fi
judge::file_repo "$file"
root="${FREPO:-${CLAUDE_PROJECT_DIR:-}}"
for cfg in "${HOME:-}/.claude/testing.yaml" "$root/docs/conventions/testing.yaml" "$root/docs/conventions/testing.md" "$root/.claude/testing.yaml" "$root/.claude/testing.local.yaml"; do
for cfg in "${HOME:-}/.claude/testing.yaml" "$root/docs/conventions/testing.yaml" "$root/docs/conventions/testing.md" \
"$root/docs/conventions/testing.local.yaml" "$root/.claude/testing.yaml" "$root/.claude/testing.local.yaml"; do
[[ -f "$cfg" ]] && cfgs+=("$cfg")
done
# sha256sum prefixes a line with \ when the file name holds a backslash.
Expand Down
2 changes: 1 addition & 1 deletion plugins/testing/scripts/check-browser-driver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ fi

cat >&2 <<EOF
check-browser-driver: browser_driver is '$tool' (source: $source), and no command named '$tool' is on PATH. The run stops before driving anything.
Ways forward: install '$tool', or set browser_driver to a browser tool you have, in .claude/testing.local.yaml, docs/conventions/testing.yaml, ~/.claude/testing.yaml or the testing plugin's browser_driver option.
Ways forward: install '$tool', or set browser_driver to a browser tool you have, in docs/conventions/testing.local.yaml, docs/conventions/testing.yaml (or the same files in the convention home the repository binds) or the testing plugin's browser_driver option.
No other browser tool is used as a silent substitute, and a run never switches tools partway through.
EOF
exit 1
86 changes: 65 additions & 21 deletions plugins/testing/scripts/resolve-config.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
#!/usr/bin/env bash
# resolve-config.sh — resolve the testing plugin's config cascade.
#
# LAYERS, per the config-cascade convention, in order: user-global
# (~/.claude/testing.yaml), team and a gitignored personal override
# (<root>/.claude/testing.local.yaml). The team layer is
# <root>/docs/conventions/testing.yaml when it exists (schema:
# LAYERS, per the config-cascade convention, in order: user-global, team and a
# gitignored personal override (<root>/<home>/testing.local.yaml). <home> is the
# convention home the pointer region binds (lib/resolve-convention-home.sh),
# else docs/conventions; a broken pointer exits 2. The team layer is
# <root>/<home>/testing.yaml when it exists (schema:
# schemas/testing.schema.json). Without it, the team layer is the ```yaml config
# block of <root>/docs/conventions/testing.md when that file holds one, else
# block of <root>/<home>/testing.md when that file holds one, else
# <root>/.claude/testing.yaml; the docs block is read for one more release. The
# first of the three present wins, and a warning naming it and each other one
# present goes to stderr. Lists concatenate with the first
# present goes to stderr. OLD LOCATIONS, read during the dual-read window:
# ~/.claude/testing.yaml is the user-global layer (the cascade has none; its
# settings move to userConfig), <root>/.claude/testing.yaml the team fallback,
# and <root>/.claude/testing.local.yaml the personal override when
# <home>/testing.local.yaml is absent. Each one read, or ignored beside its new
# file, prints one warning naming it and where to move it. Lists concatenate with the first
# occurrence kept; a scalar in a later layer overrides. The format is the
# adapters' YAML subset, parsed by skills/audit/scripts/adapter-load.awk
# -v MODE=config (its header lists the keys and the block form), so no jq, yq
Expand Down Expand Up @@ -56,15 +62,16 @@
# script, stops when that command is not on PATH.
# It prints `<key> <tab> <value> <tab> <source>` per key, the source being the
# layer file, userConfig, or default. Highest first: the personal override,
# docs/conventions/testing.yaml, the user-global file, then the --user value
# (the rendered userConfig option; an unrendered ${user_config.<key>} or an
# empty value is unset). The first that sets the key decides; an unknown,
# <home>/testing.yaml, the --user value (the rendered userConfig option; an
# unrendered ${user_config.<key>}, an empty value or the default is unset),
# then the old user-global file. The first that sets the key decides; an unknown,
# nested or unparsable value there is named on stderr and the key takes its
# default, never a lower layer's value. The docs block and .claude/testing.yaml are not read for
# these keys: a release older than this mode refuses them there, which stops
# its scan. Each value goes through parse-concern-value.sh, so the scan keys'
# grammar never applies, and a scan config that does not resolve, a missing
# repository or a symlinked layer (skipped with a warning) never stops it.
# repository, a broken convention-home pointer (no <home> layer is read) or a
# symlinked layer (skipped with a warning) never stops it.
#
# MAP: `resolve-config.sh map` resolves the keys of /testing:run-e2e's map
# scope the same way as E2E, --user values and layer order included, and prints
Expand Down Expand Up @@ -92,12 +99,13 @@
# --root the repository root the team layer, the personal override and
# relative paths resolve against. Default: the current directory's git toplevel,
# else $CLAUDE_PROJECT_DIR.
# --home the directory holding the user-global layer. Default: $HOME.
# --home the directory holding the old user-global file. Default: $HOME.
# --quick skip the adapter load and hook.uncovered: the test-scan.sh path,
# where the scanner's own adapter load still refuses a bad extend.
# Adapter ids are still checked, against the adapter files' id: lines.
#
# Exit: 0 resolved, 2 usage error, a team layer or personal override that is a symlink
# Exit: 0 resolved, 2 usage error, a convention-home pointer that does not resolve
# (scan mode only), a team layer or personal override that is a symlink
# or under a symlinked directory inside <root>, or an unreadable, unparsable or invalid
# layer (the file and line are named on stderr).

Expand Down Expand Up @@ -216,6 +224,45 @@ PLUGIN="$PLUGIN/.."
# A warning can quote a layer's text: strip non-printing bytes, keeping \t and \n.
warn() { printf 'resolve-config: warning: %s\n' "$1" | LC_ALL=C tr -d '\000-\010\013-\037\177' >&2; }

CONV_HOME=""
if [[ -n "$ROOT" ]]; then
CONV_HOME=docs/conventions
home_rc=0
bound="$(bash "$PLUGIN/lib/resolve-convention-home.sh" --root "$ROOT" 2>/dev/null)" || home_rc=$?
case "$home_rc" in
0) CONV_HOME="${bound//$'\r'/}" ;;
1 | 4 | 5) ;;
*)
broken="the convention-home pointer in $ROOT does not resolve (resolve-convention-home.sh exit $home_rc)"
[[ "$MODE" != scan ]] || die "$broken"
warn "$broken; reading no layer under it"
CONV_HOME=""
;;
esac
fi
NEW_LOC="${CONV_HOME:-<home>}"
TEAM_NEW="${CONV_HOME:+$ROOT/$CONV_HOME/testing.yaml}"
TEAM_DOCS="${CONV_HOME:+$ROOT/$CONV_HOME/testing.md}"
TEAM_YAML="$ROOT/.claude/testing.yaml"
PERSONAL_NEW="${CONV_HOME:+$ROOT/$CONV_HOME/testing.local.yaml}"
PERSONAL_OLD="$ROOT/.claude/testing.local.yaml"
USER_OLD="${USER_HOME_DIR:+$USER_HOME_DIR/.claude/testing.yaml}"

PERSONAL=""
if [[ -n "$ROOT" ]]; then
if [[ -f "$PERSONAL_NEW" ]]; then
PERSONAL="$PERSONAL_NEW"
[[ ! -f "$PERSONAL_OLD" ]] ||
warn "$PERSONAL_NEW and $PERSONAL_OLD both exist; using $PERSONAL_NEW, ignoring the old file: move any setting it still holds into $PERSONAL_NEW"
elif [[ -f "$PERSONAL_OLD" ]]; then
PERSONAL="$PERSONAL_OLD"
warn "$PERSONAL_OLD is an old location, still read for now; move it to $NEW_LOC/testing.local.yaml"
fi
fi
if [[ "$MODE" != write && -f "$USER_OLD" ]]; then
warn "$USER_OLD is an old location, still read for now: there is no user-global file layer; move each setting to its testing userConfig option, else to $NEW_LOC/testing.local.yaml"
fi

# under_link <file>: true when <file>, or a directory above it inside <root>,
# is a symlink. A repository could point such a layer at any file.
under_link() {
Expand Down Expand Up @@ -248,8 +295,7 @@ mode_keys() {
[[ "$val" != '${user_config.'* ]] || val=""
user_val[${u%%=*}]="$val"
done
for f in ${ROOT:+"$ROOT/.claude/testing.local.yaml" "$ROOT/docs/conventions/testing.yaml"} \
${USER_HOME_DIR:+"$USER_HOME_DIR/.claude/testing.yaml"}; do
for f in ${PERSONAL:+"$PERSONAL"} ${TEAM_NEW:+"$TEAM_NEW"} ${USER_OLD:+"$USER_OLD"}; do
[[ -f "$f" ]] || continue
if under_link "$f"; then
warn "skipping a layer that is a symlink or under a symlinked directory: $f"
Expand Down Expand Up @@ -277,11 +323,12 @@ mode_keys() {
esac
val="" src="" raw="" u="${user_val[$key]:-}"
for f in ${files[@]+"${files[@]}"}; do
[[ "$f" != "$USER_OLD" || -z "$u" || "$u" == "$def" ]] || break
# The first layer with the key's top-level line sets it; only that line
# reaches the parser, so a nested, non-scalar or unparsable value reads
# as empty and is reported below.
lines="$(LC_ALL=C sed -e $'1s/^\xef\xbb\xbf//' -e 's/\r$//' "$f" | grep -E "^${key}[[:space:]]*:")" || continue
if [[ -n "$repo_only" && "$f" == "$USER_HOME_DIR/.claude/testing.yaml" ]]; then
if [[ -n "$repo_only" && "$f" == "$USER_OLD" ]]; then
warn "$f: $key is a repository $repo_only; the user-global layer is not read for it"
continue
fi
Expand Down Expand Up @@ -319,10 +366,6 @@ elif [[ "$MODE" == write ]]; then
exit 0
fi

TEAM_NEW="$ROOT/docs/conventions/testing.yaml"
TEAM_DOCS="$ROOT/docs/conventions/testing.md"
TEAM_YAML="$ROOT/.claude/testing.yaml"

# gather <team file>: set layers to the user-global layer, that team layer and
# the personal override, as present.
layers=()
Expand All @@ -331,8 +374,7 @@ gather() {
local f
layers=()
layer_seen=()
for f in ${USER_HOME_DIR:+"$USER_HOME_DIR/.claude/testing.yaml"} \
"$1" "$ROOT/.claude/testing.local.yaml"; do
for f in ${USER_OLD:+"$USER_OLD"} "$1" ${PERSONAL:+"$PERSONAL"}; do
[[ -f "$f" && -z "${layer_seen[$f]:-}" ]] || continue
! under_link "$f" || die "layer is a symlink or under a symlinked directory, refusing to read it: $f"
[[ -r "$f" ]] || die "layer is not readable: $f"
Expand Down Expand Up @@ -367,6 +409,8 @@ else
gather "$TEAM_YAML"
records="$(load)" || exit 2
fi
[[ -z "${layer_seen[$TEAM_YAML]:-}" ]] ||
warn "$TEAM_YAML is an old location, still read for now; move it to $CONV_HOME/testing.yaml"
[[ ${#layers[@]} -gt 0 ]] || exit 0

out=()
Expand Down
Loading
Loading