diff --git a/tests/no_agent_token_surface.sh b/tests/no_agent_token_surface.sh index 369ea19..3962a1d 100755 --- a/tests/no_agent_token_surface.sh +++ b/tests/no_agent_token_surface.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash # -# SPEC-omarchy red lines (backend, G2): the shipped plugin surface must never +# SPEC-omarchy red lines (backend, G2c): the shipped plugin surface must never # advertise or use a Geode agent / token interface. ci.yml already runs every # tests/*.sh under `set -e`, so a non-zero exit here fails the tree. # @@ -10,15 +10,13 @@ # Matched substrings (case-insensitive): # agent serve · GTOK · GEODE_TOKEN · tui --token · agent token # -# `//` line comments are stripped before matching -- in the JS and the QML -# source alike. Model.js documents these very red lines in comments ("Red -# lines (SPEC-omarchy G0): no `--token`, no `GEODE_TOKEN` written by ..."), -# and documentation of the prohibition is not a usage of it. manifest.json has -# no comment syntax and README.md is shipped prose, so both are matched -# verbatim. Block comments are NOT stripped: no guarded source uses one, so a -# red-line string inside one fails loudly instead of passing silently. +# The four files are scanned as RAW TEXT: no comment stripping, no escaping, no +# exclusions. A red-line string is a red line wherever it appears -- source, +# JSON, prose, or a `//` comment. Comment cleanup (PR #5) removed these +# substrings from Model.js's comments, which is what keeps the clean tree +# green; a comment that reintroduces `GEODE_TOKEN` fails it again. # -# No `geode` subprocess, no socket, no Omarchy: awk + grep over four files. +# No `geode` subprocess, no socket, no Omarchy: grep over four files. # # Exit 0 when the tree is clean, 1 on any hit or missing guarded file. @@ -39,22 +37,11 @@ for f in "${files[@]}"; do fi done -# Comment-stripped view of one source file. One output line per input line, so -# reported line numbers stay the file's own. -strip_line_comments() { - awk '{ sub(/\/\/.*/, ""); print }' "$1" -} - status=0 for f in "${files[@]}"; do - case "$f" in - *.js | *.qml) view=$(strip_line_comments "$f") ;; - *) view=$(cat -- "$f") ;; - esac - for p in "${patterns[@]}"; do - if found=$(printf '%s\n' "$view" | grep -inF -- "$p"); then - echo "FAIL: $f carries the red-line string \"$p\" outside comments:" >&2 + if found=$(grep -inF -- "$p" "$f"); then + echo "FAIL: $f carries the red-line string \"$p\":" >&2 printf '%s\n' "$found" | awk '{ print " " $0 }' >&2 status=1 fi