open-standards/scripts/test-public-text-checks.sh
Transaction Science 348a2d9259 wai: restate the ranking phrases the retrofit left in research and extensions
The retrofit's commit says the research notes, extensions and source
comments make no comparisons. These lines still ranked or promoted:

- research/cargo-roadmap.md: the sequencing rationale and the phase
  reasons now say what each phase reuses or carries, and the status note
  points to content-taxonomy.md for each class's status.
- research/content-taxonomy.md: the "white space" table is now the
  cargo-roadmap phase table, with each phase marked shipped and its
  capability named, so it no longer contradicts the taxonomy rows above
  it; the closing clause of the spatial-audio row and "That's the whole
  map" are removed.
- extensions/spatial-audio.md and research/spatial-audio-draft.md: the
  appendix says why spatial audio was first without ranking it.
- SPEC.md §5, extensions/ternary-tt.md and the CAP_TERNARY_TT comment:
  wai.ternary.tt is stated by its own measured operating point (13.3 dB
  SNR at 3.8x with six residual layers, the extension's table) and its
  Lossy tier.
- research/2030-transport-landscape.md: three lines restated as what WAI
  specifies; the CHANGELOG entry now says comparative framing in dated
  records is restated in place, as names are redacted.
- wai-rs/src/lib.rs: the quantum_qec comment ends at the metric it carries.

scripts/check-comparative-prose.sh gains five phrases (commercial wedge,
unclaimed, fast win, differentiator, rate-competitive), each with a case
in scripts/test-public-text-checks.sh.

REGISTRY.md and vocab/README.md say that the v2 SHACL shape checks the
capability and fallback against this revision's registry and only the
form of media, and that a violation for an unregistered string means it
is not registered in this revision, not that the envelope fails to
conform or cannot be dispatched (SPEC §4, §8).

The CHANGELOG's candidate-capability bullet states the MINOR rule as a
full sentence.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-01 08:38:05 -04:00

87 lines
4.5 KiB
Shell
Executable file

#!/usr/bin/env bash
#
# test-public-text-checks.sh
#
# Self-test of scripts/check-public-names.sh and scripts/check-comparative-prose.sh.
# Each case feeds a check a fixture file (or a pattern list) and states the exit
# status it must give:
# - a hit exits 1, a clean file exits 0;
# - an opt-out with a reason is honoured, and one with an empty reason (the
# comment form `<!-- allow-name: -->`, whose `-->` must not count as the
# reason) is not;
# - a pattern grep cannot compile exits 2, never "clean".
# The fixture names a made-up company, never a real one.
#
# Exit status: 0 when every case gives its stated status, 1 otherwise.
set -uo pipefail
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
names="$REPO_ROOT/scripts/check-public-names.sh"
prose="$REPO_ROOT/scripts/check-comparative-prose.sh"
tmp="$(mktemp -d)"
trap 'rm -rf "$tmp"' EXIT
failures=0
expect() { # expect <status> <label> <command...>
local want="$1" label="$2"
shift 2
"$@" >"$tmp/out" 2>&1
local got=$?
if [ "$got" -eq "$want" ]; then
echo "ok $label (exit $got)"
else
echo "FAIL $label: exit $got, expected $want"
sed 's/^/ /' "$tmp/out"
failures=$((failures + 1))
fi
}
printf 'This line names Zyxwvut Holdings.\n' > "$tmp/bare.md"
printf 'Zyxwvut Holdings <!-- allow-name: a model-hub id the tool defaults to -->\n' > "$tmp/reasoned.md"
printf 'Zyxwvut Holdings <!-- allow-name: -->\n' > "$tmp/empty-comment.md"
printf 'Zyxwvut Holdings // allow-name:\n' > "$tmp/empty-line.rs"
printf 'This line names nothing.\n' > "$tmp/clean.md"
list='Zyxwvut'
expect 1 "names: a bare name is a hit" env WAI_NAME_DENYLIST="$list" bash "$names" "$tmp/bare.md"
expect 0 "names: an opt-out with a reason is honoured" env WAI_NAME_DENYLIST="$list" bash "$names" "$tmp/reasoned.md"
expect 1 "names: an opt-out with an empty reason in a comment is not" env WAI_NAME_DENYLIST="$list" bash "$names" "$tmp/empty-comment.md"
expect 1 "names: an opt-out with an empty reason at end of line is not" env WAI_NAME_DENYLIST="$list" bash "$names" "$tmp/empty-line.rs"
expect 0 "names: a clean file is clean" env WAI_NAME_DENYLIST="$list" bash "$names" "$tmp/clean.md"
expect 2 "names: a malformed pattern fails closed" env WAI_NAME_DENYLIST="$(printf 'Zyxwvut\n([unclosed')" bash "$names" "$tmp/clean.md"
expect 2 "names: an unset list fails closed" env -u WAI_NAME_DENYLIST bash "$names" "$tmp/clean.md"
expect 2 "names: a missing file fails closed" env WAI_NAME_DENYLIST="$list" bash "$names" "$tmp/no-such-file.md"
printf 'Its reproducibility is the superiority claim.\n' > "$tmp/superiority.md"
printf 'About 8 kbps, well below Xcodec at the same quality.\n' > "$tmp/well-below.md"
printf 'Its token rate is among the lowest of any codec.\n' > "$tmp/among.md"
printf 'One property nothing else in the field offers.\n' > "$tmp/nothing-else.md"
printf 'State-feeds are the biggest commercial wedge.\n' > "$tmp/wedge.md"
printf 'Joules-per-decode, the unclaimed metric.\n' > "$tmp/unclaimed.md"
printf 'Haptics is a fast win.\n' > "$tmp/fast-win.md"
printf 'Carriage is not a differentiator any more.\n' > "$tmp/differentiator.md"
printf 'It is not a rate-competitive codec.\n' > "$tmp/rate-competitive.md"
printf 'This is the moat <!-- allow-phrase: -->\n' > "$tmp/prose-empty.md"
printf 'WAI_MOAT_DIR <!-- allow-phrase: an environment variable name, not prose -->\n' > "$tmp/prose-reasoned.md"
printf 'The decoder is integer all the way down.\n' > "$tmp/prose-clean.md"
expect 1 "prose: superiority" bash "$prose" "$tmp/superiority.md"
expect 1 "prose: well below <Name>" bash "$prose" "$tmp/well-below.md"
expect 1 "prose: among the lowest" bash "$prose" "$tmp/among.md"
expect 1 "prose: nothing else ... offers" bash "$prose" "$tmp/nothing-else.md"
expect 1 "prose: commercial wedge" bash "$prose" "$tmp/wedge.md"
expect 1 "prose: unclaimed" bash "$prose" "$tmp/unclaimed.md"
expect 1 "prose: fast win" bash "$prose" "$tmp/fast-win.md"
expect 1 "prose: differentiator" bash "$prose" "$tmp/differentiator.md"
expect 1 "prose: rate-competitive" bash "$prose" "$tmp/rate-competitive.md"
expect 1 "prose: an opt-out with an empty reason is not honoured" bash "$prose" "$tmp/prose-empty.md"
expect 0 "prose: an opt-out with a reason is honoured" bash "$prose" "$tmp/prose-reasoned.md"
expect 0 "prose: a clean file is clean" bash "$prose" "$tmp/prose-clean.md"
expect 2 "prose: a missing file fails closed" bash "$prose" "$tmp/no-such-file.md"
if [ $failures -gt 0 ]; then
echo "$failures case(s) gave the wrong status"
exit 1
fi
echo "public-text check self-test: every case gave its stated status"